Commit 7fb94820 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Move GetLinkURL()/LinkClicked() to InfoBarDelegate.

Multiple independent subclasses wanted this, so it removes duplication.  It also
moves in the direction of collapsing everything onto one infobar delegate/view,
which I think is the right long-term move.

Most of the CL is reordering the declarations and definitions in subclasses to
match this order.  No intended behavior change.

Bug: none
Change-Id: Iced9e4e8ce17ace87db398a537ead8536b052aab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1983434Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728789}
parent 7880dbfb
......@@ -28,16 +28,16 @@ class GlobalConfirmInfoBar::DelegateProxy : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate overrides
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
gfx::ElideBehavior GetMessageElideBehavior() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
bool Cancel() override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
void InfoBarDismissed() override;
infobars::InfoBar* info_bar_;
base::WeakPtr<GlobalConfirmInfoBar> global_info_bar_;
......@@ -60,6 +60,34 @@ GlobalConfirmInfoBar::DelegateProxy::GetIdentifier() const {
: INVALID;
}
base::string16 GlobalConfirmInfoBar::DelegateProxy::GetLinkText() const {
return global_info_bar_ ? global_info_bar_->delegate_->GetLinkText()
: base::string16();
}
GURL GlobalConfirmInfoBar::DelegateProxy::GetLinkURL() const {
return global_info_bar_ ? global_info_bar_->delegate_->GetLinkURL() : GURL();
}
bool GlobalConfirmInfoBar::DelegateProxy::LinkClicked(
WindowOpenDisposition disposition) {
return global_info_bar_
? global_info_bar_->delegate_->LinkClicked(disposition)
: false;
}
void GlobalConfirmInfoBar::DelegateProxy::InfoBarDismissed() {
base::WeakPtr<GlobalConfirmInfoBar> info_bar = global_info_bar_;
// See comments in GlobalConfirmInfoBar::DelegateProxy::Accept().
if (info_bar) {
info_bar->OnInfoBarRemoved(info_bar_, false);
info_bar->delegate_->InfoBarDismissed();
}
// Could be destroyed after this point.
if (info_bar)
info_bar->Close();
}
base::string16 GlobalConfirmInfoBar::DelegateProxy::GetMessageText() const {
return global_info_bar_ ? global_info_bar_->delegate_->GetMessageText()
: base::string16();
......@@ -113,34 +141,6 @@ bool GlobalConfirmInfoBar::DelegateProxy::Cancel() {
return true;
}
base::string16 GlobalConfirmInfoBar::DelegateProxy::GetLinkText() const {
return global_info_bar_ ? global_info_bar_->delegate_->GetLinkText()
: base::string16();
}
GURL GlobalConfirmInfoBar::DelegateProxy::GetLinkURL() const {
return global_info_bar_ ? global_info_bar_->delegate_->GetLinkURL()
: GURL();
}
bool GlobalConfirmInfoBar::DelegateProxy::LinkClicked(
WindowOpenDisposition disposition) {
return global_info_bar_ ?
global_info_bar_->delegate_->LinkClicked(disposition) : false;
}
void GlobalConfirmInfoBar::DelegateProxy::InfoBarDismissed() {
base::WeakPtr<GlobalConfirmInfoBar> info_bar = global_info_bar_;
// See comments in GlobalConfirmInfoBar::DelegateProxy::Accept().
if (info_bar) {
info_bar->OnInfoBarRemoved(info_bar_, false);
info_bar->delegate_->InfoBarDismissed();
}
// Could be destroyed after this point.
if (info_bar)
info_bar->Close();
}
void GlobalConfirmInfoBar::DelegateProxy::Detach() {
global_info_bar_.reset();
}
......
......@@ -29,14 +29,6 @@ NaClInfoBarDelegate::GetIdentifier() const {
return NACL_INFOBAR_DELEGATE;
}
base::string16 NaClInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_NACL_APP_MISSING_ARCH_MESSAGE);
}
int NaClInfoBarDelegate::GetButtons() const {
return BUTTON_NONE;
}
base::string16 NaClInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
......@@ -44,3 +36,11 @@ base::string16 NaClInfoBarDelegate::GetLinkText() const {
GURL NaClInfoBarDelegate::GetLinkURL() const {
return GURL("https://support.google.com/chrome/?p=ib_nacl");
}
base::string16 NaClInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_NACL_APP_MISSING_ARCH_MESSAGE);
}
int NaClInfoBarDelegate::GetButtons() const {
return BUTTON_NONE;
}
......@@ -20,10 +20,10 @@ class NaClInfoBarDelegate : public ConfirmInfoBarDelegate {
~NaClInfoBarDelegate() override;
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
DISALLOW_COPY_AND_ASSIGN(NaClInfoBarDelegate);
};
......
......@@ -31,25 +31,25 @@ int PasswordManagerInfoBarDelegate::GetIconId() const {
return IDR_ANDROID_INFOBAR_SAVE_PASSWORD;
}
GURL PasswordManagerInfoBarDelegate::GetLinkURL() const {
return GURL(password_manager::kPasswordManagerHelpCenterSmartLock);
}
bool PasswordManagerInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
return !details.is_redirect && ConfirmInfoBarDelegate::ShouldExpire(details);
}
base::string16 PasswordManagerInfoBarDelegate::GetMessageText() const {
return message_;
}
GURL PasswordManagerInfoBarDelegate::GetLinkURL() const {
return GURL(password_manager::kPasswordManagerHelpCenterSmartLock);
}
bool PasswordManagerInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
ConfirmInfoBarDelegate::LinkClicked(disposition);
return true;
}
base::string16 PasswordManagerInfoBarDelegate::GetMessageText() const {
return message_;
}
void PasswordManagerInfoBarDelegate::SetMessage(const base::string16& message) {
message_ = message;
}
......
......@@ -21,10 +21,10 @@ class PasswordManagerInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
InfoBarAutomationType GetInfoBarAutomationType() const override;
int GetIconId() const override;
bool ShouldExpire(const NavigationDetails& details) const override;
base::string16 GetMessageText() const override;
GURL GetLinkURL() const override;
bool ShouldExpire(const NavigationDetails& details) const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
base::string16 GetMessageText() const override;
protected:
PasswordManagerInfoBarDelegate();
......
......@@ -61,6 +61,14 @@ const gfx::VectorIcon& PepperBrokerInfoBarDelegate::GetVectorIcon() const {
return kExtensionIcon;
}
base::string16 PepperBrokerInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL PepperBrokerInfoBarDelegate::GetLinkURL() const {
return GURL("https://support.google.com/chrome/?p=ib_pepper_broker");
}
base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16(
IDS_PEPPER_BROKER_MESSAGE, plugin_name_,
......@@ -83,14 +91,6 @@ bool PepperBrokerInfoBarDelegate::Cancel() {
return true;
}
base::string16 PepperBrokerInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL PepperBrokerInfoBarDelegate::GetLinkURL() const {
return GURL("https://support.google.com/chrome/?p=ib_pepper_broker");
}
void PepperBrokerInfoBarDelegate::DispatchCallback(bool result) {
base::RecordAction(
result ? base::UserMetricsAction("PPAPI.BrokerInfobarClickedAllow")
......
......@@ -40,12 +40,12 @@ class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
base::string16 GetMessageText() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
bool Cancel() override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
void DispatchCallback(bool result);
......
......@@ -77,6 +77,17 @@ int GroupedPermissionInfoBarDelegate::GetIconId() const {
return IDR_ANDROID_INFOBAR_NOTIFICATIONS_OFF;
}
bool GroupedPermissionInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
details_expanded_ = true;
return false;
}
void GroupedPermissionInfoBarDelegate::InfoBarDismissed() {
if (permission_prompt_)
permission_prompt_->Closing();
}
base::string16 GroupedPermissionInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(
IDS_NOTIFICATION_QUIET_PERMISSION_INFOBAR_TITLE);
......@@ -93,17 +104,6 @@ bool GroupedPermissionInfoBarDelegate::Cancel() {
return false;
}
void GroupedPermissionInfoBarDelegate::InfoBarDismissed() {
if (permission_prompt_)
permission_prompt_->Closing();
}
bool GroupedPermissionInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
details_expanded_ = true;
return false;
}
// static
bool GroupedPermissionInfoBarDelegate::ShouldShowMiniInfobar(
content::WebContents* web_contents,
......
......@@ -44,15 +44,13 @@ class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
// Returns the secondary string to show in the infobar in the expanded state.
base::string16 GetDescriptionText() const;
// InfoBarDelegate:
int GetIconId() const override;
// ConfirmInfoBarDelegate:
int GetIconId() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
bool Accept() override;
bool Cancel() override;
void InfoBarDismissed() override;
bool LinkClicked(WindowOpenDisposition disposition) override;
// Returns true if we should show the permission request as a mini-infobar.
static bool ShouldShowMiniInfobar(content::WebContents* web_contents,
......
......@@ -105,6 +105,27 @@ const gfx::VectorIcon& FlashDeprecationInfoBarDelegate::GetVectorIcon() const {
return kExtensionIcon;
}
base::string16 FlashDeprecationInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL FlashDeprecationInfoBarDelegate::GetLinkURL() const {
return GURL(
"https://www.blog.google/products/chrome/saying-goodbye-flash-chrome/");
}
bool FlashDeprecationInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
bool minimum_duration_elapsed = base::Time::Now() - display_start_ >
kMinimumDurationBeforeExpiryOnNavigation;
return minimum_duration_elapsed &&
ConfirmInfoBarDelegate::ShouldExpire(details);
}
void FlashDeprecationInfoBarDelegate::InfoBarDismissed() {
ActivateFlashDeprecationWarningCooldown(profile_);
}
base::string16 FlashDeprecationInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_PLUGIN_FLASH_DEPRECATION_PROMPT);
}
......@@ -130,24 +151,3 @@ bool FlashDeprecationInfoBarDelegate::Accept() {
ContentSettingsType::PLUGINS, CONTENT_SETTING_DEFAULT);
return true;
}
base::string16 FlashDeprecationInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL FlashDeprecationInfoBarDelegate::GetLinkURL() const {
return GURL(
"https://www.blog.google/products/chrome/saying-goodbye-flash-chrome/");
}
void FlashDeprecationInfoBarDelegate::InfoBarDismissed() {
ActivateFlashDeprecationWarningCooldown(profile_);
}
bool FlashDeprecationInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
bool minimum_duration_elapsed = base::Time::Now() - display_start_ >
kMinimumDurationBeforeExpiryOnNavigation;
return minimum_duration_elapsed &&
ConfirmInfoBarDelegate::ShouldExpire(details);
}
......@@ -27,14 +27,14 @@ class FlashDeprecationInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfobarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
bool ShouldExpire(const NavigationDetails& details) const override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
void InfoBarDismissed() override;
bool ShouldExpire(const NavigationDetails& details) const override;
private:
// The profile associated with this infobar.
......
......@@ -102,14 +102,22 @@ OutdatedPluginInfoBarDelegate::GetIdentifier() const {
return OUTDATED_PLUGIN_INFOBAR_DELEGATE;
}
void OutdatedPluginInfoBarDelegate::InfoBarDismissed() {
base::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Dismissed"));
}
const gfx::VectorIcon& OutdatedPluginInfoBarDelegate::GetVectorIcon() const {
return kExtensionIcon;
}
base::string16 OutdatedPluginInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL OutdatedPluginInfoBarDelegate::GetLinkURL() const {
return GURL(chrome::kOutdatedPluginLearnMoreURL);
}
void OutdatedPluginInfoBarDelegate::InfoBarDismissed() {
base::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Dismissed"));
}
base::string16 OutdatedPluginInfoBarDelegate::GetMessageText() const {
return message_;
}
......@@ -155,14 +163,6 @@ bool OutdatedPluginInfoBarDelegate::Cancel() {
return true;
}
base::string16 OutdatedPluginInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL OutdatedPluginInfoBarDelegate::GetLinkURL() const {
return GURL(chrome::kOutdatedPluginLearnMoreURL);
}
void OutdatedPluginInfoBarDelegate::DownloadFinished() {
ReplaceWithInfoBar(l10n_util::GetStringFUTF16(IDS_PLUGIN_UPDATING,
plugin_metadata_->name()));
......
......@@ -40,15 +40,15 @@ class OutdatedPluginInfoBarDelegate : public ConfirmInfoBarDelegate,
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
void InfoBarDismissed() override;
const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
bool Cancel() override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
// PluginInstallerObserver:
void DownloadFinished() override;
......
......@@ -116,6 +116,30 @@ KnownInterceptionDisclosureInfoBarDelegate::
KnownInterceptionDisclosureInfoBarDelegate(Profile* profile)
: profile_(profile) {}
infobars::InfoBarDelegate::InfoBarIdentifier
KnownInterceptionDisclosureInfoBarDelegate::GetIdentifier() const {
return KNOWN_INTERCEPTION_DISCLOSURE_INFOBAR_DELEGATE;
}
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL KnownInterceptionDisclosureInfoBarDelegate::GetLinkURL() const {
return GURL("chrome://connection-monitoring-detected/");
}
bool KnownInterceptionDisclosureInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
return false;
}
void KnownInterceptionDisclosureInfoBarDelegate::InfoBarDismissed() {
KnownInterceptionDisclosureCooldown::GetInstance()
->ActivateKnownInterceptionDisclosureCooldown(profile_);
Cancel();
}
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetMessageText()
const {
return l10n_util::GetStringUTF16(IDS_KNOWN_INTERCEPTION_HEADER);
......@@ -129,9 +153,20 @@ int KnownInterceptionDisclosureInfoBarDelegate::GetButtons() const {
#endif
}
bool KnownInterceptionDisclosureInfoBarDelegate::Accept() {
KnownInterceptionDisclosureCooldown::GetInstance()
->ActivateKnownInterceptionDisclosureCooldown(profile_);
return true;
}
// Platform specific implementations.
#if defined(OS_ANDROID)
int KnownInterceptionDisclosureInfoBarDelegate::GetIconId() const {
return IDR_ANDROID_INFOBAR_WARNING;
}
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
#if defined(OS_ANDROID)
switch (button) {
case BUTTON_OK:
return l10n_util::GetStringUTF16(
......@@ -141,46 +176,10 @@ base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetButtonLabel(
case BUTTON_NONE:
NOTREACHED();
}
#endif
NOTREACHED();
return base::string16();
}
bool KnownInterceptionDisclosureInfoBarDelegate::Accept() {
KnownInterceptionDisclosureCooldown::GetInstance()
->ActivateKnownInterceptionDisclosureCooldown(profile_);
return true;
}
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
GURL KnownInterceptionDisclosureInfoBarDelegate::GetLinkURL() const {
return GURL("chrome://connection-monitoring-detected/");
}
infobars::InfoBarDelegate::InfoBarIdentifier
KnownInterceptionDisclosureInfoBarDelegate::GetIdentifier() const {
return KNOWN_INTERCEPTION_DISCLOSURE_INFOBAR_DELEGATE;
}
void KnownInterceptionDisclosureInfoBarDelegate::InfoBarDismissed() {
KnownInterceptionDisclosureCooldown::GetInstance()
->ActivateKnownInterceptionDisclosureCooldown(profile_);
Cancel();
}
bool KnownInterceptionDisclosureInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
return false;
}
// Platform specific implementations.
#if defined(OS_ANDROID)
int KnownInterceptionDisclosureInfoBarDelegate::GetIconId() const {
return IDR_ANDROID_INFOBAR_WARNING;
}
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetDescriptionText()
const {
return l10n_util::GetStringUTF16(IDS_KNOWN_INTERCEPTION_BODY1);
......
......@@ -72,26 +72,25 @@ class KnownInterceptionDisclosureInfoBarDelegate
~KnownInterceptionDisclosureInfoBarDelegate() override = default;
// ConfirmInfoBarDelegate:
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
// infobars::InfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
void InfoBarDismissed() override;
bool ShouldExpire(const NavigationDetails& details) const override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
bool Accept() override;
#if defined(OS_ANDROID)
int GetIconId() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
// This function is the equivalent of GetMessageText(), but for the portion of
// the infobar below the 'message' title for the Android infobar.
base::string16 GetDescriptionText() const;
#endif
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
#endif
private:
Profile* profile_;
......
......@@ -47,29 +47,6 @@ int AdsBlockedInfobarDelegate::GetIconId() const {
return IDR_ANDROID_INFOBAR_BLOCKED_POPUPS;
}
base::string16 AdsBlockedInfobarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_BLOCKED_ADS_INFOBAR_MESSAGE);
}
int AdsBlockedInfobarDelegate::GetButtons() const {
return BUTTON_OK | BUTTON_CANCEL;
}
base::string16 AdsBlockedInfobarDelegate::GetButtonLabel(
InfoBarButton button) const {
if (button == BUTTON_OK)
return l10n_util::GetStringUTF16(IDS_OK);
return l10n_util::GetStringUTF16(IDS_APP_MENU_RELOAD);
}
bool AdsBlockedInfobarDelegate::Cancel() {
content::WebContents* web_contents =
InfoBarService::WebContentsFromInfoBar(infobar());
ChromeSubresourceFilterClient::FromWebContents(web_contents)
->OnReloadRequested();
return true;
}
GURL AdsBlockedInfobarDelegate::GetLinkURL() const {
DCHECK(infobar_expanded_);
return GURL(subresource_filter::kLearnMoreLink);
......@@ -93,3 +70,26 @@ bool AdsBlockedInfobarDelegate::LinkClicked(WindowOpenDisposition disposition) {
// logic).
return false;
}
base::string16 AdsBlockedInfobarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_BLOCKED_ADS_INFOBAR_MESSAGE);
}
int AdsBlockedInfobarDelegate::GetButtons() const {
return BUTTON_OK | BUTTON_CANCEL;
}
base::string16 AdsBlockedInfobarDelegate::GetButtonLabel(
InfoBarButton button) const {
if (button == BUTTON_OK)
return l10n_util::GetStringUTF16(IDS_OK);
return l10n_util::GetStringUTF16(IDS_APP_MENU_RELOAD);
}
bool AdsBlockedInfobarDelegate::Cancel() {
content::WebContents* web_contents =
InfoBarService::WebContentsFromInfoBar(infobar());
ChromeSubresourceFilterClient::FromWebContents(web_contents)
->OnReloadRequested();
return true;
}
......@@ -30,12 +30,12 @@ class AdsBlockedInfobarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
int GetIconId() const override;
GURL GetLinkURL() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Cancel() override;
GURL GetLinkURL() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
private:
AdsBlockedInfobarDelegate();
......
......@@ -48,5 +48,5 @@ SavePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) {
void SavePasswordInfoBar::OnLinkClicked(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
GetDelegate()->LinkClicked(WindowOpenDisposition::NEW_FOREGROUND_TAB);
delegate()->LinkClicked(WindowOpenDisposition::NEW_FOREGROUND_TAB);
}
......@@ -38,15 +38,15 @@ class SimpleConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
gfx::Image GetIcon() const override;
base::string16 GetLinkText() const override;
bool ShouldExpire(const NavigationDetails& details) const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
bool Cancel() override;
base::string16 GetLinkText() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
private:
base::android::ScopedJavaGlobalRef<jobject> java_listener_;
......@@ -93,11 +93,21 @@ gfx::Image SimpleConfirmInfoBarDelegate::GetIcon() const {
: icon_bitmap_;
}
base::string16 SimpleConfirmInfoBarDelegate::GetLinkText() const {
return link_text_str_;
}
bool SimpleConfirmInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
}
bool SimpleConfirmInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
return !Java_SimpleConfirmInfoBarBuilder_onInfoBarLinkClicked(
base::android::AttachCurrentThread(), java_listener_);
}
void SimpleConfirmInfoBarDelegate::InfoBarDismissed() {
Java_SimpleConfirmInfoBarBuilder_onInfoBarDismissed(
base::android::AttachCurrentThread(), java_listener_);
......@@ -127,16 +137,6 @@ bool SimpleConfirmInfoBarDelegate::Cancel() {
base::android::AttachCurrentThread(), java_listener_, false);
}
base::string16 SimpleConfirmInfoBarDelegate::GetLinkText() const {
return link_text_str_;
}
bool SimpleConfirmInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
return !Java_SimpleConfirmInfoBarBuilder_onInfoBarLinkClicked(
base::android::AttachCurrentThread(), java_listener_);
}
} // anonymous namespace
// Native JNI methods ---------------------------------------------------------
......
......@@ -63,5 +63,5 @@ UpdatePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) {
void UpdatePasswordInfoBar::OnLinkClicked(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
GetDelegate()->LinkClicked(WindowOpenDisposition::NEW_FOREGROUND_TAB);
delegate()->LinkClicked(WindowOpenDisposition::NEW_FOREGROUND_TAB);
}
......@@ -29,14 +29,6 @@ InstallationErrorInfoBarDelegate::GetIdentifier() const {
return INSTALLATION_ERROR_INFOBAR_DELEGATE;
}
base::string16 InstallationErrorInfoBarDelegate::GetMessageText() const {
return error_.message();
}
int InstallationErrorInfoBarDelegate::GetButtons() const {
return BUTTON_OK;
}
base::string16 InstallationErrorInfoBarDelegate::GetLinkText() const {
return error_.type() == extensions::CrxInstallErrorType::OTHER &&
error_.detail() == extensions::CrxInstallErrorDetail::
......@@ -48,3 +40,11 @@ base::string16 InstallationErrorInfoBarDelegate::GetLinkText() const {
GURL InstallationErrorInfoBarDelegate::GetLinkURL() const {
return GURL("https://support.google.com/chrome_webstore/?p=crx_warning");
}
base::string16 InstallationErrorInfoBarDelegate::GetMessageText() const {
return error_.message();
}
int InstallationErrorInfoBarDelegate::GetButtons() const {
return BUTTON_OK;
}
......@@ -26,10 +26,10 @@ class InstallationErrorInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
extensions::CrxInstallError error_;
......
......@@ -37,28 +37,6 @@ void AlternateNavInfoBarDelegate::CreateForOmniboxNavigation(
search_url))));
}
AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate(
Profile* profile,
const base::string16& text,
std::unique_ptr<AutocompleteMatch> match,
const GURL& destination_url,
const GURL& original_url)
: infobars::InfoBarDelegate(),
profile_(profile),
text_(text),
match_(std::move(match)),
destination_url_(destination_url),
original_url_(original_url) {
if (match_)
DCHECK_EQ(destination_url_, match_->destination_url);
DCHECK(destination_url_.is_valid());
DCHECK(original_url_.is_valid());
}
// AlternateNavInfoBarDelegate::CreateInfoBar() is implemented in
// platform-specific files.
base::string16 AlternateNavInfoBarDelegate::GetMessageTextWithOffset(
size_t* link_offset) const {
const base::string16 label = l10n_util::GetStringFUTF16(
......@@ -66,6 +44,15 @@ base::string16 AlternateNavInfoBarDelegate::GetMessageTextWithOffset(
return label;
}
infobars::InfoBarDelegate::InfoBarIdentifier
AlternateNavInfoBarDelegate::GetIdentifier() const {
return ALTERNATE_NAV_INFOBAR_DELEGATE;
}
const gfx::VectorIcon& AlternateNavInfoBarDelegate::GetVectorIcon() const {
return kGlobeIcon;
}
base::string16 AlternateNavInfoBarDelegate::GetLinkText() const {
return base::UTF8ToUTF16(destination_url_.spec());
}
......@@ -105,11 +92,24 @@ bool AlternateNavInfoBarDelegate::LinkClicked(
return true;
}
infobars::InfoBarDelegate::InfoBarIdentifier
AlternateNavInfoBarDelegate::GetIdentifier() const {
return ALTERNATE_NAV_INFOBAR_DELEGATE;
}
AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate(
Profile* profile,
const base::string16& text,
std::unique_ptr<AutocompleteMatch> match,
const GURL& destination_url,
const GURL& original_url)
: infobars::InfoBarDelegate(),
profile_(profile),
text_(text),
match_(std::move(match)),
destination_url_(destination_url),
original_url_(original_url) {
if (match_)
DCHECK_EQ(destination_url_, match_->destination_url);
const gfx::VectorIcon& AlternateNavInfoBarDelegate::GetVectorIcon() const {
return kGlobeIcon;
DCHECK(destination_url_.is_valid());
DCHECK(original_url_.is_valid());
}
// AlternateNavInfoBarDelegate::CreateInfoBar() is implemented in
// platform-specific files.
......@@ -36,9 +36,13 @@ class AlternateNavInfoBarDelegate : public infobars::InfoBarDelegate {
const GURL& search_url);
base::string16 GetMessageTextWithOffset(size_t* link_offset) const;
base::string16 GetLinkText() const;
GURL GetLinkURL() const;
bool LinkClicked(WindowOpenDisposition disposition);
// InfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
private:
AlternateNavInfoBarDelegate(Profile* profile,
......@@ -51,10 +55,6 @@ class AlternateNavInfoBarDelegate : public infobars::InfoBarDelegate {
static std::unique_ptr<infobars::InfoBar> CreateInfoBar(
std::unique_ptr<AlternateNavInfoBarDelegate> delegate);
// InfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
const gfx::VectorIcon& GetVectorIcon() const override;
Profile* profile_;
const base::string16 text_;
......
......@@ -31,14 +31,6 @@ GoogleApiKeysInfoBarDelegate::GetIdentifier() const {
return GOOGLE_API_KEYS_INFOBAR_DELEGATE;
}
base::string16 GoogleApiKeysInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_MISSING_GOOGLE_API_KEYS);
}
int GoogleApiKeysInfoBarDelegate::GetButtons() const {
return BUTTON_NONE;
}
base::string16 GoogleApiKeysInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
......@@ -46,3 +38,11 @@ base::string16 GoogleApiKeysInfoBarDelegate::GetLinkText() const {
GURL GoogleApiKeysInfoBarDelegate::GetLinkURL() const {
return GURL(google_apis::kAPIKeysDevelopersHowToURL);
}
base::string16 GoogleApiKeysInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_MISSING_GOOGLE_API_KEYS);
}
int GoogleApiKeysInfoBarDelegate::GetButtons() const {
return BUTTON_NONE;
}
......@@ -25,10 +25,10 @@ class GoogleApiKeysInfoBarDelegate : public ConfirmInfoBarDelegate {
~GoogleApiKeysInfoBarDelegate() override;
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
DISALLOW_COPY_AND_ASSIGN(GoogleApiKeysInfoBarDelegate);
};
......
......@@ -29,14 +29,6 @@ ObsoleteSystemInfoBarDelegate::GetIdentifier() const {
return OBSOLETE_SYSTEM_INFOBAR_DELEGATE;
}
base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const {
return ObsoleteSystem::LocalizedObsoleteString();
}
int ObsoleteSystemInfoBarDelegate::GetButtons() const {
return BUTTON_NONE;
}
base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
......@@ -44,3 +36,11 @@ base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const {
GURL ObsoleteSystemInfoBarDelegate::GetLinkURL() const {
return GURL(ObsoleteSystem::GetLinkURL());
}
base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const {
return ObsoleteSystem::LocalizedObsoleteString();
}
int ObsoleteSystemInfoBarDelegate::GetButtons() const {
return BUTTON_NONE;
}
......@@ -26,10 +26,10 @@ class ObsoleteSystemInfoBarDelegate : public ConfirmInfoBarDelegate {
~ObsoleteSystemInfoBarDelegate() override;
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetLinkText() const override;
GURL GetLinkURL() const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
DISALLOW_COPY_AND_ASSIGN(ObsoleteSystemInfoBarDelegate);
};
......
......@@ -40,7 +40,7 @@ AlternateNavInfoBarView::AlternateNavInfoBarView(
AddChildView(label_1_);
link_text_ = delegate_ptr->GetLinkText();
link_ = CreateLink(link_text_, this);
link_ = CreateLink(link_text_);
AddChildView(link_);
label_2_text_ = message_text.substr(offset);
......@@ -92,16 +92,6 @@ int AlternateNavInfoBarView::ContentMinimumWidth() const {
return label_1_width ? label_1_width : link_->GetMinimumSize().width();
}
void AlternateNavInfoBarView::LinkClicked(views::Link* source,
int event_flags) {
if (!owner())
return; // We're closing; don't call anything, it might access the owner.
DCHECK(link_ != NULL);
DCHECK_EQ(link_, source);
if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags)))
RemoveSelf();
}
AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() {
return static_cast<AlternateNavInfoBarDelegate*>(delegate());
}
......@@ -9,13 +9,11 @@
#include "base/macros.h"
#include "chrome/browser/ui/views/infobars/infobar_view.h"
#include "ui/views/controls/link_listener.h"
class AlternateNavInfoBarDelegate;
// An infobar that shows a string with an embedded link.
class AlternateNavInfoBarView : public InfoBarView,
public views::LinkListener {
class AlternateNavInfoBarView : public InfoBarView {
public:
explicit AlternateNavInfoBarView(
std::unique_ptr<AlternateNavInfoBarDelegate> delegate);
......@@ -35,9 +33,6 @@ class AlternateNavInfoBarView : public InfoBarView,
void Layout() override;
int ContentMinimumWidth() const override;
// views::LinkListener:
void LinkClicked(views::Link* source, int event_flags) override;
AlternateNavInfoBarDelegate* GetDelegate();
base::string16 label_1_text_;
......
......@@ -54,7 +54,7 @@ ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate)
cancel_button_->SetProminent(true);
}
link_ = CreateLink(delegate_ptr->GetLinkText(), this);
link_ = CreateLink(delegate_ptr->GetLinkText());
AddChildView(link_);
}
......@@ -109,14 +109,6 @@ void ConfirmInfoBar::ButtonPressed(views::Button* sender,
}
}
void ConfirmInfoBar::LinkClicked(views::Link* source, int event_flags) {
if (!owner())
return; // We're closing; don't call anything, it might access the owner.
DCHECK_EQ(link_, source);
if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags)))
RemoveSelf();
}
int ConfirmInfoBar::ContentMinimumWidth() const {
return label_->GetMinimumSize().width() + link_->GetMinimumSize().width() +
NonLabelWidth();
......
......@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "chrome/browser/ui/views/infobars/infobar_view.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "ui/views/controls/link_listener.h"
class ElevationIconSetter;
......@@ -22,8 +21,7 @@ class MdTextButton;
// An infobar that shows a message, up to two optional buttons, and an optional,
// right-aligned link. This is commonly used to do things like:
// "Would you like to do X? [Yes] [No] _Learn More_ [x]"
class ConfirmInfoBar : public InfoBarView,
public views::LinkListener {
class ConfirmInfoBar : public InfoBarView {
public:
explicit ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate);
~ConfirmInfoBar() override;
......@@ -32,9 +30,6 @@ class ConfirmInfoBar : public InfoBarView,
void Layout() override;
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::LinkListener:
void LinkClicked(views::Link* source, int event_flags) override;
protected:
// InfoBarView:
int ContentMinimumWidth() const override;
......
......@@ -259,6 +259,13 @@ void InfoBarView::ButtonPressed(views::Button* sender,
}
}
void InfoBarView::LinkClicked(views::Link* source, int event_flags) {
if (!owner())
return; // We're closing; don't call anything, it might access the owner.
if (delegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags)))
RemoveSelf();
}
void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now);
......@@ -278,11 +285,10 @@ views::Label* InfoBarView::CreateLabel(const base::string16& text) const {
return label;
}
views::Link* InfoBarView::CreateLink(const base::string16& text,
views::LinkListener* listener) const {
views::Link* InfoBarView::CreateLink(const base::string16& text) {
views::Link* link = new views::Link(text, CONTEXT_BODY_TEXT_LARGE);
SetLabelDetails(link);
link->set_listener(listener);
link->set_listener(this);
link->SetProperty(kLabelType, LabelType::kLink);
return link;
}
......
......@@ -11,6 +11,7 @@
#include "components/infobars/core/infobar_container.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/controls/menu/menu_types.h"
#include "ui/views/focus/external_focus_tracker.h"
......@@ -19,13 +20,13 @@ class ImageButton;
class ImageView;
class Label;
class Link;
class LinkListener;
class MenuRunner;
} // namespace views
class InfoBarView : public infobars::InfoBar,
public views::View,
public views::ButtonListener,
public views::LinkListener,
public views::ExternalFocusTracker {
public:
explicit InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate);
......@@ -48,6 +49,9 @@ class InfoBarView : public infobars::InfoBar,
// calls to ButtonPressed() in this case.)
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::LinkListener:
void LinkClicked(views::Link* source, int event_flags) override;
// views::ExternalFocusTracker:
void OnWillChangeFocus(View* focused_before, View* focused_now) override;
......@@ -59,8 +63,7 @@ class InfoBarView : public infobars::InfoBar,
// Creates a link with the appropriate font and color for an infobar.
// NOTE: Subclasses must ignore link clicks if we're unowned.
views::Link* CreateLink(const base::string16& text,
views::LinkListener* listener) const;
views::Link* CreateLink(const base::string16& text);
// Given |views| and the total |available_width| to display them in, sets
// each view's size so that the longest view shrinks until it reaches the
......
......@@ -45,19 +45,6 @@ bool ConfirmInfoBarDelegate::Cancel() {
return true;
}
base::string16 ConfirmInfoBarDelegate::GetLinkText() const {
return base::string16();
}
GURL ConfirmInfoBarDelegate::GetLinkURL() const {
return GURL();
}
bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
infobar()->owner()->OpenURL(GetLinkURL(), disposition);
return false;
}
ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() {}
bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
......
......@@ -10,7 +10,6 @@
#include "components/infobars/core/infobar_delegate.h"
#include "components/infobars/core/infobar_manager.h"
#include "ui/gfx/text_constants.h"
#include "url/gurl.h"
namespace infobars {
class InfoBar;
......@@ -59,23 +58,6 @@ class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate {
// in handling this call something triggers the infobar to begin closing.
virtual bool Cancel();
// Returns the text of the link to be displayed, if any. Otherwise returns
// an empty string.
virtual base::string16 GetLinkText() const;
// Returns the URL of the link to be displayed.
virtual GURL GetLinkURL() const;
// Called when the link (if any) is clicked; if this function returns true,
// the infobar is then immediately closed. The default implementation opens
// the URL returned by GetLinkURL(), above, and returns false. Subclasses MUST
// NOT return true if in handling this call something triggers the infobar to
// begin closing.
//
// The |disposition| specifies how the resulting document should be loaded
// (based on the event flags present when the link was clicked).
virtual bool LinkClicked(WindowOpenDisposition disposition);
protected:
ConfirmInfoBarDelegate();
......
......@@ -54,6 +54,14 @@ gfx::Image InfoBarDelegate::GetIcon() const {
icon_id);
}
base::string16 InfoBarDelegate::GetLinkText() const {
return base::string16();
}
GURL InfoBarDelegate::GetLinkURL() const {
return GURL();
}
bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
return false;
}
......@@ -69,6 +77,11 @@ bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const {
((nav_entry_id_ != details.entry_id) || details.is_reload);
}
bool InfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
infobar()->owner()->OpenURL(GetLinkURL(), disposition);
return false;
}
void InfoBarDelegate::InfoBarDismissed() {
}
......
......@@ -9,6 +9,7 @@
#include "base/strings/string16.h"
#include "build/build_config.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
class ConfirmInfoBarDelegate;
class HungRendererInfoBarDelegate;
......@@ -208,6 +209,13 @@ class InfoBarDelegate {
// resource bundle as its icon.
virtual gfx::Image GetIcon() const;
// Returns the text of the link to be displayed, if any. Otherwise returns
// an empty string.
virtual base::string16 GetLinkText() const;
// Returns the URL the link should navigate to.
virtual GURL GetLinkURL() const;
// Returns true if the supplied |delegate| is equal to this one. Equality is
// left to the implementation to define. This function is called by the
// InfoBarManager when determining whether or not a delegate should be
......@@ -222,6 +230,16 @@ class InfoBarDelegate {
// can override this function.
virtual bool ShouldExpire(const NavigationDetails& details) const;
// Called when the link (if any) is clicked; if this function returns true,
// the infobar is then immediately closed. The default implementation opens
// the URL returned by GetLinkURL(), above, and returns false. Subclasses MUST
// NOT return true if in handling this call something triggers the infobar to
// begin closing.
//
// The |disposition| specifies how the resulting document should be loaded
// (based on the event flags present when the link was clicked).
virtual bool LinkClicked(WindowOpenDisposition disposition);
// Called when the user clicks on the close button to dismiss the infobar.
virtual void InfoBarDismissed();
......
......@@ -60,12 +60,12 @@ class IOSChromeUpdatePasswordInfoBarDelegate
// ConfirmInfoBarDelegate implementation.
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
base::string16 GetLinkText() const override;
void InfoBarDismissed() override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
void InfoBarDismissed() override;
base::string16 GetLinkText() const override;
// The credential that should be displayed in the infobar, and for which the
// password will be updated.
......
......@@ -86,6 +86,15 @@ IOSChromeUpdatePasswordInfoBarDelegate::GetIdentifier() const {
return UPDATE_PASSWORD_INFOBAR_DELEGATE_MOBILE;
}
base::string16 IOSChromeUpdatePasswordInfoBarDelegate::GetLinkText() const {
return ShowMultipleAccounts() ? selected_account_ : base::string16();
}
void IOSChromeUpdatePasswordInfoBarDelegate::InfoBarDismissed() {
DCHECK(form_to_save());
set_infobar_response(password_manager::metrics_util::CLICKED_CANCEL);
}
base::string16 IOSChromeUpdatePasswordInfoBarDelegate::GetMessageText() const {
return selected_account_.length() > 0
? l10n_util::GetStringFUTF16(
......@@ -114,12 +123,3 @@ bool IOSChromeUpdatePasswordInfoBarDelegate::Accept() {
set_infobar_response(password_manager::metrics_util::CLICKED_SAVE);
return true;
}
void IOSChromeUpdatePasswordInfoBarDelegate::InfoBarDismissed() {
DCHECK(form_to_save());
set_infobar_response(password_manager::metrics_util::CLICKED_CANCEL);
}
base::string16 IOSChromeUpdatePasswordInfoBarDelegate::GetLinkText() const {
return ShowMultipleAccounts() ? selected_account_ : base::string16();
}
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