Index: chrome/browser/ui/webui/sync_promo_handler.cc |
=================================================================== |
--- chrome/browser/ui/webui/sync_promo_handler.cc (revision 111699) |
+++ chrome/browser/ui/webui/sync_promo_handler.cc (working copy) |
@@ -15,6 +15,7 @@ |
#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/common/chrome_notification_types.h" |
#include "chrome/common/extensions/extension_constants.h" |
@@ -120,6 +121,20 @@ |
SyncSetupHandler::RegisterMessages(); |
} |
+void SyncPromoHandler::ShowGaiaSuccessAndClose() { |
+ if (SyncPromoTrial::IsExperimentActive()) |
+ SyncPromoTrial::RecordUserSignedIn(); |
+ |
+ SyncSetupHandler::ShowGaiaSuccessAndClose(); |
+} |
+ |
+void SyncPromoHandler::ShowGaiaSuccessAndSettingUp() { |
+ if (SyncPromoTrial::IsExperimentActive()) |
+ SyncPromoTrial::RecordUserSignedIn(); |
+ |
+ SyncSetupHandler::ShowGaiaSuccessAndSettingUp(); |
+} |
+ |
void SyncPromoHandler::ShowConfigure(const base::DictionaryValue& args) { |
bool usePassphrase = false; |
args.GetBoolean("usePassphrase", &usePassphrase); |
@@ -164,6 +179,11 @@ |
} |
} |
+void SyncPromoHandler::HandleSubmitAuth(const base::ListValue* args) { |
+ // Call the original implementation. |
sail
2011/11/28 16:34:25
comment should say why you're doing something not
SteveT
2011/11/28 20:07:32
Oops sorry - this was from the remnants of some ea
|
+ SyncSetupHandler::HandleSubmitAuth(args); |
+} |
+ |
void SyncPromoHandler::ShowSetupUI() { |
ProfileSyncService* service = |
Profile::FromWebUI(web_ui_)->GetProfileSyncService(); |
@@ -186,8 +206,13 @@ |
} |
void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { |
- base::FundamentalValue visible(SyncPromoUI::GetShowTitleForSyncPromoURL( |
- web_ui_->tab_contents()->GetURL())); |
+ // If the promo is also the Chrome launch page, we want to show the title and |
+ // load the promo experiments for the page. |
+ bool is_launch_page = SyncPromoUI::GetLaunchPageForSyncPromoURL( |
+ web_ui_->tab_contents()->GetURL()); |
+ if (is_launch_page) |
+ LoadPromoExperiments(); |
+ base::FundamentalValue visible(is_launch_page); |
web_ui_->CallJavascriptFunction("SyncSetupOverlay.setPromoTitleVisible", |
visible); |
@@ -202,6 +227,41 @@ |
UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); |
} |
+void SyncPromoHandler::LoadPromoExperiments() { |
+ // If we're not running the trial, we don't have to set the string since |
+ // it is already set to the default. |
+ if (!SyncPromoTrial::IsExperimentActive()) |
+ return; |
+ |
+ std::string resource_name; |
+ SyncPromoTrial::Group group = SyncPromoTrial::GetGroup(); |
+ switch (group) { |
+ case SyncPromoTrial::PROMO_MSG_A: |
+ resource_name = "promoMessageBodyA"; |
+ break; |
+ case SyncPromoTrial::PROMO_MSG_B: |
+ resource_name = "promoMessageBodyB"; |
+ break; |
+ case SyncPromoTrial::PROMO_MSG_C: |
+ resource_name = "promoMessageBodyC"; |
+ break; |
+ case SyncPromoTrial::PROMO_MSG_D: |
+ resource_name = "promoMessageBodyD"; |
+ break; |
+ default: |
+ NOTREACHED() << "Unrecognized SyncPromoTrial::Group."; |
+ resource_name = "promoMessageBodyA"; |
+ break; |
+ } |
+ |
+ SyncPromoTrial::RecordUserSawMessage(); |
+ |
+ // Call back to javascript with the resource name and let them set it. |
+ StringValue result(resource_name); |
+ web_ui_->CallJavascriptFunction("SyncSetupOverlay.populatePromoMessage", |
+ result); |
+} |
+ |
void SyncPromoHandler::HandleShowAdvancedSettings( |
const base::ListValue* args) { |
CloseSyncSetup(); |