summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/autofill/core/browser/autofill_cc_infobar_delegate.cc10
-rw-r--r--components/autofill/core/browser/autofill_cc_infobar_delegate.h2
-rw-r--r--components/infobars/core/confirm_infobar_delegate.cc6
-rw-r--r--components/infobars/core/confirm_infobar_delegate.h2
-rw-r--r--components/infobars/core/infobar.cc1
-rw-r--r--components/infobars/core/infobar.h6
-rw-r--r--components/infobars/core/infobar_delegate.cc18
-rw-r--r--components/infobars/core/infobar_delegate.h12
-rw-r--r--components/infobars/core/simple_alert_infobar_delegate.cc4
-rw-r--r--components/infobars/core/simple_alert_infobar_delegate.h2
-rw-r--r--components/translate/core/browser/translate_infobar_delegate.cc10
-rw-r--r--components/translate/core/browser/translate_infobar_delegate.h1
12 files changed, 14 insertions, 60 deletions
diff --git a/components/autofill/core/browser/autofill_cc_infobar_delegate.cc b/components/autofill/core/browser/autofill_cc_infobar_delegate.cc
index 50cab56..7dc13a7 100644
--- a/components/autofill/core/browser/autofill_cc_infobar_delegate.cc
+++ b/components/autofill/core/browser/autofill_cc_infobar_delegate.cc
@@ -60,11 +60,7 @@ int AutofillCCInfoBarDelegate::GetIconID() const {
return IDR_INFOBAR_AUTOFILL_CC;
}
-void AutofillCCInfoBarDelegate::InfoBarDismissed() {
- LogUserAction(AutofillMetrics::INFOBAR_DENIED);
-}
-
-bool AutofillCCInfoBarDelegate::ShouldExpireInternal(
+bool AutofillCCInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
// The user has submitted a form, causing the page to navigate elsewhere. We
// don't want the infobar to be expired at this point, because the user won't
@@ -72,6 +68,10 @@ bool AutofillCCInfoBarDelegate::ShouldExpireInternal(
return false;
}
+void AutofillCCInfoBarDelegate::InfoBarDismissed() {
+ LogUserAction(AutofillMetrics::INFOBAR_DENIED);
+}
+
base::string16 AutofillCCInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT);
}
diff --git a/components/autofill/core/browser/autofill_cc_infobar_delegate.h b/components/autofill/core/browser/autofill_cc_infobar_delegate.h
index c5a685a..911e8ba 100644
--- a/components/autofill/core/browser/autofill_cc_infobar_delegate.h
+++ b/components/autofill/core/browser/autofill_cc_infobar_delegate.h
@@ -51,8 +51,8 @@ class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
Type GetInfoBarType() const override;
int GetIconID() const override;
+ bool ShouldExpire(const NavigationDetails& details) const override;
void InfoBarDismissed() override;
- bool ShouldExpireInternal(const NavigationDetails& details) const override;
base::string16 GetMessageText() const override;
base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
diff --git a/components/infobars/core/confirm_infobar_delegate.cc b/components/infobars/core/confirm_infobar_delegate.cc
index 9c00449a5..daef8c1 100644
--- a/components/infobars/core/confirm_infobar_delegate.cc
+++ b/components/infobars/core/confirm_infobar_delegate.cc
@@ -53,12 +53,6 @@ ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
: InfoBarDelegate() {
}
-bool ConfirmInfoBarDelegate::ShouldExpireInternal(
- const NavigationDetails& details) const {
- return !details.did_replace_entry &&
- InfoBarDelegate::ShouldExpireInternal(details);
-}
-
bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
ConfirmInfoBarDelegate* confirm_delegate =
delegate->AsConfirmInfoBarDelegate();
diff --git a/components/infobars/core/confirm_infobar_delegate.h b/components/infobars/core/confirm_infobar_delegate.h
index 0f35f8c..d36ea22 100644
--- a/components/infobars/core/confirm_infobar_delegate.h
+++ b/components/infobars/core/confirm_infobar_delegate.h
@@ -68,8 +68,6 @@ class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate {
protected:
ConfirmInfoBarDelegate();
- bool ShouldExpireInternal(const NavigationDetails& details) const override;
-
private:
// InfoBarDelegate:
bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override;
diff --git a/components/infobars/core/infobar.cc b/components/infobars/core/infobar.cc
index 6e7aca7..91c9273 100644
--- a/components/infobars/core/infobar.cc
+++ b/components/infobars/core/infobar.cc
@@ -56,7 +56,6 @@ SkColor InfoBar::GetBottomColor(InfoBarDelegate::Type infobar_type) {
void InfoBar::SetOwner(InfoBarManager* owner) {
DCHECK(!owner_);
owner_ = owner;
- delegate_->StoreActiveEntryUniqueID();
PlatformSpecificSetOwner();
}
diff --git a/components/infobars/core/infobar.h b/components/infobars/core/infobar.h
index ebced9f..28a1543 100644
--- a/components/infobars/core/infobar.h
+++ b/components/infobars/core/infobar.h
@@ -50,9 +50,9 @@ class InfoBar : public gfx::AnimationDelegate {
InfoBarDelegate* delegate() const { return delegate_.get(); }
void set_container(InfoBarContainer* container) { container_ = container; }
- // Sets |owner_|. This also calls StoreActiveEntryUniqueID() on |delegate_|.
- // This must only be called once as there's no way to extract an infobar from
- // its owner without deleting it, for reparenting in another tab.
+ // Sets |owner_|. This must only be called once as there's no way to extract
+ // an infobar from its owner without deleting it, for reparenting in another
+ // tab.
void SetOwner(InfoBarManager* owner);
// Makes the infobar visible. If |animate| is true, the infobar is then
diff --git a/components/infobars/core/infobar_delegate.cc b/components/infobars/core/infobar_delegate.cc
index 84cd0e1..37fbdf7 100644
--- a/components/infobars/core/infobar_delegate.cc
+++ b/components/infobars/core/infobar_delegate.cc
@@ -41,10 +41,7 @@ bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
}
bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const {
- if (!details.is_navigation_to_different_page)
- return false;
-
- return ShouldExpireInternal(details);
+ return details.is_navigation_to_different_page && !details.did_replace_entry;
}
void InfoBarDelegate::InfoBarDismissed() {
@@ -99,18 +96,7 @@ InfoBarDelegate::AsTranslateInfoBarDelegate() {
return nullptr;
}
-void InfoBarDelegate::StoreActiveEntryUniqueID() {
- contents_unique_id_ = infobar()->owner()->GetActiveEntryID();
-}
-
-InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) {
-}
-
-bool InfoBarDelegate::ShouldExpireInternal(
- const NavigationDetails& details) const {
- // NOTE: If you change this, be sure to check and adjust the behavior of
- // anyone who overrides this as necessary!
- return (contents_unique_id_ != details.entry_id) || details.is_reload;
+InfoBarDelegate::InfoBarDelegate() {
}
} // namespace infobars
diff --git a/components/infobars/core/infobar_delegate.h b/components/infobars/core/infobar_delegate.h
index bd7455f..5d5ff37 100644
--- a/components/infobars/core/infobar_delegate.h
+++ b/components/infobars/core/infobar_delegate.h
@@ -127,24 +127,12 @@ class InfoBarDelegate {
void set_infobar(InfoBar* infobar) { infobar_ = infobar; }
- // Store the unique id for the active entry, to be used later upon navigation
- // to determine if this InfoBarDelegate should be expired.
- void StoreActiveEntryUniqueID();
-
protected:
InfoBarDelegate();
- // Returns true if the navigation is to a new URL or a reload occured.
- virtual bool ShouldExpireInternal(const NavigationDetails& details) const;
-
- int contents_unique_id() const { return contents_unique_id_; }
InfoBar* infobar() { return infobar_; }
private:
- // The unique id of the active NavigationEntry of the WebContents that we were
- // opened for. Used to help expire on navigations.
- int contents_unique_id_;
-
// The InfoBar associated with us.
InfoBar* infobar_;
diff --git a/components/infobars/core/simple_alert_infobar_delegate.cc b/components/infobars/core/simple_alert_infobar_delegate.cc
index fa0188e..56fbfce 100644
--- a/components/infobars/core/simple_alert_infobar_delegate.cc
+++ b/components/infobars/core/simple_alert_infobar_delegate.cc
@@ -36,9 +36,9 @@ int SimpleAlertInfoBarDelegate::GetIconID() const {
return icon_id_;
}
-bool SimpleAlertInfoBarDelegate::ShouldExpireInternal(
+bool SimpleAlertInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
- return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpireInternal(details);
+ return auto_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
}
base::string16 SimpleAlertInfoBarDelegate::GetMessageText() const {
diff --git a/components/infobars/core/simple_alert_infobar_delegate.h b/components/infobars/core/simple_alert_infobar_delegate.h
index 64dc03a..671bc15 100644
--- a/components/infobars/core/simple_alert_infobar_delegate.h
+++ b/components/infobars/core/simple_alert_infobar_delegate.h
@@ -31,7 +31,7 @@ class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate:
int GetIconID() const override;
- bool ShouldExpireInternal(const NavigationDetails& details) const override;
+ bool ShouldExpire(const NavigationDetails& details) const override;
base::string16 GetMessageText() const override;
int GetButtons() const override;
diff --git a/components/translate/core/browser/translate_infobar_delegate.cc b/components/translate/core/browser/translate_infobar_delegate.cc
index 9552463..8006c06f 100644
--- a/components/translate/core/browser/translate_infobar_delegate.cc
+++ b/components/translate/core/browser/translate_infobar_delegate.cc
@@ -359,16 +359,6 @@ int TranslateInfoBarDelegate::GetIconID() const {
return translate_manager_->translate_client()->GetInfobarIconID();
}
-bool TranslateInfoBarDelegate::ShouldExpire(
- const NavigationDetails& details) const {
- // Note: we allow closing this infobar even if the main frame navigation
- // was programmatic and not initiated by the user - crbug.com/70261 .
- if (!details.is_navigation_to_different_page && !details.is_main_frame)
- return false;
-
- return infobars::InfoBarDelegate::ShouldExpireInternal(details);
-}
-
void TranslateInfoBarDelegate::InfoBarDismissed() {
if (step_ != translate::TRANSLATE_STEP_BEFORE_TRANSLATE)
return;
diff --git a/components/translate/core/browser/translate_infobar_delegate.h b/components/translate/core/browser/translate_infobar_delegate.h
index dca1979..ec3ae32 100644
--- a/components/translate/core/browser/translate_infobar_delegate.h
+++ b/components/translate/core/browser/translate_infobar_delegate.h
@@ -199,7 +199,6 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
// InfoBarDelegate:
Type GetInfoBarType() const override;
int GetIconID() const override;
- bool ShouldExpire(const NavigationDetails& details) const override;
void InfoBarDismissed() override;
TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() override;