Commit 512adb1b authored by estade's avatar estade Committed by Commit bot

Update some more infobars to use vector icons.

BUG=520266

Review URL: https://codereview.chromium.org/1364913005

Cr-Commit-Position: refs/heads/master@{#351168}
parent aa791903
......@@ -34,6 +34,7 @@
#include "content/public/common/webplugininfo.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/vector_icons_public.h"
#if defined(ENABLE_PLUGIN_INSTALLATION)
#if defined(OS_WIN)
......@@ -136,6 +137,7 @@ class ReloadPluginInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfobarDelegate:
int GetIconId() const override;
gfx::VectorIconId GetVectorIconId() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
......@@ -167,6 +169,14 @@ int ReloadPluginInfoBarDelegate::GetIconId() const {
return IDR_INFOBAR_PLUGIN_CRASHED;
}
gfx::VectorIconId ReloadPluginInfoBarDelegate::GetVectorIconId() const {
#if !defined(OS_MACOSX) && !defined(OS_IOS) && !defined(OS_ANDROID)
return gfx::VectorIconId::EXTENSION_CRASHED;
#else
return gfx::VectorIconId::VECTOR_ICON_NONE;
#endif
}
base::string16 ReloadPluginInfoBarDelegate::GetMessageText() const {
return message_;
}
......@@ -407,6 +417,11 @@ void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) {
SimpleAlertInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents()),
IDR_INFOBAR_PLUGIN_CRASHED,
#if !defined(OS_MACOSX)
gfx::VectorIconId::EXTENSION_CRASHED,
#else
gfx::VectorIconId::VECTOR_ICON_NONE,
#endif
l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT,
plugin_name),
true);
......
......@@ -21,6 +21,7 @@
#include "net/cert/cert_database.h"
#include "net/cert/x509_certificate.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/vector_icons_public.h"
using content::BrowserThread;
using content::RenderFrameHost;
......@@ -44,6 +45,7 @@ class SSLAddCertificateInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
Type GetInfoBarType() const override;
int GetIconId() const override;
gfx::VectorIconId GetVectorIconId() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
......@@ -81,6 +83,14 @@ int SSLAddCertificateInfoBarDelegate::GetIconId() const {
return IDR_INFOBAR_SAVE_PASSWORD;
}
gfx::VectorIconId SSLAddCertificateInfoBarDelegate::GetVectorIconId() const {
#if !defined(OS_MACOSX)
return gfx::VectorIconId::AUTOLOGIN;
#else
return gfx::VectorIconId::VECTOR_ICON_NONE;
#endif
}
base::string16 SSLAddCertificateInfoBarDelegate::GetMessageText() const {
// TODO(evanm): GetDisplayName should return UTF-16.
return l10n_util::GetStringFUTF16(IDS_ADD_CERT_SUCCESS_INFOBAR_LABEL,
......@@ -120,12 +130,15 @@ void ShowErrorInfoBar(int message_id,
// TODO(davidben): Use a more appropriate icon.
// TODO(davidben): Display a more user-friendly error string.
SimpleAlertInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents),
IDR_INFOBAR_SAVE_PASSWORD,
l10n_util::GetStringFUTF16(IDS_ADD_CERT_ERR_INVALID_CERT,
base::IntToString16(-cert_error),
base::ASCIIToUTF16(
net::ErrorToString(cert_error))),
InfoBarService::FromWebContents(web_contents), IDR_INFOBAR_SAVE_PASSWORD,
#if !defined(OS_MACOSX)
gfx::VectorIconId::AUTOLOGIN,
#else
gfx::VectorIconId::VECTOR_ICON_NONE,
#endif
l10n_util::GetStringFUTF16(
IDS_ADD_CERT_ERR_INVALID_CERT, base::IntToString16(-cert_error),
base::ASCIIToUTF16(net::ErrorToString(cert_error))),
true);
}
......
......@@ -14,6 +14,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/vector_icons_public.h"
ChromeSelectFilePolicy::ChromeSelectFilePolicy(
content::WebContents* source_contents)
......@@ -32,6 +33,7 @@ void ChromeSelectFilePolicy::SelectFileDenied() {
SimpleAlertInfoBarDelegate::Create(
InfoBarService::FromWebContents(source_contents_),
infobars::InfoBarDelegate::kNoIconID,
gfx::VectorIconId::VECTOR_ICON_NONE,
l10n_util::GetStringUTF16(IDS_FILE_SELECTION_DIALOG_INFOBAR), true);
} else {
LOG(WARNING) << "File-selection dialogs are disabled but no WebContents "
......
......@@ -44,6 +44,7 @@
#import "third_party/ocmock/OCMock/OCMock.h"
#import "ui/base/cocoa/nsview_additions.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/vector_icons_public.h"
namespace {
......@@ -207,7 +208,7 @@ class BrowserWindowControllerTest : public InProcessBrowserTest {
SimpleAlertInfoBarDelegate::Create(
InfoBarService::FromWebContents(
browser->tab_strip_model()->GetActiveWebContents()),
0, base::string16(), false);
0, gfx::VectorIconId::VECTOR_ICON_NONE, base::string16(), false);
}
NSView* GetViewWithID(ViewID view_id) const {
......
......@@ -26,6 +26,7 @@
#include "google_apis/gaia/gaia_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/vector_icons_public.h"
namespace chrome {
......@@ -105,9 +106,10 @@ void ShowBadFlagsPrompt(Browser* browser) {
SimpleAlertInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents),
infobars::InfoBarDelegate::kNoIconID,
l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE,
base::UTF8ToUTF16(
std::string("--") + *flag)),
gfx::VectorIconId::VECTOR_ICON_NONE,
l10n_util::GetStringFUTF16(
IDS_BAD_FLAGS_WARNING_MESSAGE,
base::UTF8ToUTF16(std::string("--") + *flag)),
false);
return;
}
......
......@@ -86,7 +86,7 @@ class InfoBarDelegate {
virtual int GetIconId() const;
// Returns the vector icon identifier to be shown for this InfoBar. This will
// take precedent over GetIconId() (although typically only one of the two
// take precedence over GetIconId() (although typically only one of the two
// should be defined for any given infobar).
virtual gfx::VectorIconId GetVectorIconId() const;
......
......@@ -12,22 +12,24 @@
void SimpleAlertInfoBarDelegate::Create(
infobars::InfoBarManager* infobar_manager,
int icon_id,
gfx::VectorIconId vector_icon_id,
const base::string16& message,
bool auto_expire) {
infobar_manager->AddInfoBar(
infobar_manager->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire))));
infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar(
scoped_ptr<ConfirmInfoBarDelegate>(new SimpleAlertInfoBarDelegate(
icon_id, vector_icon_id, message, auto_expire))));
}
SimpleAlertInfoBarDelegate::SimpleAlertInfoBarDelegate(
int icon_id,
gfx::VectorIconId vector_icon_id,
const base::string16& message,
bool auto_expire)
: ConfirmInfoBarDelegate(),
icon_id_(icon_id),
vector_icon_id_(vector_icon_id),
message_(message),
auto_expire_(auto_expire) {
}
auto_expire_(auto_expire) {}
SimpleAlertInfoBarDelegate::~SimpleAlertInfoBarDelegate() {
}
......@@ -36,6 +38,10 @@ int SimpleAlertInfoBarDelegate::GetIconId() const {
return icon_id_;
}
gfx::VectorIconId SimpleAlertInfoBarDelegate::GetVectorIconId() const {
return vector_icon_id_;
}
bool SimpleAlertInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
......
......@@ -9,6 +9,7 @@
#include "base/compiler_specific.h"
#include "base/strings/string16.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "ui/gfx/vector_icons_public.h"
namespace infobars {
class InfoBarManager;
......@@ -17,25 +18,30 @@ class InfoBarManager;
class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
// Creates a simple alert infobar and delegate and adds the infobar to
// |infobar_manager|. |icon_id| may be kNoIconID if no icon is shown.
// |infobar_manager|. If |vector_icon_id| is not VECTOR_ICON_NONE, it will be
// shown; otherwise, |icon_id| (if present) will be used as the icon.
static void Create(infobars::InfoBarManager* infobar_manager,
int icon_id,
gfx::VectorIconId vector_icon_id,
const base::string16& message,
bool auto_expire);
private:
SimpleAlertInfoBarDelegate(int icon_id,
gfx::VectorIconId vector_icon_id,
const base::string16& message,
bool auto_expire);
~SimpleAlertInfoBarDelegate() override;
// ConfirmInfoBarDelegate:
int GetIconId() const override;
gfx::VectorIconId GetVectorIconId() const override;
bool ShouldExpire(const NavigationDetails& details) const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
const int icon_id_;
gfx::VectorIconId vector_icon_id_;
base::string16 message_;
bool auto_expire_; // Should it expire automatically on navigation?
......
......@@ -424,6 +424,7 @@ action("aggregate_vector_icons") {
"vector_icons/account_child_invert.icon",
"vector_icons/apps.icon",
"vector_icons/autofill.icon",
"vector_icons/autologin.icon",
"vector_icons/bar_close.1x.icon",
"vector_icons/bar_close.icon",
"vector_icons/blocked_badge.icon",
......@@ -433,6 +434,7 @@ action("aggregate_vector_icons") {
"vector_icons/crashed_tab.icon",
"vector_icons/error_circle.icon",
"vector_icons/extension.icon",
"vector_icons/extension_crashed.icon",
"vector_icons/file_download.icon",
"vector_icons/file_download_incognito.1x.icon",
"vector_icons/file_download_incognito.icon",
......@@ -638,7 +640,9 @@ test("gfx_unittests") {
"//ui/resources:ui_test_pak",
]
data_deps = [ "//ui/resources:ui_test_pak" ]
data_deps = [
"//ui/resources:ui_test_pak",
]
if (!is_mac && !is_ios) {
sources += [
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
MOVE_TO, 15.6f, 23,
CUBIC_TO, 13.56f, 23, 12, 20.76f, 12, 18.75f,
LINE_TO, 12, 9.64f,
CUBIC_TO, 12, 7.63f, 13.65f, 6, 15.69f, 6,
LINE_TO, 32.31f, 6,
CUBIC_TO, 34.35f, 6, 36, 7.63f, 36, 9.64f,
LINE_TO, 36, 18.75f,
CUBIC_TO, 36, 20.76f, 34.44f, 23, 32.4f, 23,
LINE_TO, 28, 23,
LINE_TO, 28, 37.11f,
LINE_TO, 25.87f, 42,
LINE_TO, 23.01f, 42,
LINE_TO, 20, 40.78f,
LINE_TO, 20, 23,
LINE_TO, 15.6f, 23,
CLOSE,
MOVE_TO, 24, 25,
LINE_TO, 24, 37,
LINE_TO, 22, 37,
LINE_TO, 22, 25,
LINE_TO, 24, 25,
CLOSE,
MOVE_TO, 18, 9,
LINE_TO, 30, 9,
LINE_TO, 30, 13,
LINE_TO, 18, 13,
LINE_TO, 18, 9,
LINE_TO, 18, 9,
CLOSE,
END
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
MOVE_TO, 37, 23,
LINE_TO, 40, 23,
CUBIC_TO, 42.76f, 23, 45, 25.24f, 45, 28,
CUBIC_TO, 45, 30.76f, 42.76f, 33, 40, 33,
LINE_TO, 37, 33,
LINE_TO, 37, 41,
CUBIC_TO, 37, 43.2f, 35.2f, 45, 33, 45,
LINE_TO, 25.4f, 45,
LINE_TO, 25.4f, 42,
CUBIC_TO, 25.4f, 39.02f, 22.98f, 36.6f, 20, 36.6f,
CUBIC_TO, 17.02f, 36.6f, 14.6f, 39.02f, 14.6f, 42,
LINE_TO, 14.6f, 45,
LINE_TO, 7, 45,
CUBIC_TO, 4.8f, 45, 3, 43.2f, 3, 41,
LINE_TO, 3, 33.4f,
LINE_TO, 6, 33.4f,
CUBIC_TO, 8.98f, 33.4f, 11.4f, 30.98f, 11.4f, 28,
CUBIC_TO, 11.4f, 25.02f, 8.98f, 22.6f, 6, 22.6f,
LINE_TO, 3.02f, 22.6f,
LINE_TO, 3.02f, 15,
CUBIC_TO, 3.02f, 12.8f, 4.8f, 11, 7, 11,
LINE_TO, 15, 11,
LINE_TO, 15, 8,
CUBIC_TO, 15, 5.24f, 17.24f, 3, 20, 3,
CUBIC_TO, 22.76f, 3, 25, 5.24f, 25, 8,
LINE_TO, 25, 11,
LINE_TO, 29.5f, 11,
LINE_TO, 16, 31.5f,
LINE_TO, 37, 17.5f,
LINE_TO, 37, 23,
CLOSE,
END
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