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

Side by Side Diff: chrome/browser/ui/webui/sync_promo_handler.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_handler.h" 5 #include "chrome/browser/ui/webui/sync_promo_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // This was added because of the need to change the existing UMA enum for the 51 // This was added because of the need to change the existing UMA enum for the
52 // sync promo mid-flight. Ideally these values would be contiguous, but the 52 // sync promo mid-flight. Ideally these values would be contiguous, but the
53 // real world is not always ideal. 53 // real world is not always ideal.
54 static bool IsValidUserFlowAction(int action) { 54 static bool IsValidUserFlowAction(int action) {
55 return (action >= SYNC_PROMO_FIRST_VALID_JS_ACTION && 55 return (action >= SYNC_PROMO_FIRST_VALID_JS_ACTION &&
56 action <= SYNC_PROMO_LAST_VALID_JS_ACTION) || 56 action <= SYNC_PROMO_LAST_VALID_JS_ACTION) ||
57 action == SYNC_PROMO_LEFT_DURING_THROBBER; 57 action == SYNC_PROMO_LEFT_DURING_THROBBER;
58 } 58 }
59 59
60 static void RecordExperimentOutcomesOnSignIn() {
61 if (sync_promo_trial::IsExperimentActive())
62 sync_promo_trial::RecordUserSignedIn();
63 if (sync_promo_trial::IsPartOfBrandTrialToEnable())
64 sync_promo_trial::RecordUserSignedInWithTrialBrand();
65 }
66
60 } // namespace 67 } // namespace
61 68
62 SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager) 69 SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager)
63 : SyncSetupHandler(profile_manager), 70 : SyncSetupHandler(profile_manager),
64 window_already_closed_(false) { 71 window_already_closed_(false) {
65 } 72 }
66 73
67 SyncPromoHandler::~SyncPromoHandler() { 74 SyncPromoHandler::~SyncPromoHandler() {
68 } 75 }
69 76
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 web_ui_->RegisterMessageCallback("SyncPromo:UserFlowAction", 122 web_ui_->RegisterMessageCallback("SyncPromo:UserFlowAction",
116 base::Bind(&SyncPromoHandler::HandleUserFlowAction, 123 base::Bind(&SyncPromoHandler::HandleUserFlowAction,
117 base::Unretained(this))); 124 base::Unretained(this)));
118 web_ui_->RegisterMessageCallback("SyncPromo:UserSkipped", 125 web_ui_->RegisterMessageCallback("SyncPromo:UserSkipped",
119 base::Bind(&SyncPromoHandler::HandleUserSkipped, 126 base::Bind(&SyncPromoHandler::HandleUserSkipped,
120 base::Unretained(this))); 127 base::Unretained(this)));
121 SyncSetupHandler::RegisterMessages(); 128 SyncSetupHandler::RegisterMessages();
122 } 129 }
123 130
124 void SyncPromoHandler::ShowGaiaSuccessAndClose() { 131 void SyncPromoHandler::ShowGaiaSuccessAndClose() {
125 if (sync_promo_trial::IsExperimentActive()) 132 RecordExperimentOutcomesOnSignIn();
126 sync_promo_trial::RecordUserSignedIn();
127
128 SyncSetupHandler::ShowGaiaSuccessAndClose(); 133 SyncSetupHandler::ShowGaiaSuccessAndClose();
129 } 134 }
130 135
131 void SyncPromoHandler::ShowGaiaSuccessAndSettingUp() { 136 void SyncPromoHandler::ShowGaiaSuccessAndSettingUp() {
132 if (sync_promo_trial::IsExperimentActive()) 137 RecordExperimentOutcomesOnSignIn();
133 sync_promo_trial::RecordUserSignedIn();
134
135 SyncSetupHandler::ShowGaiaSuccessAndSettingUp(); 138 SyncSetupHandler::ShowGaiaSuccessAndSettingUp();
136 } 139 }
137 140
138 void SyncPromoHandler::ShowConfigure(const base::DictionaryValue& args) { 141 void SyncPromoHandler::ShowConfigure(const base::DictionaryValue& args) {
139 bool usePassphrase = false; 142 bool usePassphrase = false;
140 args.GetBoolean("usePassphrase", &usePassphrase); 143 args.GetBoolean("usePassphrase", &usePassphrase);
141 144
142 if (usePassphrase) { 145 if (usePassphrase) {
143 // If a passphrase is required then we must show the configure pane. 146 // If a passphrase is required then we must show the configure pane.
144 SyncSetupHandler::ShowConfigure(args); 147 SyncSetupHandler::ShowConfigure(args);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 int adjusted = GetViewCount() + amount; 282 int adjusted = GetViewCount() + amount;
280 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted); 283 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted);
281 return adjusted; 284 return adjusted;
282 } 285 }
283 286
284 void SyncPromoHandler::RecordUserFlowAction(int action) { 287 void SyncPromoHandler::RecordUserFlowAction(int action) {
285 // Send an enumeration to our single user flow histogram. 288 // Send an enumeration to our single user flow histogram.
286 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, 289 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action,
287 SYNC_PROMO_BUCKET_BOUNDARY); 290 SYNC_PROMO_BUCKET_BOUNDARY);
288 } 291 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/sync_promo_trial.h » ('j') | chrome/browser/ui/webui/sync_promo_trial.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698