diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 08:10:57 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 08:10:57 +0000 |
commit | 130879eecb82519e43c08134ea2a3a6d82fe3f0e (patch) | |
tree | 11f0ce1b30f3454dde9fb7baa50e63d7cf447698 /chrome/browser | |
parent | 6e66bf13fb20fd640a8b863011e65f14d5a8c15b (diff) | |
download | chromium_src-130879eecb82519e43c08134ea2a3a6d82fe3f0e.zip chromium_src-130879eecb82519e43c08134ea2a3a6d82fe3f0e.tar.gz chromium_src-130879eecb82519e43c08134ea2a3a6d82fe3f0e.tar.bz2 |
[Sync Promo UI] Changing sync promo to honor brand codes.
Also, this CL moves chrome/browser/ui/webui/sync_promo_* to
chrome/browser/ui/webui/sync_promo/sync_promo_*.
BUG=107223
R=stevet@chromium.org,rogerta@chromium.org,sail@chromium.org
TEST=The sync promo responds to brand code and records results of the field
trial correctly.
Review URL: http://codereview.chromium.org/8933003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
17 files changed, 164 insertions, 49 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index c31dfd9..ad900d6 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -77,7 +77,7 @@ #include "chrome/browser/translate/translate_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" -#include "chrome/browser/ui/webui/sync_promo_trial.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 844581b..9b4a6b3 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -59,7 +59,7 @@ #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/options/extension_settings_handler.h" #include "chrome/browser/ui/webui/plugins_ui.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/browser/upgrade_detector.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index ed81da4..c5c6e7f 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -25,7 +25,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 4b343d2..ecb78e4 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -64,7 +64,7 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_result_codes.h" diff --git a/chrome/browser/ui/webui/chrome_web_ui_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_factory.cc index eabb387..70e6518 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_factory.cc @@ -64,7 +64,7 @@ #include "chrome/browser/ui/webui/chromeos/system_info_ui.h" #include "chrome/browser/ui/webui/active_downloads_ui.h" #else -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #endif #if defined(USE_VIRTUAL_KEYBOARD) diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc index b48749f..0c251fa 100644 --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc @@ -25,7 +25,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/browser/ui/webui/web_ui_util.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 41f8441..e06e3ab 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -26,7 +26,7 @@ #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/browser/ui/webui/sync_setup_handler.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/ui/webui/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc index c2fb5689..7be0cb0 100644 --- a/chrome/browser/ui/webui/sync_promo_handler.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/sync_promo_handler.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -15,8 +15,8 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/webui/sync_promo_trial.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" @@ -57,6 +57,13 @@ static bool IsValidUserFlowAction(int action) { action == SYNC_PROMO_LEFT_DURING_THROBBER; } +static void RecordExperimentOutcomesOnSignIn() { + if (sync_promo_trial::IsExperimentActive()) + sync_promo_trial::RecordUserSignedIn(); + if (sync_promo_trial::IsPartOfBrandTrialToEnable()) + sync_promo_trial::RecordUserSignedInWithTrialBrand(); +} + } // namespace SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager) @@ -122,16 +129,12 @@ void SyncPromoHandler::RegisterMessages() { } void SyncPromoHandler::ShowGaiaSuccessAndClose() { - if (sync_promo_trial::IsExperimentActive()) - sync_promo_trial::RecordUserSignedIn(); - + RecordExperimentOutcomesOnSignIn(); SyncSetupHandler::ShowGaiaSuccessAndClose(); } void SyncPromoHandler::ShowGaiaSuccessAndSettingUp() { - if (sync_promo_trial::IsExperimentActive()) - sync_promo_trial::RecordUserSignedIn(); - + RecordExperimentOutcomesOnSignIn(); SyncSetupHandler::ShowGaiaSuccessAndSettingUp(); } @@ -273,7 +276,7 @@ int SyncPromoHandler::GetViewCount() const { return prefs_->GetInteger(prefs::kSyncPromoViewCount); } -int SyncPromoHandler::IncrementViewCountBy(unsigned int amount) { +int SyncPromoHandler::IncrementViewCountBy(size_t amount) { // Let the user increment by 0 if they really want. It might be useful for a // weird way of sending preference change notifications... int adjusted = GetViewCount() + amount; diff --git a/chrome/browser/ui/webui/sync_promo_handler.h b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h index d0534e4..4b2596d 100644 --- a/chrome/browser/ui/webui/sync_promo_handler.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ -#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER_H_ #pragma once #include "chrome/browser/ui/webui/sync_setup_handler.h" @@ -70,7 +70,7 @@ class SyncPromoHandler : public SyncSetupHandler { // Increment the local view count by the specified non-negative integer // amount. Returns the new total view count. - int IncrementViewCountBy(unsigned int amount); + int IncrementViewCountBy(size_t amount); // Record a user's flow through the promo to our histogram in UMA. void RecordUserFlowAction(int action); @@ -94,4 +94,4 @@ class SyncPromoHandler : public SyncSetupHandler { DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler); }; -#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER_H_ diff --git a/chrome/browser/ui/webui/sync_promo_handler2.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc index 9788d45..3892f08 100644 --- a/chrome/browser/ui/webui/sync_promo_handler2.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/sync_promo_handler2.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_handler2.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -15,8 +15,8 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/webui/sync_promo_trial.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" @@ -57,6 +57,13 @@ static bool IsValidUserFlowAction(int action) { action == SYNC_PROMO_LEFT_DURING_THROBBER; } +static void RecordExperimentOutcomesOnSignIn() { + if (sync_promo_trial::IsExperimentActive()) + sync_promo_trial::RecordUserSignedIn(); + if (sync_promo_trial::IsPartOfBrandTrialToEnable()) + sync_promo_trial::RecordUserSignedInWithTrialBrand(); +} + } // namespace SyncPromoHandler2::SyncPromoHandler2(ProfileManager* profile_manager) @@ -122,16 +129,12 @@ void SyncPromoHandler2::RegisterMessages() { } void SyncPromoHandler2::ShowGaiaSuccessAndClose() { - if (sync_promo_trial::IsExperimentActive()) - sync_promo_trial::RecordUserSignedIn(); - + RecordExperimentOutcomesOnSignIn(); SyncSetupHandler2::ShowGaiaSuccessAndClose(); } void SyncPromoHandler2::ShowGaiaSuccessAndSettingUp() { - if (sync_promo_trial::IsExperimentActive()) - sync_promo_trial::RecordUserSignedIn(); - + RecordExperimentOutcomesOnSignIn(); SyncSetupHandler2::ShowGaiaSuccessAndSettingUp(); } @@ -246,7 +249,8 @@ void SyncPromoHandler2::HandleRecordThrobberTime(const base::ListValue* args) { } // TODO(dbeam): Replace with metricsHandler:recordHistogramCount when it exists. -void SyncPromoHandler2::HandleRecordSignInAttempts(const base::ListValue* args) { +void SyncPromoHandler2::HandleRecordSignInAttempts( + const base::ListValue* args) { double count_double; CHECK(args->GetDouble(0, &count_double)); UMA_HISTOGRAM_COUNTS("SyncPromo.SignInAttempts", count_double); @@ -273,7 +277,7 @@ int SyncPromoHandler2::GetViewCount() const { return prefs_->GetInteger(prefs::kSyncPromoViewCount); } -int SyncPromoHandler2::IncrementViewCountBy(unsigned int amount) { +int SyncPromoHandler2::IncrementViewCountBy(size_t amount) { // Let the user increment by 0 if they really want. It might be useful for a // weird way of sending preference change notifications... int adjusted = GetViewCount() + amount; diff --git a/chrome/browser/ui/webui/sync_promo_handler2.h b/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.h index c2d3c8f..0726ae4 100644 --- a/chrome/browser/ui/webui/sync_promo_handler2.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler2.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ -#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER2_H_ +#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER2_H_ #pragma once #include "chrome/browser/ui/webui/sync_setup_handler2.h" @@ -70,7 +70,7 @@ class SyncPromoHandler2 : public SyncSetupHandler2 { // Increment the local view count by the specified non-negative integer // amount. Returns the new total view count. - int IncrementViewCountBy(unsigned int amount); + int IncrementViewCountBy(size_t amount); // Record a user's flow through the promo to our histogram in UMA. void RecordUserFlowAction(int action); @@ -94,4 +94,4 @@ class SyncPromoHandler2 : public SyncSetupHandler2 { DISALLOW_COPY_AND_ASSIGN(SyncPromoHandler2); }; -#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_HANDLER_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_HANDLER2_H_ diff --git a/chrome/browser/ui/webui/sync_promo_trial.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_trial.cc index 4003144..d7410498 100644 --- a/chrome/browser/ui/webui/sync_promo_trial.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_trial.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/sync_promo_trial.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" #include "base/metrics/field_trial.h" +#include "base/string_util.h" +#include "chrome/browser/google/google_util.h" #include "chrome/browser/metrics/metrics_service.h" #include "chrome/browser/prefs/pref_service.h" #include "grit/generated_resources.h" @@ -19,8 +21,14 @@ int g_sync_promo_experiment_b = 0; int g_sync_promo_experiment_c = 0; int g_sync_promo_experiment_d = 0; +const char kSyncPromoEnabledTrialName[] = "SyncPromoEnabled"; const char kSyncPromoMsgTrialName[] = "SyncPromoMsg"; +const char kSyncPromoEnabledWithApps[] = "EnabledWithDefaultApps"; +const char kSyncPromoEnabledWithoutApps[] = "EnabledWithoutDefaultApps"; +const char kSyncPromoDisabledWithoutAppsA[] = "DisabledWithoutDefaultAppsA"; +const char kSyncPromoDisabledWithoutAppsB[] = "DisabledWithoutDefaultAppsB"; + void Activate() { // The end date (February 21, 2012) is approximately 2 weeks into M17 stable. scoped_refptr<base::FieldTrial> trial( @@ -35,6 +43,25 @@ void Activate() { g_sync_promo_experiment_b = trial->AppendGroup("MsgB", 50); g_sync_promo_experiment_c = trial->AppendGroup("MsgC", 50); g_sync_promo_experiment_d = trial->AppendGroup("MsgD", 50); + + // Determine whether we should show the sync promo via brand code. + std::string brand; + google_util::GetBrand(&brand); + + // Create a field trial based on the brand code. + if (LowerCaseEqualsASCII(brand, "ecba")) { + base::FieldTrialList::CreateFieldTrial(kSyncPromoEnabledTrialName, + kSyncPromoEnabledWithApps); + } else if (LowerCaseEqualsASCII(brand, "ecsa")) { + base::FieldTrialList::CreateFieldTrial(kSyncPromoEnabledTrialName, + kSyncPromoEnabledWithoutApps); + } else if (LowerCaseEqualsASCII(brand, "ecsb")) { + base::FieldTrialList::CreateFieldTrial(kSyncPromoEnabledTrialName, + kSyncPromoDisabledWithoutAppsA); + } else if (LowerCaseEqualsASCII(brand, "ecbb")) { + base::FieldTrialList::CreateFieldTrial(kSyncPromoEnabledTrialName, + kSyncPromoDisabledWithoutAppsB); + } } bool IsExperimentActive() { @@ -42,6 +69,10 @@ bool IsExperimentActive() { base::FieldTrial::kNotFinalized; } +bool IsPartOfBrandTrialToEnable() { + return base::FieldTrialList::TrialExists(kSyncPromoEnabledTrialName); +} + Group GetGroup() { // Promo message A is also the default value, so display it if there is no // active experiment. @@ -62,6 +93,25 @@ Group GetGroup() { return PROMO_MSG_A; } +int GetSyncPromoBrandUMABucketFromGroup() { + DCHECK(IsPartOfBrandTrialToEnable()); + + std::string group = + base::FieldTrialList::Find(kSyncPromoEnabledTrialName)->group_name(); + + if (group == kSyncPromoEnabledWithApps) + return WITH_SYNC_PROMO_WITH_DEFAULT_APPS; + else if (group == kSyncPromoEnabledWithoutApps) + return WITH_SYNC_PROMO_WITHOUT_DEFAULT_APPS; + else if (group == kSyncPromoDisabledWithoutAppsA) + return WITHOUT_SYNC_PROMO_WITHOUT_DEFAULT_APPS_A; + else if (group == kSyncPromoDisabledWithoutAppsB) + return WITHOUT_SYNC_PROMO_WITHOUT_DEFAULT_APPS_B; + + NOTREACHED(); + return SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY + 1; +} + int GetMessageBodyResID() { // Note that GetGroup and the switch will take care of the !IsExperimentActive // case for us. @@ -90,6 +140,13 @@ void RecordUserSawMessage() { PROMO_MSG_MAX); } +void RecordUserShownPromoWithTrialBrand() { + DCHECK(IsPartOfBrandTrialToEnable()); + UMA_HISTOGRAM_ENUMERATION("SyncPromo.ShownPromoWithBrand", + GetSyncPromoBrandUMABucketFromGroup(), + SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); +} + void RecordUserSignedIn() { DCHECK(IsExperimentActive()); UMA_HISTOGRAM_ENUMERATION("SyncPromo.MessageOnSignIn", @@ -97,4 +154,19 @@ void RecordUserSignedIn() { PROMO_MSG_MAX); } +void RecordUserSignedInWithTrialBrand() { + DCHECK(IsPartOfBrandTrialToEnable()); + UMA_HISTOGRAM_ENUMERATION("SyncPromo.SignedInWithBrand", + GetSyncPromoBrandUMABucketFromGroup(), + SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); +} + +bool ShouldShowAtStartupBasedOnBrand() { + DCHECK(IsPartOfBrandTrialToEnable()); + std::string name = + base::FieldTrialList::Find(kSyncPromoEnabledTrialName)->group_name(); + return name == kSyncPromoEnabledWithApps || + name == kSyncPromoEnabledWithoutApps; +} + } // namespace sync_promo_trial diff --git a/chrome/browser/ui/webui/sync_promo_trial.h b/chrome/browser/ui/webui/sync_promo/sync_promo_trial.h index 5186bb5..c6ed97b 100644 --- a/chrome/browser/ui/webui/sync_promo_trial.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_trial.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_TRIAL_H_ -#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_TRIAL_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_TRIAL_H_ +#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_TRIAL_H_ #include "base/basictypes.h" @@ -30,6 +30,14 @@ namespace sync_promo_trial { PROMO_MSG_MAX, }; + enum SyncPromoEnabledBrandUMABuckets { + WITH_SYNC_PROMO_WITH_DEFAULT_APPS = 0, + WITH_SYNC_PROMO_WITHOUT_DEFAULT_APPS, + WITHOUT_SYNC_PROMO_WITHOUT_DEFAULT_APPS_A, + WITHOUT_SYNC_PROMO_WITHOUT_DEFAULT_APPS_B, + SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY, + }; + // Activate the field trial. Before this call, all calls to GetGroup will // return PROMO_MSG_A. *** MUST NOT BE CALLED MORE THAN ONCE. *** void Activate(); @@ -38,9 +46,16 @@ namespace sync_promo_trial { // is false, the caller should not record stats for this experiment. bool IsExperimentActive(); + // If the user has been tagged with a brand code at install time that + // determines if they should see the sync promo or not. + bool IsPartOfBrandTrialToEnable(); + // Return the field trial group this client belongs to. Group GetGroup(); + // Return the UMA bucket + int GetSyncPromoBrandUMABucketFromGroup(); + // Return the resource ID for the Sync Promo message body associated with this // client. int GetMessageBodyResID(); @@ -49,9 +64,21 @@ namespace sync_promo_trial { // message. void RecordUserSawMessage(); + // Record that a user was shown the promo when tagged with an experimental + // brand code. + void RecordUserShownPromoWithTrialBrand(); + // Record the appropriate UMA stat for when a user successfully signs in to // GAIA. void RecordUserSignedIn(); + + // Record that a user signed in while tagged with a brand code currently being + // used in a field trial. + void RecordUserSignedInWithTrialBrand(); + + // If we've been tagged with any of the experimental brands to show the sync + // promo. + bool ShouldShowAtStartupBasedOnBrand(); } -#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_TRIAL_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_TRIAL_H_ diff --git a/chrome/browser/ui/webui/sync_promo_ui.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc index 756aeb9..6c809c4 100644 --- a/chrome/browser/ui/webui/sync_promo_ui.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "base/command_line.h" #include "base/utf_string_conversions.h" @@ -15,7 +15,8 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" #include "chrome/browser/ui/webui/options/core_options_handler.h" -#include "chrome/browser/ui/webui/sync_promo_handler.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" #include "chrome/browser/ui/webui/theme_source.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -121,6 +122,9 @@ SyncPromoUI::SyncPromoUI(TabContents* contents) : ChromeWebUI(contents) { html_source->add_resource_path(kSyncPromoJsFile, IDR_SYNC_PROMO_JS); html_source->set_default_resource(IDR_SYNC_PROMO_HTML); profile->GetChromeURLDataManager()->AddDataSource(html_source); + + if (sync_promo_trial::IsPartOfBrandTrialToEnable()) + sync_promo_trial::RecordUserShownPromoWithTrialBrand(); } // static @@ -183,6 +187,11 @@ bool SyncPromoUI::ShouldShowSyncPromoAtStartup(Profile* profile, if (show_count >= kSyncPromoShowAtStartupMaximum) return false; + // If the current install has a brand code that's part of an experiment, honor + // that before master prefs. + if (sync_promo_trial::IsPartOfBrandTrialToEnable()) + return sync_promo_trial::ShouldShowAtStartupBasedOnBrand(); + // This pref can be set in the master preferences file to allow or disallow // showing the sync promo at startup. if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed)) diff --git a/chrome/browser/ui/webui/sync_promo_ui.h b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h index d089406..2a3e4cb 100644 --- a/chrome/browser/ui/webui/sync_promo_ui.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_UI_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ #pragma once #include "chrome/browser/ui/webui/chrome_web_ui.h" @@ -58,4 +58,4 @@ class SyncPromoUI : public ChromeWebUI { DISALLOW_COPY_AND_ASSIGN(SyncPromoUI); }; -#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_UI_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_UI_H_ diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index e9129aa1..fce9204 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc @@ -23,8 +23,8 @@ #include "chrome/browser/sync/sync_setup_flow.h" #include "chrome/browser/sync/util/oauth.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/webui/sync_promo_trial.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/browser/ui/webui/user_selectable_sync_type.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/ui/webui/sync_setup_handler2.cc b/chrome/browser/ui/webui/sync_setup_handler2.cc index d47e6a2..ae50432 100644 --- a/chrome/browser/ui/webui/sync_setup_handler2.cc +++ b/chrome/browser/ui/webui/sync_setup_handler2.cc @@ -24,8 +24,8 @@ #include "chrome/browser/sync/sync_setup_flow.h" #include "chrome/browser/sync/util/oauth.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/webui/sync_promo_trial.h" -#include "chrome/browser/ui/webui/sync_promo_ui.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" +#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/browser/ui/webui/user_selectable_sync_type.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" |