diff options
Diffstat (limited to 'components/infobars')
-rw-r--r-- | components/infobars/core/confirm_infobar_delegate.cc | 6 | ||||
-rw-r--r-- | components/infobars/core/confirm_infobar_delegate.h | 2 | ||||
-rw-r--r-- | components/infobars/core/infobar.cc | 1 | ||||
-rw-r--r-- | components/infobars/core/infobar.h | 6 | ||||
-rw-r--r-- | components/infobars/core/infobar_delegate.cc | 18 | ||||
-rw-r--r-- | components/infobars/core/infobar_delegate.h | 12 | ||||
-rw-r--r-- | components/infobars/core/simple_alert_infobar_delegate.cc | 4 | ||||
-rw-r--r-- | components/infobars/core/simple_alert_infobar_delegate.h | 2 |
8 files changed, 8 insertions, 43 deletions
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; |