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

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

Issue 7205026: 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, 6 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 // Only hide InfoBars when the user has done something that makes the main 24 if (!details.is_navigation_to_different_page())
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())
28 return false; 25 return false;
29 26
30 return ShouldExpireInternal(details); 27 return ShouldExpireInternal(details);
31 } 28 }
32 29
33 bool InfoBarDelegate::ShouldExpireInternal( 30 bool InfoBarDelegate::ShouldExpireInternal(
34 const content::LoadCommittedDetails& details) const { 31 const content::LoadCommittedDetails& details) const {
35 return (contents_unique_id_ != details.entry->unique_id()) || 32 return (contents_unique_id_ != details.entry->unique_id()) ||
36 (PageTransition::StripQualifier(details.entry->transition_type()) == 33 (PageTransition::StripQualifier(details.entry->transition_type()) ==
37 PageTransition::RELOAD); 34 PageTransition::RELOAD);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 InfoBarDelegate::InfoBarDelegate(TabContents* contents) 82 InfoBarDelegate::InfoBarDelegate(TabContents* contents)
86 : contents_unique_id_(0) { 83 : contents_unique_id_(0) {
87 if (contents) 84 if (contents)
88 StoreActiveEntryUniqueID(contents); 85 StoreActiveEntryUniqueID(contents);
89 } 86 }
90 87
91 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) { 88 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) {
92 NavigationEntry* active_entry = contents->controller().GetActiveEntry(); 89 NavigationEntry* active_entry = contents->controller().GetActiveEntry();
93 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0; 90 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0;
94 } 91 }
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