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

Side by Side Diff: chrome/browser/ui/startup/autolaunch_prompt_win.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/autolaunch_prompt.h" 5 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 30 matching lines...) Expand all
41 static void Create(InfoBarService* infobar_service, Profile* profile); 41 static void Create(InfoBarService* infobar_service, Profile* profile);
42 42
43 private: 43 private:
44 explicit AutolaunchInfoBarDelegate(Profile* profile); 44 explicit AutolaunchInfoBarDelegate(Profile* profile);
45 ~AutolaunchInfoBarDelegate() override; 45 ~AutolaunchInfoBarDelegate() override;
46 46
47 void set_should_expire() { should_expire_ = true; } 47 void set_should_expire() { should_expire_ = true; }
48 48
49 // ConfirmInfoBarDelegate: 49 // ConfirmInfoBarDelegate:
50 int GetIconID() const override; 50 int GetIconID() const override;
51 bool ShouldExpireInternal(const NavigationDetails& details) const override; 51 bool ShouldExpire(const NavigationDetails& details) const override;
52 base::string16 GetMessageText() const override; 52 base::string16 GetMessageText() const override;
53 base::string16 GetButtonLabel(InfoBarButton button) const override; 53 base::string16 GetButtonLabel(InfoBarButton button) const override;
54 bool Accept() override; 54 bool Accept() override;
55 bool Cancel() override; 55 bool Cancel() override;
56 56
57 // Weak pointer to the profile, not owned by us. 57 // Weak pointer to the profile, not owned by us.
58 Profile* profile_; 58 Profile* profile_;
59 59
60 // Whether the info-bar should be dismissed on the next navigation. 60 // Whether the info-bar should be dismissed on the next navigation.
61 bool should_expire_; 61 bool should_expire_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 base::TimeDelta::FromSeconds(8)); 93 base::TimeDelta::FromSeconds(8));
94 } 94 }
95 95
96 AutolaunchInfoBarDelegate::~AutolaunchInfoBarDelegate() { 96 AutolaunchInfoBarDelegate::~AutolaunchInfoBarDelegate() {
97 } 97 }
98 98
99 int AutolaunchInfoBarDelegate::GetIconID() const { 99 int AutolaunchInfoBarDelegate::GetIconID() const {
100 return IDR_PRODUCT_LOGO_32; 100 return IDR_PRODUCT_LOGO_32;
101 } 101 }
102 102
103 bool AutolaunchInfoBarDelegate::ShouldExpireInternal( 103 bool AutolaunchInfoBarDelegate::ShouldExpire(
104 const NavigationDetails& details) const { 104 const NavigationDetails& details) const {
105 return should_expire_; 105 return should_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
106 } 106 }
107 107
108 base::string16 AutolaunchInfoBarDelegate::GetMessageText() const { 108 base::string16 AutolaunchInfoBarDelegate::GetMessageText() const {
109 return l10n_util::GetStringUTF16(IDS_AUTO_LAUNCH_INFOBAR_TEXT); 109 return l10n_util::GetStringUTF16(IDS_AUTO_LAUNCH_INFOBAR_TEXT);
110 } 110 }
111 111
112 base::string16 AutolaunchInfoBarDelegate::GetButtonLabel( 112 base::string16 AutolaunchInfoBarDelegate::GetButtonLabel(
113 InfoBarButton button) const { 113 InfoBarButton button) const {
114 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 114 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
115 IDS_AUTO_LAUNCH_OK : IDS_AUTO_LAUNCH_REVERT); 115 IDS_AUTO_LAUNCH_OK : IDS_AUTO_LAUNCH_REVERT);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 InfoBarService::FromWebContents(web_contents), 164 InfoBarService::FromWebContents(web_contents),
165 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 165 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
166 return true; 166 return true;
167 } 167 }
168 168
169 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { 169 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
170 registry->RegisterIntegerPref(prefs::kShownAutoLaunchInfobar, 0); 170 registry->RegisterIntegerPref(prefs::kShownAutoLaunchInfobar, 0);
171 } 171 }
172 172
173 } // namespace chrome 173 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698