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

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

Issue 8933003: [Sync Promo UI] Changing sync promo to honor brand codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some code review comments Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_ui.h" 5 #include "chrome/browser/ui/webui/sync_promo_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
11 #include "chrome/browser/google/google_util.h" 11 #include "chrome/browser/google/google_util.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 14 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
17 #include "chrome/browser/ui/webui/options/core_options_handler.h" 17 #include "chrome/browser/ui/webui/options/core_options_handler.h"
18 #include "chrome/browser/ui/webui/sync_promo_handler.h" 18 #include "chrome/browser/ui/webui/sync_promo_handler.h"
19 #include "chrome/browser/ui/webui/sync_promo_trial.h"
19 #include "chrome/browser/ui/webui/theme_source.h" 20 #include "chrome/browser/ui/webui/theme_source.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
23 #include "content/browser/tab_contents/tab_contents.h" 24 #include "content/browser/tab_contents/tab_contents.h"
24 #include "googleurl/src/url_util.h" 25 #include "googleurl/src/url_util.h"
25 #include "grit/browser_resources.h" 26 #include "grit/browser_resources.h"
26 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
27 #include "grit/theme_resources.h" 28 #include "grit/theme_resources.h"
28 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return false; 177 return false;
177 178
178 // For Chinese users skip the sync promo. 179 // For Chinese users skip the sync promo.
179 if (g_browser_process->GetApplicationLocale() == "zh-CN") 180 if (g_browser_process->GetApplicationLocale() == "zh-CN")
180 return false; 181 return false;
181 182
182 int show_count = prefs->GetInteger(prefs::kSyncPromoStartupCount); 183 int show_count = prefs->GetInteger(prefs::kSyncPromoStartupCount);
183 if (show_count >= kSyncPromoShowAtStartupMaximum) 184 if (show_count >= kSyncPromoShowAtStartupMaximum)
184 return false; 185 return false;
185 186
187 // If the current install has a brand code that's part of an experiment, honor
188 // that before master prefs.
189 if (sync_promo_trial::IsPartOfBrandTrialToEnable()) {
190 bool should_show = sync_promo_trial::ShouldShowAtStartupBasedOnBrand();
191 if (should_show)
192 sync_promo_trial::RecordUserShownPromoWithTrialBrand();
193 return should_show;
194 }
195
186 // This pref can be set in the master preferences file to allow or disallow 196 // This pref can be set in the master preferences file to allow or disallow
187 // showing the sync promo at startup. 197 // showing the sync promo at startup.
188 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed)) 198 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed))
189 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed); 199 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed);
190 200
191 // For now don't show the promo for some brands. 201 // For now don't show the promo for some brands.
192 if (!AllowPromoAtStartupForCurrentBrand()) 202 if (!AllowPromoAtStartupForCurrentBrand())
193 return false; 203 return false;
194 204
195 // Default to show the promo. 205 // Default to show the promo.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 UTF16ToUTF8(output.data(), output.length(), &url); 259 UTF16ToUTF8(output.data(), output.length(), &url);
250 return GURL(url); 260 return GURL(url);
251 } 261 }
252 return GURL(); 262 return GURL();
253 } 263 }
254 264
255 // static 265 // static
256 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { 266 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) {
257 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; 267 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0;
258 } 268 }
OLDNEW
« chrome/browser/ui/webui/sync_promo_trial.cc ('K') | « chrome/browser/ui/webui/sync_promo_trial.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698