| 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_trial.h" | 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
| 10 #include "chrome/browser/metrics/metrics_service.h" | 10 #include "chrome/browser/metrics/metrics_service.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 | 14 |
| 14 namespace sync_promo_trial { | 15 namespace sync_promo_trial { |
| 15 | 16 |
| 16 // Field trial IDs of the control and experiment groups. Though they are not | 17 // Field trial IDs of the control and experiment groups. Though they are not |
| 17 // literally "const", they are set only once, in Activate() below. See the .h | 18 // literally "const", they are set only once, in Activate() below. See the .h |
| 18 // file for what these groups represent. | 19 // file for what these groups represent. |
| 19 int g_sync_promo_experiment_a = 0; | 20 int g_sync_promo_experiment_a = 0; |
| 20 int g_sync_promo_experiment_b = 0; | 21 int g_sync_promo_experiment_b = 0; |
| 21 int g_sync_promo_experiment_c = 0; | 22 int g_sync_promo_experiment_c = 0; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return IDS_SYNC_PROMO_MESSAGE_BODY_A; | 134 return IDS_SYNC_PROMO_MESSAGE_BODY_A; |
| 134 } | 135 } |
| 135 | 136 |
| 136 void RecordUserSawMessage() { | 137 void RecordUserSawMessage() { |
| 137 DCHECK(IsExperimentActive()); | 138 DCHECK(IsExperimentActive()); |
| 138 UMA_HISTOGRAM_ENUMERATION("SyncPromo.MessageDisplayed", | 139 UMA_HISTOGRAM_ENUMERATION("SyncPromo.MessageDisplayed", |
| 139 GetGroup(), | 140 GetGroup(), |
| 140 PROMO_MSG_MAX); | 141 PROMO_MSG_MAX); |
| 141 } | 142 } |
| 142 | 143 |
| 143 void RecordUserShownPromoWithTrialBrand() { | 144 void RecordUserShownPromoWithTrialBrand(bool is_at_startup, Profile* profile) { |
| 144 DCHECK(IsPartOfBrandTrialToEnable()); | 145 DCHECK(IsPartOfBrandTrialToEnable()); |
| 145 UMA_HISTOGRAM_ENUMERATION("SyncPromo.ShownPromoWithBrand", | 146 if (is_at_startup) { |
| 146 GetSyncPromoBrandUMABucketFromGroup(), | 147 DCHECK(SyncPromoUI::HasShownPromoAtStartup(profile)); |
| 147 SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); | 148 UMA_HISTOGRAM_ENUMERATION("SyncPromo.ShownPromoWithBrandAtStartup", |
| 149 GetSyncPromoBrandUMABucketFromGroup(), |
| 150 SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); |
| 151 } else { |
| 152 UMA_HISTOGRAM_ENUMERATION("SyncPromo.ShownPromoWithBrand", |
| 153 GetSyncPromoBrandUMABucketFromGroup(), |
| 154 SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); |
| 155 } |
| 148 } | 156 } |
| 149 | 157 |
| 150 void RecordUserSignedIn() { | 158 void RecordUserSignedIn() { |
| 151 DCHECK(IsExperimentActive()); | 159 DCHECK(IsExperimentActive()); |
| 152 UMA_HISTOGRAM_ENUMERATION("SyncPromo.MessageOnSignIn", | 160 UMA_HISTOGRAM_ENUMERATION("SyncPromo.MessageOnSignIn", |
| 153 GetGroup(), | 161 GetGroup(), |
| 154 PROMO_MSG_MAX); | 162 PROMO_MSG_MAX); |
| 155 } | 163 } |
| 156 | 164 |
| 157 void RecordUserSignedInWithTrialBrand() { | 165 void RecordUserSignedInWithTrialBrand(bool is_at_startup, Profile* profile) { |
| 158 DCHECK(IsPartOfBrandTrialToEnable()); | 166 DCHECK(IsPartOfBrandTrialToEnable()); |
| 159 UMA_HISTOGRAM_ENUMERATION("SyncPromo.SignedInWithBrand", | 167 if (is_at_startup) { |
| 160 GetSyncPromoBrandUMABucketFromGroup(), | 168 DCHECK(SyncPromoUI::HasShownPromoAtStartup(profile)); |
| 161 SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); | 169 UMA_HISTOGRAM_ENUMERATION("SyncPromo.SignedInWithBrandAtStartup", |
| 170 GetSyncPromoBrandUMABucketFromGroup(), |
| 171 SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); |
| 172 } else { |
| 173 UMA_HISTOGRAM_ENUMERATION("SyncPromo.SignedInWithBrand", |
| 174 GetSyncPromoBrandUMABucketFromGroup(), |
| 175 SYNC_PROMO_AND_DEFAULT_APPS_BOUNDARY); |
| 176 } |
| 162 } | 177 } |
| 163 | 178 |
| 164 bool ShouldShowAtStartupBasedOnBrand() { | 179 bool ShouldShowAtStartupBasedOnBrand() { |
| 165 DCHECK(IsPartOfBrandTrialToEnable()); | 180 DCHECK(IsPartOfBrandTrialToEnable()); |
| 166 std::string name = | 181 std::string name = |
| 167 base::FieldTrialList::Find(kSyncPromoEnabledTrialName)->group_name(); | 182 base::FieldTrialList::Find(kSyncPromoEnabledTrialName)->group_name(); |
| 168 return name == kSyncPromoEnabledWithApps || | 183 return name == kSyncPromoEnabledWithApps || |
| 169 name == kSyncPromoEnabledWithoutApps; | 184 name == kSyncPromoEnabledWithoutApps; |
| 170 } | 185 } |
| 171 | 186 |
| 172 } // namespace sync_promo_trial | 187 } // namespace sync_promo_trial |
| OLD | NEW |