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

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

Issue 10417032: Disable sync promo when RestoreOnStartupURLs policy is used (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 // For Chinese users skip the sync promo. 166 // For Chinese users skip the sync promo.
167 if (g_browser_process->GetApplicationLocale() == "zh-CN") 167 if (g_browser_process->GetApplicationLocale() == "zh-CN")
168 return false; 168 return false;
169 169
170 PrefService* prefs = profile->GetPrefs(); 170 PrefService* prefs = profile->GetPrefs();
171 int show_count = prefs->GetInteger(prefs::kSyncPromoStartupCount); 171 int show_count = prefs->GetInteger(prefs::kSyncPromoStartupCount);
172 if (show_count >= kSyncPromoShowAtStartupMaximum) 172 if (show_count >= kSyncPromoShowAtStartupMaximum)
173 return false; 173 return false;
174 174
175 // This pref can be set in the master preferences file to allow or disallow 175 // Check whether the sync promo has been disabled by a pref. This will always
176 // showing the sync promo at startup. 176 // automatically be the case when the RestoreOnStartupURLs policy is set.
Mattias Nissler (ping if slow) 2012/05/22 14:58:41 Please retain the master_preferences reference in
bartfab (slow) 2012/05/22 15:30:54 Done.
177 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed)) 177 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed))
178 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed); 178 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed);
179 179
180 // For now don't show the promo for some brands. 180 // For now don't show the promo for some brands.
181 if (!AllowPromoAtStartupForCurrentBrand()) 181 if (!AllowPromoAtStartupForCurrentBrand())
182 return false; 182 return false;
183 183
184 // Default to show the promo for Google Chrome builds. 184 // Default to show the promo for Google Chrome builds.
185 #if defined(GOOGLE_CHROME_BUILD) 185 #if defined(GOOGLE_CHROME_BUILD)
186 return true; 186 return true;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (chrome_common_net::GetValueForKeyInQuery( 239 if (chrome_common_net::GetValueForKeyInQuery(
240 url, kSyncPromoQueryKeySource, &value)) { 240 url, kSyncPromoQueryKeySource, &value)) {
241 int source = 0; 241 int source = 0;
242 if (base::StringToInt(value, &source) && source >= SOURCE_START_PAGE && 242 if (base::StringToInt(value, &source) && source >= SOURCE_START_PAGE &&
243 source < SOURCE_UNKNOWN) { 243 source < SOURCE_UNKNOWN) {
244 return static_cast<Source>(source); 244 return static_cast<Source>(source);
245 } 245 }
246 } 246 }
247 return SOURCE_UNKNOWN; 247 return SOURCE_UNKNOWN;
248 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698