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

Side by Side Diff: chrome/browser/omnibox_search_hint.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming back to GetIcon() 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/omnibox_search_hint.h" 5 #include "chrome/browser/omnibox_search_hint.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 private: 56 private:
57 HintInfoBarDelegate(OmniboxSearchHint* omnibox_hint, 57 HintInfoBarDelegate(OmniboxSearchHint* omnibox_hint,
58 InfoBarService* infobar_service); 58 InfoBarService* infobar_service);
59 virtual ~HintInfoBarDelegate(); 59 virtual ~HintInfoBarDelegate();
60 60
61 void AllowExpiry() { should_expire_ = true; } 61 void AllowExpiry() { should_expire_ = true; }
62 62
63 // ConfirmInfoBarDelegate: 63 // ConfirmInfoBarDelegate:
64 virtual void InfoBarDismissed() OVERRIDE; 64 virtual void InfoBarDismissed() OVERRIDE;
65 virtual gfx::Image* GetIcon() const OVERRIDE; 65 virtual int GetIconID() const OVERRIDE;
66 virtual Type GetInfoBarType() const OVERRIDE; 66 virtual Type GetInfoBarType() const OVERRIDE;
67 virtual string16 GetMessageText() const OVERRIDE; 67 virtual string16 GetMessageText() const OVERRIDE;
68 virtual int GetButtons() const OVERRIDE; 68 virtual int GetButtons() const OVERRIDE;
69 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 69 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
70 virtual bool Accept() OVERRIDE; 70 virtual bool Accept() OVERRIDE;
71 virtual bool ShouldExpireInternal( 71 virtual bool ShouldExpireInternal(
72 const content::LoadCommittedDetails& details) const OVERRIDE; 72 const content::LoadCommittedDetails& details) const OVERRIDE;
73 73
74 // The omnibox hint that shows us. 74 // The omnibox hint that shows us.
75 OmniboxSearchHint* omnibox_hint_; 75 OmniboxSearchHint* omnibox_hint_;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.Ignored", 1); 148 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.Ignored", 1);
149 } 149 }
150 150
151 void HintInfoBarDelegate::InfoBarDismissed() { 151 void HintInfoBarDelegate::InfoBarDismissed() {
152 action_taken_ = true; 152 action_taken_ = true;
153 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.Closed", 1); 153 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.Closed", 1);
154 // User closed the infobar, let's not bug him again with this in the future. 154 // User closed the infobar, let's not bug him again with this in the future.
155 omnibox_hint_->DisableHint(); 155 omnibox_hint_->DisableHint();
156 } 156 }
157 157
158 gfx::Image* HintInfoBarDelegate::GetIcon() const { 158 int HintInfoBarDelegate::GetIconID() const {
159 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 159 return IDR_INFOBAR_QUESTION_MARK;
160 IDR_INFOBAR_QUESTION_MARK);
161 } 160 }
162 161
163 InfoBarDelegate::Type HintInfoBarDelegate::GetInfoBarType() const { 162 InfoBarDelegate::Type HintInfoBarDelegate::GetInfoBarType() const {
164 return PAGE_ACTION_TYPE; 163 return PAGE_ACTION_TYPE;
165 } 164 }
166 165
167 string16 HintInfoBarDelegate::GetMessageText() const { 166 string16 HintInfoBarDelegate::GetMessageText() const {
168 return l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_TEXT); 167 return l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_TEXT);
169 } 168 }
170 169
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 255 }
257 256
258 // static 257 // static
259 bool OmniboxSearchHint::IsEnabled(Profile* profile) { 258 bool OmniboxSearchHint::IsEnabled(Profile* profile) {
260 // The infobar can only be shown if the correct switch has been provided and 259 // The infobar can only be shown if the correct switch has been provided and
261 // the user did not dismiss the infobar before. 260 // the user did not dismiss the infobar before.
262 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && 261 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) &&
263 CommandLine::ForCurrentProcess()->HasSwitch( 262 CommandLine::ForCurrentProcess()->HasSwitch(
264 switches::kSearchInOmniboxHint); 263 switches::kSearchInOmniboxHint);
265 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698