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

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

Issue 6883299: Hide translate infobar on programmatic navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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_controller.h" 9 #include "content/browser/tab_contents/navigation_controller.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 NavigationController::LoadCommittedDetails& details) const { 23 const NavigationController::LoadCommittedDetails& details) const {
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())
MAD 2011/05/02 19:18:02 Why not do this as part of another method, that on
28 return false;
29
24 return (contents_unique_id_ != details.entry->unique_id()) || 30 return (contents_unique_id_ != details.entry->unique_id()) ||
25 (PageTransition::StripQualifier(details.entry->transition_type()) == 31 (PageTransition::StripQualifier(details.entry->transition_type()) ==
26 PageTransition::RELOAD); 32 PageTransition::RELOAD);
27 } 33 }
28 34
29 void InfoBarDelegate::InfoBarDismissed() { 35 void InfoBarDelegate::InfoBarDismissed() {
30 } 36 }
31 37
32 void InfoBarDelegate::InfoBarClosed() { 38 void InfoBarDelegate::InfoBarClosed() {
33 } 39 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 InfoBarDelegate::InfoBarDelegate(TabContents* contents) 75 InfoBarDelegate::InfoBarDelegate(TabContents* contents)
70 : contents_unique_id_(0) { 76 : contents_unique_id_(0) {
71 if (contents) 77 if (contents)
72 StoreActiveEntryUniqueID(contents); 78 StoreActiveEntryUniqueID(contents);
73 } 79 }
74 80
75 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) { 81 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) {
76 NavigationEntry* active_entry = contents->controller().GetActiveEntry(); 82 NavigationEntry* active_entry = contents->controller().GetActiveEntry();
77 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0; 83 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0;
78 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698