Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/tab_contents/infobar_delegate.cc

Issue 7324001: Revert 89864 - Don't rely on user gestures for deciding when to dismiss infobars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/tab_contents/infobar_delegate.h" 5 #include "chrome/browser/tab_contents/infobar_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/tab_contents/navigation_details.h" 9 #include "content/browser/tab_contents/navigation_details.h"
10 #include "content/browser/tab_contents/navigation_entry.h" 10 #include "content/browser/tab_contents/navigation_entry.h"
11 #include "content/browser/tab_contents/tab_contents.h" 11 #include "content/browser/tab_contents/tab_contents.h"
12 12
13 // InfoBarDelegate ------------------------------------------------------------ 13 // InfoBarDelegate ------------------------------------------------------------
14 14
15 InfoBarDelegate::~InfoBarDelegate() { 15 InfoBarDelegate::~InfoBarDelegate() {
16 } 16 }
17 17
18 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { 18 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
19 return false; 19 return false;
20 } 20 }
21 21
22 bool InfoBarDelegate::ShouldExpire( 22 bool InfoBarDelegate::ShouldExpire(
23 const content::LoadCommittedDetails& details) const { 23 const content::LoadCommittedDetails& details) const {
24 if (!details.is_navigation_to_different_page()) 24 // Only hide InfoBars when the user has done something that makes the main
25 // frame load. We don't want various automatic or subframe navigations making
26 // it disappear.
27 if (!details.is_user_initiated_main_frame_load())
25 return false; 28 return false;
26 29
27 return ShouldExpireInternal(details); 30 return ShouldExpireInternal(details);
28 } 31 }
29 32
30 bool InfoBarDelegate::ShouldExpireInternal( 33 bool InfoBarDelegate::ShouldExpireInternal(
31 const content::LoadCommittedDetails& details) const { 34 const content::LoadCommittedDetails& details) const {
32 return (contents_unique_id_ != details.entry->unique_id()) || 35 return (contents_unique_id_ != details.entry->unique_id()) ||
33 (PageTransition::StripQualifier(details.entry->transition_type()) == 36 (PageTransition::StripQualifier(details.entry->transition_type()) ==
34 PageTransition::RELOAD); 37 PageTransition::RELOAD);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 InfoBarDelegate::InfoBarDelegate(TabContents* contents) 86 InfoBarDelegate::InfoBarDelegate(TabContents* contents)
84 : contents_unique_id_(0) { 87 : contents_unique_id_(0) {
85 if (contents) 88 if (contents)
86 StoreActiveEntryUniqueID(contents); 89 StoreActiveEntryUniqueID(contents);
87 } 90 }
88 91
89 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) { 92 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) {
90 NavigationEntry* active_entry = contents->controller().GetActiveEntry(); 93 NavigationEntry* active_entry = contents->controller().GetActiveEntry();
91 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0; 94 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0;
92 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/infobar_delegate.h ('k') | chrome/browser/translate/translate_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698