OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/android/metrics/uma_bridge.h" | 5 #include "chrome/browser/android/metrics/uma_bridge.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/public/browser/user_metrics.h" | 10 #include "content/public/browser/user_metrics.h" |
11 #include "jni/UmaBridge_jni.h" | 11 #include "jni/UmaBridge_jni.h" |
12 | 12 |
13 using base::UserMetricsAction; | 13 using base::UserMetricsAction; |
14 using content::RecordAction; | 14 using content::RecordAction; |
15 using content::RecordComputedAction; | 15 using content::RecordComputedAction; |
16 | 16 |
| 17 namespace { |
| 18 // When updating these values, remember to also update |
| 19 // tools/histograms/histograms.xml. |
| 20 enum MobileFreFinishState { |
| 21 MOBILE_FRE_FINISH_STATE_SKIP_SIGN_IN = 0, |
| 22 MOBILE_FRE_FINISH_STATE_SIGN_IN_SUCCESS = 1, |
| 23 MOBILE_FRE_FINISH_STATE_SKIP_AFTER_FAIL = 2, |
| 24 MOBILE_FRE_FINISH_STATE_BOUNDARY = 3 |
| 25 }; |
| 26 |
| 27 // When updating, remember to also update chrome/histograms.xml. |
| 28 enum MobileFreSignInChoice { |
| 29 MOBILE_FRE_SIGNIN_SETTINGS_DEFAULT_ACCOUNT = 0, |
| 30 MOBILE_FRE_SIGNIN_SETTINGS_ANOTHER_ACCOUNT = 1, |
| 31 MOBILE_FRE_SIGNIN_ACCEPT_DEFAULT_ACCOUNT = 2, |
| 32 MOBILE_FRE_SIGNIN_ACCEPT_ANOTHER_ACCOUNT = 3, |
| 33 MOBILE_FRE_SIGNIN_NO_THANKS = 4, |
| 34 MOBILE_FRE_SIGNIN_COUNT = 5 |
| 35 }; |
| 36 |
| 37 static std::vector<int> GetAllFREFinishStates() { |
| 38 std::vector<int> states; |
| 39 for (int i = 0; i < MOBILE_FRE_FINISH_STATE_BOUNDARY; i++) |
| 40 states.push_back(i); |
| 41 return states; |
| 42 } |
| 43 } // namespace |
| 44 |
17 static void RecordMenuShow(JNIEnv*, jclass) { | 45 static void RecordMenuShow(JNIEnv*, jclass) { |
18 RecordAction(UserMetricsAction("MobileMenuShow")); | 46 RecordAction(UserMetricsAction("MobileMenuShow")); |
19 } | 47 } |
20 | 48 |
21 static void RecordUsingMenu(JNIEnv*, | 49 static void RecordUsingMenu(JNIEnv*, |
22 jclass, | 50 jclass, |
23 jboolean is_by_hw_button, | 51 jboolean is_by_hw_button, |
24 jboolean is_dragging) { | 52 jboolean is_dragging) { |
25 if (is_by_hw_button) { | 53 if (is_by_hw_button) { |
26 if (is_dragging) { | 54 if (is_dragging) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 RecordAction(UserMetricsAction("DataReductionProxy_PromoDisplayed")); | 100 RecordAction(UserMetricsAction("DataReductionProxy_PromoDisplayed")); |
73 } | 101 } |
74 | 102 |
75 static void RecordDataReductionProxySettings( | 103 static void RecordDataReductionProxySettings( |
76 JNIEnv*, jclass, jint notification, jint boundary) { | 104 JNIEnv*, jclass, jint notification, jint boundary) { |
77 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.SettingsConversion", | 105 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.SettingsConversion", |
78 notification, | 106 notification, |
79 boundary); | 107 boundary); |
80 } | 108 } |
81 | 109 |
| 110 // First Run Experience |
| 111 static void RecordFreSkipSignIn(JNIEnv*, jclass) { |
| 112 UMA_HISTOGRAM_CUSTOM_ENUMERATION("MobileFre.FinishState", |
| 113 MOBILE_FRE_FINISH_STATE_SKIP_SIGN_IN, |
| 114 // Note the third argument is only |
| 115 // evaluated once, see macro |
| 116 // definition for details. |
| 117 GetAllFREFinishStates()); |
| 118 } |
| 119 |
| 120 static void RecordFreSignInSuccessful(JNIEnv*, jclass) { |
| 121 UMA_HISTOGRAM_CUSTOM_ENUMERATION("MobileFre.FinishState", |
| 122 MOBILE_FRE_FINISH_STATE_SIGN_IN_SUCCESS, |
| 123 GetAllFREFinishStates()); |
| 124 } |
| 125 |
| 126 static void RecordFreSignInAttempted(JNIEnv*, jclass) { |
| 127 UMA_HISTOGRAM_CUSTOM_ENUMERATION("MobileFre.FinishState", |
| 128 MOBILE_FRE_FINISH_STATE_SKIP_AFTER_FAIL, |
| 129 GetAllFREFinishStates()); |
| 130 } |
| 131 |
| 132 // First Run Experience post M-37 (the old one above is temporarily kept to |
| 133 // match the numbers during the upgrade). |
| 134 static void RecordFreSignInShown(JNIEnv*, jclass) { |
| 135 RecordAction(UserMetricsAction("MobileFre.SignInShown")); |
| 136 } |
| 137 |
| 138 static void RecordFreSignInAccepted(JNIEnv*, jclass, |
| 139 jboolean show_settings, |
| 140 jboolean default_account) { |
| 141 const MobileFreSignInChoice choice = |
| 142 show_settings |
| 143 ? (default_account |
| 144 ? MOBILE_FRE_SIGNIN_SETTINGS_DEFAULT_ACCOUNT |
| 145 : MOBILE_FRE_SIGNIN_SETTINGS_ANOTHER_ACCOUNT) |
| 146 : (default_account |
| 147 ? MOBILE_FRE_SIGNIN_ACCEPT_DEFAULT_ACCOUNT |
| 148 : MOBILE_FRE_SIGNIN_ACCEPT_ANOTHER_ACCOUNT); |
| 149 UMA_HISTOGRAM_ENUMERATION("MobileFre.SignInChoice", |
| 150 choice, |
| 151 MOBILE_FRE_SIGNIN_COUNT); |
| 152 } |
| 153 |
| 154 static void RecordFreSignInDeclined(JNIEnv*, jclass) { |
| 155 UMA_HISTOGRAM_ENUMERATION("MobileFre.SignInChoice", |
| 156 MOBILE_FRE_SIGNIN_NO_THANKS, |
| 157 MOBILE_FRE_SIGNIN_COUNT); |
| 158 } |
| 159 |
82 namespace chrome { | 160 namespace chrome { |
83 namespace android { | 161 namespace android { |
84 | 162 |
85 // Register native methods | 163 // Register native methods |
86 bool RegisterUmaBridge(JNIEnv* env) { | 164 bool RegisterUmaBridge(JNIEnv* env) { |
87 return RegisterNativesImpl(env); | 165 return RegisterNativesImpl(env); |
88 } | 166 } |
89 | 167 |
90 } // namespace android | 168 } // namespace android |
91 } // namespace chrome | 169 } // namespace chrome |
OLD | NEW |