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

Side by Side Diff: chrome/browser/ui/startup/default_browser_prompt.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux 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/ui/startup/default_browser_prompt.h" 5 #include "chrome/browser/ui/startup/default_browser_prompt.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "chrome/installer/util/master_preferences.h" 24 #include "chrome/installer/util/master_preferences.h"
25 #include "chrome/installer/util/master_preferences_constants.h" 25 #include "chrome/installer/util/master_preferences_constants.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/navigation_details.h" 27 #include "content/public/browser/navigation_details.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "grit/chromium_strings.h" 29 #include "grit/chromium_strings.h"
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "grit/theme_resources.h" 31 #include "grit/theme_resources.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h"
34 33
35 using content::BrowserThread; 34 using content::BrowserThread;
36 35
37 namespace { 36 namespace {
38 37
39 // Calls the appropriate function for setting Chrome as the default browser. 38 // Calls the appropriate function for setting Chrome as the default browser.
40 // This requires IO access (registry) and may result in interaction with a 39 // This requires IO access (registry) and may result in interaction with a
41 // modal system UI. 40 // modal system UI.
42 void SetChromeAsDefaultBrowser(bool interactive_flow, PrefService* prefs) { 41 void SetChromeAsDefaultBrowser(bool interactive_flow, PrefService* prefs) {
43 if (interactive_flow) { 42 if (interactive_flow) {
(...skipping 23 matching lines...) Expand all
67 66
68 private: 67 private:
69 DefaultBrowserInfoBarDelegate(InfoBarService* infobar_service, 68 DefaultBrowserInfoBarDelegate(InfoBarService* infobar_service,
70 PrefService* prefs, 69 PrefService* prefs,
71 bool interactive_flow_required); 70 bool interactive_flow_required);
72 virtual ~DefaultBrowserInfoBarDelegate(); 71 virtual ~DefaultBrowserInfoBarDelegate();
73 72
74 void AllowExpiry() { should_expire_ = true; } 73 void AllowExpiry() { should_expire_ = true; }
75 74
76 // ConfirmInfoBarDelegate: 75 // ConfirmInfoBarDelegate:
77 virtual gfx::Image* GetIcon() const OVERRIDE; 76 virtual int GetIconID() const OVERRIDE;
78 virtual string16 GetMessageText() const OVERRIDE; 77 virtual string16 GetMessageText() const OVERRIDE;
79 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 78 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
80 virtual bool NeedElevation(InfoBarButton button) const OVERRIDE; 79 virtual bool NeedElevation(InfoBarButton button) const OVERRIDE;
81 virtual bool Accept() OVERRIDE; 80 virtual bool Accept() OVERRIDE;
82 virtual bool Cancel() OVERRIDE; 81 virtual bool Cancel() OVERRIDE;
83 virtual bool ShouldExpireInternal( 82 virtual bool ShouldExpireInternal(
84 const content::LoadCommittedDetails& details) const OVERRIDE; 83 const content::LoadCommittedDetails& details) const OVERRIDE;
85 84
86 // The prefs to use. 85 // The prefs to use.
87 PrefService* prefs_; 86 PrefService* prefs_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, 127 base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry,
129 weak_factory_.GetWeakPtr()), 128 weak_factory_.GetWeakPtr()),
130 base::TimeDelta::FromSeconds(8)); 129 base::TimeDelta::FromSeconds(8));
131 } 130 }
132 131
133 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { 132 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() {
134 if (!action_taken_) 133 if (!action_taken_)
135 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); 134 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1);
136 } 135 }
137 136
138 gfx::Image* DefaultBrowserInfoBarDelegate::GetIcon() const { 137 int DefaultBrowserInfoBarDelegate::GetIconID() const {
139 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 138 return IDR_PRODUCT_LOGO_32;
140 IDR_PRODUCT_LOGO_32);
141 } 139 }
142 140
143 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { 141 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const {
144 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); 142 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT);
145 } 143 }
146 144
147 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( 145 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel(
148 InfoBarButton button) const { 146 InfoBarButton button) const {
149 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 147 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
150 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL : 148 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL :
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 262
265 } 263 }
266 264
267 #if !defined(OS_WIN) 265 #if !defined(OS_WIN)
268 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { 266 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) {
269 return false; 267 return false;
270 } 268 }
271 #endif 269 #endif
272 270
273 } // namespace chrome 271 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/bad_flags_prompt.cc ('k') | chrome/browser/ui/startup/session_crashed_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698