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

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

Issue 1142153002: Simplify infobar expiry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android compile Created 5 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/message_loop.h" 8 #include "base/message_loop/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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 private: 68 private:
69 DefaultBrowserInfoBarDelegate(PrefService* prefs, 69 DefaultBrowserInfoBarDelegate(PrefService* prefs,
70 bool interactive_flow_required); 70 bool interactive_flow_required);
71 ~DefaultBrowserInfoBarDelegate() override; 71 ~DefaultBrowserInfoBarDelegate() override;
72 72
73 void AllowExpiry() { should_expire_ = true; } 73 void AllowExpiry() { should_expire_ = true; }
74 74
75 // ConfirmInfoBarDelegate: 75 // ConfirmInfoBarDelegate:
76 int GetIconID() const override; 76 int GetIconID() const override;
77 bool ShouldExpireInternal(const NavigationDetails& details) const override; 77 bool ShouldExpire(const NavigationDetails& details) const override;
78 base::string16 GetMessageText() const override; 78 base::string16 GetMessageText() const override;
79 base::string16 GetButtonLabel(InfoBarButton button) const override; 79 base::string16 GetButtonLabel(InfoBarButton button) const override;
80 bool OKButtonTriggersUACPrompt() const override; 80 bool OKButtonTriggersUACPrompt() const override;
81 bool Accept() override; 81 bool Accept() override;
82 bool Cancel() override; 82 bool Cancel() override;
83 83
84 // The prefs to use. 84 // The prefs to use.
85 PrefService* prefs_; 85 PrefService* prefs_;
86 86
87 // Whether the user clicked one of the buttons. 87 // Whether the user clicked one of the buttons.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { 130 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() {
131 if (!action_taken_) 131 if (!action_taken_)
132 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); 132 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1);
133 } 133 }
134 134
135 int DefaultBrowserInfoBarDelegate::GetIconID() const { 135 int DefaultBrowserInfoBarDelegate::GetIconID() const {
136 return IDR_PRODUCT_LOGO_32; 136 return IDR_PRODUCT_LOGO_32;
137 } 137 }
138 138
139 bool DefaultBrowserInfoBarDelegate::ShouldExpireInternal( 139 bool DefaultBrowserInfoBarDelegate::ShouldExpire(
140 const NavigationDetails& details) const { 140 const NavigationDetails& details) const {
141 return should_expire_; 141 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
142 } 142 }
143 143
144 base::string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { 144 base::string16 DefaultBrowserInfoBarDelegate::GetMessageText() const {
145 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); 145 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT);
146 } 146 }
147 147
148 base::string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( 148 base::string16 DefaultBrowserInfoBarDelegate::GetButtonLabel(
149 InfoBarButton button) const { 149 InfoBarButton button) const {
150 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 150 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
151 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL : 151 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL :
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 base::Bind(&CheckDefaultBrowserCallback, desktop_type)); 256 base::Bind(&CheckDefaultBrowserCallback, desktop_type));
257 } 257 }
258 258
259 #if !defined(OS_WIN) 259 #if !defined(OS_WIN)
260 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { 260 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) {
261 return false; 261 return false;
262 } 262 }
263 #endif 263 #endif
264 264
265 } // namespace chrome 265 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698