OLD | NEW |
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/sync_promo_handler.h" | 5 #include "chrome/browser/ui/webui/sync_promo/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 Loading... |
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 | |
67 } // namespace | 60 } // namespace |
68 | 61 |
69 SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager) | 62 SyncPromoHandler::SyncPromoHandler(ProfileManager* profile_manager) |
70 : SyncSetupHandler(profile_manager), | 63 : SyncSetupHandler(profile_manager), |
71 window_already_closed_(false) { | 64 window_already_closed_(false) { |
72 } | 65 } |
73 | 66 |
74 SyncPromoHandler::~SyncPromoHandler() { | 67 SyncPromoHandler::~SyncPromoHandler() { |
75 } | 68 } |
76 | 69 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 273 } |
281 | 274 |
282 int SyncPromoHandler::IncrementViewCountBy(size_t amount) { | 275 int SyncPromoHandler::IncrementViewCountBy(size_t amount) { |
283 // Let the user increment by 0 if they really want. It might be useful for a | 276 // Let the user increment by 0 if they really want. It might be useful for a |
284 // weird way of sending preference change notifications... | 277 // weird way of sending preference change notifications... |
285 int adjusted = GetViewCount() + amount; | 278 int adjusted = GetViewCount() + amount; |
286 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted); | 279 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted); |
287 return adjusted; | 280 return adjusted; |
288 } | 281 } |
289 | 282 |
| 283 void SyncPromoHandler::RecordExperimentOutcomesOnSignIn() { |
| 284 if (sync_promo_trial::IsExperimentActive()) |
| 285 sync_promo_trial::RecordUserSignedIn(); |
| 286 if (sync_promo_trial::IsPartOfBrandTrialToEnable()) { |
| 287 bool is_start_up = SyncPromoUI::GetIsLaunchPageForSyncPromoURL( |
| 288 web_ui_->tab_contents()->GetURL()); |
| 289 Profile* profile = Profile::FromWebUI(web_ui_); |
| 290 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile); |
| 291 } |
| 292 } |
| 293 |
290 void SyncPromoHandler::RecordUserFlowAction(int action) { | 294 void SyncPromoHandler::RecordUserFlowAction(int action) { |
291 // Send an enumeration to our single user flow histogram. | 295 // Send an enumeration to our single user flow histogram. |
292 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 296 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
293 SYNC_PROMO_BUCKET_BOUNDARY); | 297 SYNC_PROMO_BUCKET_BOUNDARY); |
294 } | 298 } |
OLD | NEW |