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

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

Issue 1377553002: Update default browser infobar for MD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change to normal type Created 5 years, 2 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
« no previous file with comments | « no previous file | components/infobars/core/infobar_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "chrome/grit/chromium_strings.h" 26 #include "chrome/grit/chromium_strings.h"
27 #include "chrome/grit/generated_resources.h" 27 #include "chrome/grit/generated_resources.h"
28 #include "components/infobars/core/confirm_infobar_delegate.h" 28 #include "components/infobars/core/confirm_infobar_delegate.h"
29 #include "components/infobars/core/infobar.h" 29 #include "components/infobars/core/infobar.h"
30 #include "components/version_info/version_info.h" 30 #include "components/version_info/version_info.h"
31 #include "content/public/browser/navigation_details.h" 31 #include "content/public/browser/navigation_details.h"
32 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
33 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 35 #include "ui/gfx/vector_icons_public.h"
36 36
37 namespace { 37 namespace {
38 38
39 // A ShellIntegration::DefaultWebClientObserver that records user metrics for 39 // A ShellIntegration::DefaultWebClientObserver that records user metrics for
40 // the result of making Chrome the default browser. 40 // the result of making Chrome the default browser.
41 class SetDefaultBrowserObserver 41 class SetDefaultBrowserObserver
42 : public ShellIntegration::DefaultWebClientObserver { 42 : public ShellIntegration::DefaultWebClientObserver {
43 public: 43 public:
44 SetDefaultBrowserObserver(); 44 SetDefaultBrowserObserver();
45 ~SetDefaultBrowserObserver() override; 45 ~SetDefaultBrowserObserver() override;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // |infobar_service|. 108 // |infobar_service|.
109 static void Create(InfoBarService* infobar_service, PrefService* prefs); 109 static void Create(InfoBarService* infobar_service, PrefService* prefs);
110 110
111 private: 111 private:
112 explicit DefaultBrowserInfoBarDelegate(PrefService* prefs); 112 explicit DefaultBrowserInfoBarDelegate(PrefService* prefs);
113 ~DefaultBrowserInfoBarDelegate() override; 113 ~DefaultBrowserInfoBarDelegate() override;
114 114
115 void AllowExpiry() { should_expire_ = true; } 115 void AllowExpiry() { should_expire_ = true; }
116 116
117 // ConfirmInfoBarDelegate: 117 // ConfirmInfoBarDelegate:
118 Type GetInfoBarType() const override;
118 int GetIconId() const override; 119 int GetIconId() const override;
120 gfx::VectorIconId GetVectorIconId() const override;
119 bool ShouldExpire(const NavigationDetails& details) const override; 121 bool ShouldExpire(const NavigationDetails& details) const override;
120 base::string16 GetMessageText() const override; 122 base::string16 GetMessageText() const override;
121 base::string16 GetButtonLabel(InfoBarButton button) const override; 123 base::string16 GetButtonLabel(InfoBarButton button) const override;
122 bool OKButtonTriggersUACPrompt() const override; 124 bool OKButtonTriggersUACPrompt() const override;
123 bool Accept() override; 125 bool Accept() override;
124 bool Cancel() override; 126 bool Cancel() override;
125 127
126 // The prefs to use. 128 // The prefs to use.
127 PrefService* prefs_; 129 PrefService* prefs_;
128 130
(...skipping 29 matching lines...) Expand all
158 FROM_HERE, base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, 160 FROM_HERE, base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry,
159 weak_factory_.GetWeakPtr()), 161 weak_factory_.GetWeakPtr()),
160 base::TimeDelta::FromSeconds(8)); 162 base::TimeDelta::FromSeconds(8));
161 } 163 }
162 164
163 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { 165 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() {
164 if (!action_taken_) 166 if (!action_taken_)
165 UMA_HISTOGRAM_BOOLEAN("DefaultBrowserWarning.Ignored", true); 167 UMA_HISTOGRAM_BOOLEAN("DefaultBrowserWarning.Ignored", true);
166 } 168 }
167 169
170 infobars::InfoBarDelegate::Type DefaultBrowserInfoBarDelegate::GetInfoBarType()
171 const {
172 return PAGE_ACTION_TYPE;
173 }
174
168 int DefaultBrowserInfoBarDelegate::GetIconId() const { 175 int DefaultBrowserInfoBarDelegate::GetIconId() const {
169 return IDR_PRODUCT_LOGO_32; 176 return IDR_PRODUCT_LOGO_32;
170 } 177 }
171 178
179 gfx::VectorIconId DefaultBrowserInfoBarDelegate::GetVectorIconId() const {
180 #if defined(OS_MACOSX) || defined(OS_ANDROID) || defined(OS_IOS)
181 return gfx::VectorIconId::VECTOR_ICON_NONE;
182 #else
183 return gfx::VectorIconId::CHROME_PRODUCT;
184 #endif
185 }
186
172 bool DefaultBrowserInfoBarDelegate::ShouldExpire( 187 bool DefaultBrowserInfoBarDelegate::ShouldExpire(
173 const NavigationDetails& details) const { 188 const NavigationDetails& details) const {
174 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); 189 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
175 } 190 }
176 191
177 base::string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { 192 base::string16 DefaultBrowserInfoBarDelegate::GetMessageText() const {
178 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); 193 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT);
179 } 194 }
180 195
181 base::string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( 196 base::string16 DefaultBrowserInfoBarDelegate::GetButtonLabel(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 ->StartCheckIsDefault(); 350 ->StartCheckIsDefault();
336 } 351 }
337 352
338 #if !defined(OS_WIN) 353 #if !defined(OS_WIN)
339 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { 354 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) {
340 return false; 355 return false;
341 } 356 }
342 #endif 357 #endif
343 358
344 } // namespace chrome 359 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | components/infobars/core/infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698