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

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc

Issue 9159047: Disable sync promo for Chromium builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_trial.cc ('k') | no next file » | 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/webui/sync_promo/sync_promo_ui.h" 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 sync_promo_trial::RecordUserShownPromo(web_ui); 131 sync_promo_trial::RecordUserShownPromo(web_ui);
132 } 132 }
133 133
134 // static 134 // static
135 bool SyncPromoUI::HasShownPromoAtStartup(Profile* profile) { 135 bool SyncPromoUI::HasShownPromoAtStartup(Profile* profile) {
136 return profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount); 136 return profile->GetPrefs()->HasPrefPath(prefs::kSyncPromoStartupCount);
137 } 137 }
138 138
139 // static 139 // static
140 bool SyncPromoUI::ShouldShowSyncPromo(Profile* profile) { 140 bool SyncPromoUI::ShouldShowSyncPromo(Profile* profile) {
141 #if defined(OS_CHROMEOS) 141 #if defined(OS_CHROMEOS)
Dan Beam 2012/01/30 23:16:40 Why not here? #if defined(OS_CHROMEOS) || !define
sail 2012/01/30 23:24:21 Doing it lower allows us to enable it using a comm
142 // There's no need to show the sync promo on cros since cros users are logged 142 // There's no need to show the sync promo on cros since cros users are logged
143 // into sync already. 143 // into sync already.
144 return false; 144 return false;
145 #endif 145 #endif
146 146
147 // Honor the sync policies. 147 // Honor the sync policies.
148 if (!profile->GetOriginalProfile()->IsSyncAccessible()) 148 if (!profile->GetOriginalProfile()->IsSyncAccessible())
149 return false; 149 return false;
150 150
151 // If the user is already signed into sync then don't show the promo. 151 // If the user is already signed into sync then don't show the promo.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 // This pref can be set in the master preferences file to allow or disallow 213 // This pref can be set in the master preferences file to allow or disallow
214 // showing the sync promo at startup. 214 // showing the sync promo at startup.
215 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed)) 215 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed))
216 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed); 216 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed);
217 217
218 // For now don't show the promo for some brands. 218 // For now don't show the promo for some brands.
219 if (!AllowPromoAtStartupForCurrentBrand()) 219 if (!AllowPromoAtStartupForCurrentBrand())
220 return false; 220 return false;
221 221
222 // Default to show the promo. 222 // Default to show the promo for Google Chrome builds.
223 #if defined(GOOGLE_CHROME_BUILD)
223 return true; 224 return true;
225 #else
226 return false;
227 #endif
224 } 228 }
225 229
226 void SyncPromoUI::DidShowSyncPromoAtStartup(Profile* profile) { 230 void SyncPromoUI::DidShowSyncPromoAtStartup(Profile* profile) {
227 int show_count = profile->GetPrefs()->GetInteger( 231 int show_count = profile->GetPrefs()->GetInteger(
228 prefs::kSyncPromoStartupCount); 232 prefs::kSyncPromoStartupCount);
229 show_count++; 233 show_count++;
230 profile->GetPrefs()->SetInteger(prefs::kSyncPromoStartupCount, show_count); 234 profile->GetPrefs()->SetInteger(prefs::kSyncPromoStartupCount, show_count);
231 } 235 }
232 236
233 bool SyncPromoUI::HasUserSkippedSyncPromo(Profile* profile) { 237 bool SyncPromoUI::HasUserSkippedSyncPromo(Profile* profile) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 294 }
291 295
292 // static 296 // static
293 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { 297 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) {
294 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; 298 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0;
295 } 299 }
296 300
297 // static 301 // static
298 int SyncPromoUI::GetSyncPromoVersion() { 302 int SyncPromoUI::GetSyncPromoVersion() {
299 int version = 0; 303 int version = 0;
300 if (base::StringToInt(CommandLine::ForCurrentProcess()->
301 GetSwitchValueASCII(switches::kSyncPromoVersion), &version)) {
302 return version;
303 }
304 if (sync_promo_trial::GetSyncPromoVersionForCurrentTrial(&version)) 304 if (sync_promo_trial::GetSyncPromoVersionForCurrentTrial(&version))
305 return version; 305 return version;
306 // Default promo version is 0. 306 // Default promo version is 0.
307 return 0; 307 return 0;
308 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_trial.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698