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

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

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused includes Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/infobars/infobar_delegate.h" 5 #include "chrome/browser/infobars/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 "chrome/browser/infobars/infobar_service.h" 9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
11 #include "content/public/browser/navigation_details.h" 11 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ui/base/resource/resource_bundle.h"
14 15
15 using content::NavigationEntry; 16 using content::NavigationEntry;
16 17
17 // InfoBarDelegate ------------------------------------------------------------ 18 // InfoBarDelegate ------------------------------------------------------------
18 19
19 InfoBarDelegate::~InfoBarDelegate() { 20 InfoBarDelegate::~InfoBarDelegate() {
20 } 21 }
21 22
22 InfoBarDelegate::InfoBarAutomationType 23 InfoBarDelegate::InfoBarAutomationType
23 InfoBarDelegate::GetInfoBarAutomationType() const { 24 InfoBarDelegate::GetInfoBarAutomationType() const {
24 return UNKNOWN_INFOBAR; 25 return UNKNOWN_INFOBAR;
25 } 26 }
26 27
27 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { 28 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
28 return false; 29 return false;
29 } 30 }
30 31
31 bool InfoBarDelegate::ShouldExpire( 32 bool InfoBarDelegate::ShouldExpire(
32 const content::LoadCommittedDetails& details) const { 33 const content::LoadCommittedDetails& details) const {
33 if (!details.is_navigation_to_different_page()) 34 if (!details.is_navigation_to_different_page())
34 return false; 35 return false;
35 36
36 return ShouldExpireInternal(details); 37 return ShouldExpireInternal(details);
37 } 38 }
38 39
39 void InfoBarDelegate::InfoBarDismissed() { 40 void InfoBarDelegate::InfoBarDismissed() {
40 } 41 }
41 42
43 int InfoBarDelegate::GetIconID() const {
44 return -1;
45 }
46
42 gfx::Image* InfoBarDelegate::GetIcon() const { 47 gfx::Image* InfoBarDelegate::GetIcon() const {
43 return NULL; 48 if (GetIconID() == -1) {
49 return NULL;
50 } else {
Peter Kasting 2013/05/14 00:50:50 Nit: No else after return. Do this: int icon_i
gone 2013/05/14 17:50:17 Done.
51 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
52 GetIconID());
53 }
44 } 54 }
45 55
46 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { 56 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const {
47 return WARNING_TYPE; 57 return WARNING_TYPE;
48 } 58 }
49 59
50 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() { 60 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() {
51 return NULL; 61 return NULL;
52 } 62 }
53 63
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return (contents_unique_id_ != details.entry->GetUniqueID()) || 122 return (contents_unique_id_ != details.entry->GetUniqueID()) ||
113 (content::PageTransitionStripQualifier( 123 (content::PageTransitionStripQualifier(
114 details.entry->GetTransitionType()) == 124 details.entry->GetTransitionType()) ==
115 content::PAGE_TRANSITION_RELOAD); 125 content::PAGE_TRANSITION_RELOAD);
116 } 126 }
117 127
118 void InfoBarDelegate::RemoveSelf() { 128 void InfoBarDelegate::RemoveSelf() {
119 if (owner_) 129 if (owner_)
120 owner_->RemoveInfoBar(this); // Clears |owner_|. 130 owner_->RemoveInfoBar(this); // Clears |owner_|.
121 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698