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

Side by Side Diff: chrome/browser/android/metrics/uma_bridge.cc

Issue 978653002: Upstream FirstRunActivity and friends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated logos Created 5 years, 9 months 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
OLDNEW
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
16 namespace {
Ilya Sherman 2015/03/10 23:59:30 nit: Please leave a blank line after this one.
aurimas (slooooooooow) 2015/03/11 18:49:23 Done
17 // When updating these values, remember to also update
18 // tools/histograms/histograms.xml.
19 enum MobileFreFinishState {
20 MOBILE_FRE_FINISH_STATE_SKIP_SIGN_IN = 0,
21 MOBILE_FRE_FINISH_STATE_SIGN_IN_SUCCESS = 1,
22 MOBILE_FRE_FINISH_STATE_SKIP_AFTER_FAIL = 2,
23 MOBILE_FRE_FINISH_STATE_BOUNDARY = 3
24 };
25
26 // When updating, remember to also update chrome/histograms.xml.
27 enum MobileFreSignInChoice {
28 MOBILE_FRE_SIGNIN_SETTINGS_DEFAULT_ACCOUNT = 0,
29 MOBILE_FRE_SIGNIN_SETTINGS_ANOTHER_ACCOUNT = 1,
30 MOBILE_FRE_SIGNIN_ACCEPT_DEFAULT_ACCOUNT = 2,
31 MOBILE_FRE_SIGNIN_ACCEPT_ANOTHER_ACCOUNT = 3,
32 MOBILE_FRE_SIGNIN_NO_THANKS = 4,
33 MOBILE_FRE_SIGNIN_COUNT = 5
34 };
35
36 static std::vector<int> GetAllFREFinishStates() {
37 std::vector<int> states;
38 for (int i = 0; i < MOBILE_FRE_FINISH_STATE_BOUNDARY; i++)
Ilya Sherman 2015/03/10 23:59:30 nit: ++i
aurimas (slooooooooow) 2015/03/11 18:49:23 Done
39 states.push_back(i);
40 return states;
41 }
Ilya Sherman 2015/03/10 23:59:30 nit: Please leave a blank line after this one.
aurimas (slooooooooow) 2015/03/11 18:49:23 Done
42 } // namespace
16 43
17 static void RecordMenuShow(JNIEnv*, jclass) { 44 static void RecordMenuShow(JNIEnv*, jclass) {
18 RecordAction(UserMetricsAction("MobileMenuShow")); 45 RecordAction(UserMetricsAction("MobileMenuShow"));
19 } 46 }
20 47
21 static void RecordUsingMenu(JNIEnv*, 48 static void RecordUsingMenu(JNIEnv*,
22 jclass, 49 jclass,
23 jboolean is_by_hw_button, 50 jboolean is_by_hw_button,
24 jboolean is_dragging) { 51 jboolean is_dragging) {
25 if (is_by_hw_button) { 52 if (is_by_hw_button) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 RecordAction(UserMetricsAction("DataReductionProxy_PromoDisplayed")); 99 RecordAction(UserMetricsAction("DataReductionProxy_PromoDisplayed"));
73 } 100 }
74 101
75 static void RecordDataReductionProxySettings( 102 static void RecordDataReductionProxySettings(
76 JNIEnv*, jclass, jint notification, jint boundary) { 103 JNIEnv*, jclass, jint notification, jint boundary) {
77 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.SettingsConversion", 104 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.SettingsConversion",
78 notification, 105 notification,
79 boundary); 106 boundary);
80 } 107 }
81 108
109 // First Run Experience
110 static void RecordFreSkipSignIn(JNIEnv*, jclass) {
111 UMA_HISTOGRAM_CUSTOM_ENUMERATION("MobileFre.FinishState",
Ilya Sherman 2015/03/10 23:59:30 Why CUSTOM_ENUMERATION, rather than just regular E
112 MOBILE_FRE_FINISH_STATE_SKIP_SIGN_IN,
113 // Note the third argument is only
114 // evaluated once, see macro
115 // definition for details.
116 GetAllFREFinishStates());
117 }
118
119 static void RecordFreSignInSuccessful(JNIEnv*, jclass) {
120 UMA_HISTOGRAM_CUSTOM_ENUMERATION("MobileFre.FinishState",
121 MOBILE_FRE_FINISH_STATE_SIGN_IN_SUCCESS,
122 GetAllFREFinishStates());
123 }
124
125 static void RecordFreSignInAttempted(JNIEnv*, jclass) {
126 UMA_HISTOGRAM_CUSTOM_ENUMERATION("MobileFre.FinishState",
127 MOBILE_FRE_FINISH_STATE_SKIP_AFTER_FAIL,
128 GetAllFREFinishStates());
129 }
130
131 // First Run Experience post M-37 (the old one above is temporarily kept to
132 // match the numbers during the upgrade).
133 static void RecordFreSignInShown(JNIEnv*, jclass) {
134 RecordAction(UserMetricsAction("MobileFre.SignInShown"));
135 }
136
137 static void RecordFreSignInAccepted(JNIEnv*,
138 jclass,
139 jboolean show_settings,
140 jboolean default_account) {
141 const MobileFreSignInChoice choice =
142 show_settings
143 ? (default_account ? MOBILE_FRE_SIGNIN_SETTINGS_DEFAULT_ACCOUNT
144 : MOBILE_FRE_SIGNIN_SETTINGS_ANOTHER_ACCOUNT)
145 : (default_account ? MOBILE_FRE_SIGNIN_ACCEPT_DEFAULT_ACCOUNT
146 : MOBILE_FRE_SIGNIN_ACCEPT_ANOTHER_ACCOUNT);
147 UMA_HISTOGRAM_ENUMERATION("MobileFre.SignInChoice", choice,
148 MOBILE_FRE_SIGNIN_COUNT);
149 }
150
151 static void RecordFreSignInDeclined(JNIEnv*, jclass) {
152 UMA_HISTOGRAM_ENUMERATION("MobileFre.SignInChoice",
153 MOBILE_FRE_SIGNIN_NO_THANKS,
154 MOBILE_FRE_SIGNIN_COUNT);
155 }
Ilya Sherman 2015/03/10 23:59:30 Would it make sense to use base/android/record_his
156
82 namespace chrome { 157 namespace chrome {
83 namespace android { 158 namespace android {
84 159
85 // Register native methods 160 // Register native methods
86 bool RegisterUmaBridge(JNIEnv* env) { 161 bool RegisterUmaBridge(JNIEnv* env) {
87 return RegisterNativesImpl(env); 162 return RegisterNativesImpl(env);
88 } 163 }
89 164
90 } // namespace android 165 } // namespace android
91 } // namespace chrome 166 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698