Commit 8b5f8947 authored by estade's avatar estade Committed by Commit bot

Always use vector icons for desktop infobars (when one is defined),

rather than caring about the (deprecated) material design mode.

Make IDR_INFOBAR_SAVE_PASSWORD android-only.

BUG=648281
TBR=oshima@chromium.org

Review-Url: https://codereview.chromium.org/2361843003
Cr-Commit-Position: refs/heads/master@{#420748}
parent de8316f0
...@@ -273,7 +273,9 @@ ...@@ -273,7 +273,9 @@
<structure type="chrome_scaled_image" name="IDR_INFOBAR_PLUGIN_CRASHED" file="common/infobar_plugin_crashed.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_PLUGIN_CRASHED" file="common/infobar_plugin_crashed.png" />
<structure type="chrome_scaled_image" name="IDR_INFOBAR_PLUGIN_INSTALL" file="common/infobar_plugin_install.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_PLUGIN_INSTALL" file="common/infobar_plugin_install.png" />
<structure type="chrome_scaled_image" name="IDR_INFOBAR_RESTORE_SESSION" file="common/infobar_restore_session.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_RESTORE_SESSION" file="common/infobar_restore_session.png" />
<structure type="chrome_scaled_image" name="IDR_INFOBAR_SAVE_PASSWORD" file="common/infobar_save_password.png" /> <if expr="is_android">
<structure type="chrome_scaled_image" name="IDR_INFOBAR_SAVE_PASSWORD" file="common/infobar_save_password.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_INFOBAR_THEME" file="common/infobar_theme.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_THEME" file="common/infobar_theme.png" />
<if expr="is_macosx or is_android"> <if expr="is_macosx or is_android">
<structure type="chrome_scaled_image" name="IDR_INFOBAR_TRANSLATE" file="common/infobar_translate.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_TRANSLATE" file="common/infobar_translate.png" />
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "chrome/browser/certificate_viewer.h" #include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_delegate.h" #include "components/infobars/core/infobar_delegate.h"
...@@ -47,7 +46,6 @@ class SSLAddCertificateInfoBarDelegate : public ConfirmInfoBarDelegate { ...@@ -47,7 +46,6 @@ class SSLAddCertificateInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
Type GetInfoBarType() const override; Type GetInfoBarType() const override;
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
int GetIconId() const override;
gfx::VectorIconId GetVectorIconId() const override; gfx::VectorIconId GetVectorIconId() const override;
base::string16 GetMessageText() const override; base::string16 GetMessageText() const override;
int GetButtons() const override; int GetButtons() const override;
...@@ -86,17 +84,9 @@ SSLAddCertificateInfoBarDelegate::GetIdentifier() const { ...@@ -86,17 +84,9 @@ SSLAddCertificateInfoBarDelegate::GetIdentifier() const {
return SSL_ADD_CERTIFICATE_INFOBAR_DELEGATE; return SSL_ADD_CERTIFICATE_INFOBAR_DELEGATE;
} }
int SSLAddCertificateInfoBarDelegate::GetIconId() const {
// TODO(davidben): Use a more appropriate icon.
return IDR_INFOBAR_SAVE_PASSWORD;
}
gfx::VectorIconId SSLAddCertificateInfoBarDelegate::GetVectorIconId() const { gfx::VectorIconId SSLAddCertificateInfoBarDelegate::GetVectorIconId() const {
#if !defined(OS_MACOSX) // TODO(davidben): Use a more appropriate icon.
return gfx::VectorIconId::AUTOLOGIN; return gfx::VectorIconId::AUTOLOGIN;
#else
return gfx::VectorIconId::VECTOR_ICON_NONE;
#endif
} }
base::string16 SSLAddCertificateInfoBarDelegate::GetMessageText() const { base::string16 SSLAddCertificateInfoBarDelegate::GetMessageText() const {
...@@ -140,12 +130,8 @@ void ShowErrorInfoBar(int message_id, ...@@ -140,12 +130,8 @@ void ShowErrorInfoBar(int message_id,
SimpleAlertInfoBarDelegate::Create( SimpleAlertInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents), InfoBarService::FromWebContents(web_contents),
infobars::InfoBarDelegate::SSL_ADD_CERTIFICATE, infobars::InfoBarDelegate::SSL_ADD_CERTIFICATE,
IDR_INFOBAR_SAVE_PASSWORD, 0,
#if !defined(OS_MACOSX)
gfx::VectorIconId::AUTOLOGIN, gfx::VectorIconId::AUTOLOGIN,
#else
gfx::VectorIconId::VECTOR_ICON_NONE,
#endif
l10n_util::GetStringFUTF16( l10n_util::GetStringFUTF16(
IDS_ADD_CERT_ERR_INVALID_CERT, base::IntToString16(-cert_error), IDS_ADD_CERT_ERR_INVALID_CERT, base::IntToString16(-cert_error),
base::ASCIIToUTF16(net::ErrorToString(cert_error))), base::ASCIIToUTF16(net::ErrorToString(cert_error))),
......
...@@ -43,14 +43,12 @@ gfx::VectorIconId InfoBarDelegate::GetVectorIconId() const { ...@@ -43,14 +43,12 @@ gfx::VectorIconId InfoBarDelegate::GetVectorIconId() const {
gfx::Image InfoBarDelegate::GetIcon() const { gfx::Image InfoBarDelegate::GetIcon() const {
#if !defined(OS_IOS) && !defined(OS_ANDROID) #if !defined(OS_IOS) && !defined(OS_ANDROID)
if (ui::MaterialDesignController::IsModeMaterial()) { gfx::VectorIconId vector_id = GetVectorIconId();
gfx::VectorIconId vector_id = GetVectorIconId(); if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) {
if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { return gfx::Image(gfx::CreateVectorIcon(vector_id, 16,
return gfx::Image(gfx::CreateVectorIcon(vector_id, 16, GetInfoBarType() == WARNING_TYPE
GetInfoBarType() == WARNING_TYPE ? SkColorSetRGB(0xFF, 0x67, 0)
? SkColorSetRGB(0xFF, 0x67, 0) : gfx::kGoogleBlue500));
: gfx::kGoogleBlue500));
}
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment