OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/android/uma_bridge.h" | |
6 | |
7 #include <jni.h> | |
8 | |
9 #include "base/metrics/histogram.h" | |
10 #include "content/public/browser/user_metrics.h" | |
11 #include "jni/UmaBridge_jni.h" | |
12 | |
13 using base::UserMetricsAction; | |
14 using content::RecordAction; | |
15 using content::RecordComputedAction; | |
16 | |
17 static void RecordMenuShow(JNIEnv*, jclass) { | |
18 RecordAction(UserMetricsAction("MobileMenuShow")); | |
19 } | |
20 | |
21 static void RecordUsingMenu(JNIEnv*, | |
22 jclass, | |
23 jboolean is_by_hw_button, | |
24 jboolean is_dragging) { | |
25 if (is_by_hw_button) { | |
26 if (is_dragging) { | |
27 NOTREACHED() << "We do not support dragging for hardware menu button."; | |
28 } else { | |
29 RecordAction(UserMetricsAction("MobileUsingMenuByHwButtonTap")); | |
30 } | |
31 } else { | |
32 if (is_dragging) { | |
33 RecordAction(UserMetricsAction("MobileUsingMenuBySwButtonDragging")); | |
34 } else { | |
35 RecordAction(UserMetricsAction("MobileUsingMenuBySwButtonTap")); | |
36 } | |
37 } | |
38 } | |
39 | |
40 // Android Beam | |
41 | |
42 static void RecordBeamCallbackSuccess(JNIEnv*, jclass) { | |
43 RecordAction(UserMetricsAction("MobileBeamCallbackSuccess")); | |
44 } | |
45 | |
46 static void RecordBeamInvalidAppState(JNIEnv*, jclass) { | |
47 RecordAction(UserMetricsAction("MobileBeamInvalidAppState")); | |
48 } | |
49 | |
50 // Data Saver | |
51 | |
52 static void RecordDataReductionProxyTurnedOn(JNIEnv*, jclass) { | |
53 RecordAction(UserMetricsAction("DataReductionProxy_TurnedOn")); | |
54 } | |
55 | |
56 static void RecordDataReductionProxyTurnedOff(JNIEnv*, jclass) { | |
57 RecordAction(UserMetricsAction("DataReductionProxy_TurnedOff")); | |
58 } | |
59 | |
60 static void RecordDataReductionProxyTurnedOnFromPromo(JNIEnv*, jclass) { | |
61 RecordAction(UserMetricsAction("DataReductionProxy_TurnedOnFromPromo")); | |
62 } | |
63 | |
64 static void RecordDataReductionProxyPromoAction( | |
65 JNIEnv*, jclass, jint action, jint boundary) { | |
66 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.PromoAction", | |
67 action, | |
68 boundary); | |
69 } | |
70 | |
71 static void RecordDataReductionProxyPromoDisplayed(JNIEnv*, jclass) { | |
72 RecordAction(UserMetricsAction("DataReductionProxy_PromoDisplayed")); | |
73 } | |
74 | |
75 static void RecordDataReductionProxySettings( | |
76 JNIEnv*, jclass, jint notification, jint boundary) { | |
77 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.SettingsConversion", | |
78 notification, | |
79 boundary); | |
80 } | |
81 | |
82 namespace chrome { | |
83 namespace android { | |
84 | |
85 // Register native methods | |
86 bool RegisterUmaBridge(JNIEnv* env) { | |
87 return RegisterNativesImpl(env); | |
88 } | |
89 | |
90 } // namespace android | |
91 } // namespace chrome | |
OLD | NEW |