OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.h" | 5 #import "ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 pref_service_->GetInteger(prefs::kDesktopIOSPromotionSMSEntryPoint); | 68 pref_service_->GetInteger(prefs::kDesktopIOSPromotionSMSEntryPoint); |
69 int shown_entrypoints = | 69 int shown_entrypoints = |
70 pref_service_->GetInteger(prefs::kDesktopIOSPromotionShownEntryPoints); | 70 pref_service_->GetInteger(prefs::kDesktopIOSPromotionShownEntryPoints); |
71 | 71 |
72 // Entry points are represented on the preference by integers [1..4]. | 72 // Entry points are represented on the preference by integers [1..4]. |
73 // Entry points constants are defined on: | 73 // Entry points constants are defined on: |
74 // chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h | 74 // chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h |
75 int entrypoint_prefixes_count = | 75 int entrypoint_prefixes_count = |
76 arraysize(kDesktopIOSPromotionEntrypointHistogramPrefix); | 76 arraysize(kDesktopIOSPromotionEntrypointHistogramPrefix); |
77 for (int i = 1; i < entrypoint_prefixes_count + 1; i++) { | 77 for (int i = 1; i < entrypoint_prefixes_count + 1; i++) { |
78 if (sms_entrypoint == i) { | 78 if (sms_entrypoint == i) { |
rkaplow
2017/03/29 18:02:51
linear looks like the wrong model here as this is
dcheng
2017/03/29 18:24:40
To elaborate, are you saying that exact linear is
Mark P
2017/03/29 19:03:36
drive-by: it's not obsolete. Instead, this featur
rkaplow
2017/03/29 23:21:17
I guess this is ok since it would be strange to ha
Mark P
2017/03/29 23:36:33
That would be overkill, especially because it woul
dcheng
2017/03/30 00:41:58
I added a comment... hopefully it makes sense.
| |
79 UMA_HISTOGRAM_ENUMERATION("DesktopIOSPromotion.SMSSent.IOSSigninReason", | 79 UMA_HISTOGRAM_EXACT_LINEAR("DesktopIOSPromotion.SMSSent.IOSSigninReason", |
80 i, entrypoint_prefixes_count + 1); | 80 i, entrypoint_prefixes_count + 1); |
81 // If the time delta is negative due to client bad clock we log 0 instead. | 81 // If the time delta is negative due to client bad clock we log 0 instead. |
82 base::Histogram::FactoryGet( | 82 base::Histogram::FactoryGet( |
83 base::StringPrintf( | 83 base::StringPrintf( |
84 "DesktopIOSPromotion.%s.SMSToSigninTime", | 84 "DesktopIOSPromotion.%s.SMSToSigninTime", |
85 kDesktopIOSPromotionEntrypointHistogramPrefix[i - 1]), | 85 kDesktopIOSPromotionEntrypointHistogramPrefix[i - 1]), |
86 1, 168, 24, base::Histogram::kUmaTargetedHistogramFlag) | 86 1, 168, 24, base::Histogram::kUmaTargetedHistogramFlag) |
87 ->Add(std::max(0, delta.InHours())); | 87 ->Add(std::max(0, delta.InHours())); |
88 } else { | 88 } else { |
89 // If the user saw this promotion type, log that it could be a reason | 89 // If the user saw this promotion type, log that it could be a reason |
90 // for the signin. | 90 // for the signin. |
91 if ((1 << i) & shown_entrypoints) | 91 if ((1 << i) & shown_entrypoints) |
92 UMA_HISTOGRAM_ENUMERATION("DesktopIOSPromotion.NoSMS.IOSSigninReason", | 92 UMA_HISTOGRAM_EXACT_LINEAR("DesktopIOSPromotion.NoSMS.IOSSigninReason", |
93 i, entrypoint_prefixes_count + 1); | 93 i, entrypoint_prefixes_count + 1); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 // Check the variation id preference, if it's set then log to UMA that the | 97 // Check the variation id preference, if it's set then log to UMA that the |
98 // user has seen this promotion variation on desktop. | 98 // user has seen this promotion variation on desktop. |
99 int promo_variation_id = | 99 int promo_variation_id = |
100 pref_service_->GetInteger(prefs::kDesktopIOSPromotionVariationId); | 100 pref_service_->GetInteger(prefs::kDesktopIOSPromotionVariationId); |
101 if (promo_variation_id != 0) { | 101 if (promo_variation_id != 0) { |
102 if (sms_entrypoint != 0) { | 102 if (sms_entrypoint != 0) { |
103 UMA_HISTOGRAM_SPARSE_SLOWLY( | 103 UMA_HISTOGRAM_SPARSE_SLOWLY( |
104 "DesktopIOSPromotion.SMSSent.VariationSigninReason", | 104 "DesktopIOSPromotion.SMSSent.VariationSigninReason", |
105 promo_variation_id); | 105 promo_variation_id); |
106 } else { | 106 } else { |
107 UMA_HISTOGRAM_SPARSE_SLOWLY( | 107 UMA_HISTOGRAM_SPARSE_SLOWLY( |
108 "DesktopIOSPromotion.NoSMS.VariationSigninReason", | 108 "DesktopIOSPromotion.NoSMS.VariationSigninReason", |
109 promo_variation_id); | 109 promo_variation_id); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 pref_service_->SetBoolean(prefs::kDesktopIOSPromotionDone, true); | 113 pref_service_->SetBoolean(prefs::kDesktopIOSPromotionDone, true); |
114 sync_service_->RemoveObserver(this); | 114 sync_service_->RemoveObserver(this); |
115 } | 115 } |
OLD | NEW |