diff options
author | cmp@chromium.org <cmp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-07 20:42:34 +0000 |
---|---|---|
committer | cmp@chromium.org <cmp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-07 20:42:34 +0000 |
commit | c3753652dcda5056fe98d6b54296302977adac40 (patch) | |
tree | 35b987d86f8ba86a4391122a534d36f2532b2743 /chrome/browser | |
parent | a43c44973af60e8bd003ae1595d333c154d9bf26 (diff) | |
download | chromium_src-c3753652dcda5056fe98d6b54296302977adac40.zip chromium_src-c3753652dcda5056fe98d6b54296302977adac40.tar.gz chromium_src-c3753652dcda5056fe98d6b54296302977adac40.tar.bz2 |
Revert 89864 - Don't rely on user gestures for deciding when to dismiss infobars.
Previously, we looked at the user gesture state when deciding whether to
dismiss infobars. Now that WebKit's user gesture state doesn't lie, we can
tell that this behavior is incorrect. Page-specific infobars, like translate,
should close whenever the main frame navigates to a new page, regardless of
whether that navigation was conducted from a user gesture.
BUG=86417
Review URL: http://codereview.chromium.org/7205026
TBR=abarth@chromium.org
Review URL: http://codereview.chromium.org/7324001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/omnibox_search_hint.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/confirm_infobar_delegate.cc | 8 | ||||
-rw-r--r-- | chrome/browser/tab_contents/confirm_infobar_delegate.h | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/infobar_delegate.cc | 5 | ||||
-rw-r--r-- | chrome/browser/tab_contents/infobar_delegate.h | 4 | ||||
-rw-r--r-- | chrome/browser/translate/translate_infobar_delegate.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser_list.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/keystone_infobar.mm | 2 |
9 files changed, 11 insertions, 19 deletions
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index a5b8918a..2e04a3b 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -102,7 +102,7 @@ HintInfoBar::~HintInfoBar() { bool HintInfoBar::ShouldExpire( const content::LoadCommittedDetails& details) const { - return details.is_navigation_to_different_page() && should_expire_; + return details.is_user_initiated_main_frame_load() && should_expire_; } void HintInfoBar::InfoBarDismissed() { diff --git a/chrome/browser/tab_contents/confirm_infobar_delegate.cc b/chrome/browser/tab_contents/confirm_infobar_delegate.cc index fa35c4d..df5de83 100644 --- a/chrome/browser/tab_contents/confirm_infobar_delegate.cc +++ b/chrome/browser/tab_contents/confirm_infobar_delegate.cc @@ -4,7 +4,6 @@ #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" -#include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -51,13 +50,6 @@ bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { (confirm_delegate->GetMessageText() == GetMessageText()); } -bool ConfirmInfoBarDelegate::ShouldExpire( - const content::LoadCommittedDetails& details) const { - if (details.did_replace_entry) - return false; - return InfoBarDelegate::ShouldExpire(details); -} - ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() { return this; } diff --git a/chrome/browser/tab_contents/confirm_infobar_delegate.h b/chrome/browser/tab_contents/confirm_infobar_delegate.h index 7c5cb4e..4d58c16 100644 --- a/chrome/browser/tab_contents/confirm_infobar_delegate.h +++ b/chrome/browser/tab_contents/confirm_infobar_delegate.h @@ -59,9 +59,6 @@ class ConfirmInfoBarDelegate : public InfoBarDelegate { explicit ConfirmInfoBarDelegate(TabContents* contents); virtual ~ConfirmInfoBarDelegate(); - virtual bool ShouldExpire( - const content::LoadCommittedDetails& details) const OVERRIDE; - private: // InfoBarDelegate: virtual InfoBar* CreateInfoBar(TabContentsWrapper* owner) OVERRIDE; diff --git a/chrome/browser/tab_contents/infobar_delegate.cc b/chrome/browser/tab_contents/infobar_delegate.cc index 9d0c77e..4a7efca 100644 --- a/chrome/browser/tab_contents/infobar_delegate.cc +++ b/chrome/browser/tab_contents/infobar_delegate.cc @@ -21,7 +21,10 @@ bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { bool InfoBarDelegate::ShouldExpire( const content::LoadCommittedDetails& details) const { - if (!details.is_navigation_to_different_page()) + // Only hide InfoBars when the user has done something that makes the main + // frame load. We don't want various automatic or subframe navigations making + // it disappear. + if (!details.is_user_initiated_main_frame_load()) return false; return ShouldExpireInternal(details); diff --git a/chrome/browser/tab_contents/infobar_delegate.h b/chrome/browser/tab_contents/infobar_delegate.h index 7ab8c42..9d66380 100644 --- a/chrome/browser/tab_contents/infobar_delegate.h +++ b/chrome/browser/tab_contents/infobar_delegate.h @@ -57,8 +57,8 @@ class InfoBarDelegate { virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; // Returns true if the InfoBar should be closed automatically after the page - // is navigated. The default behavior is to return true if the - // navigation is to a new page (not including reloads). + // is navigated. The default behavior is to return true if the user initiated + // navigation somewhere else or reloaded. virtual bool ShouldExpire( const content::LoadCommittedDetails& details) const; diff --git a/chrome/browser/translate/translate_infobar_delegate.cc b/chrome/browser/translate/translate_infobar_delegate.cc index 5d1e140..ee69b0f 100644 --- a/chrome/browser/translate/translate_infobar_delegate.cc +++ b/chrome/browser/translate/translate_infobar_delegate.cc @@ -358,7 +358,7 @@ bool TranslateInfoBarDelegate::ShouldExpire( const content::LoadCommittedDetails& 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) + if (!details.is_user_initiated_main_frame_load() && !details.is_main_frame) return false; return InfoBarDelegate::ShouldExpireInternal(details); diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 675ff14..acd7db3 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -187,7 +187,7 @@ DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { bool DefaultBrowserInfoBarDelegate::ShouldExpire( const content::LoadCommittedDetails& details) const { - return details.is_navigation_to_different_page() && should_expire_; + return details.is_user_initiated_main_frame_load() && should_expire_; } gfx::Image* DefaultBrowserInfoBarDelegate::GetIcon() const { diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index d7c9f6a..8a7146a 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -55,7 +55,7 @@ class BrowserActivityObserver : public NotificationObserver { DCHECK(type == NotificationType::NAV_ENTRY_COMMITTED); const content::LoadCommittedDetails& load = *Details<content::LoadCommittedDetails>(details).ptr(); - if (!load.is_navigation_to_different_page()) + if (!load.is_main_frame || load.is_auto || load.is_in_page) return; // Don't log for subframes or other trivial types. LogRenderProcessHostCount(); diff --git a/chrome/browser/ui/cocoa/keystone_infobar.mm b/chrome/browser/ui/cocoa/keystone_infobar.mm index c999411..86935f8 100644 --- a/chrome/browser/ui/cocoa/keystone_infobar.mm +++ b/chrome/browser/ui/cocoa/keystone_infobar.mm @@ -84,7 +84,7 @@ KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { bool KeystonePromotionInfoBarDelegate::ShouldExpire( const content::LoadCommittedDetails& details) const { - return details.is_navigation_to_different_page() && can_expire_; + return details.is_user_initiated_main_frame_load() && can_expire_; } gfx::Image* KeystonePromotionInfoBarDelegate::GetIcon() const { |