OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media/android/remote/record_cast_action.h" | 5 #include "chrome/browser/media/android/remote/record_cast_action.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "content/public/browser/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
11 #include "jni/RecordCastAction_jni.h" | 11 #include "jni/RecordCastAction_jni.h" |
12 #include "media/base/container_names.h" | 12 #include "media/base/container_names.h" |
13 | 13 |
14 using base::UserMetricsAction; | |
15 using base::android::JavaParamRef; | 14 using base::android::JavaParamRef; |
16 using content::RecordAction; | |
17 | 15 |
18 namespace { | 16 namespace { |
19 | 17 |
20 // When updating these values, remember to also update | 18 // When updating these values, remember to also update |
21 // tools/histograms/histograms.xml. | 19 // tools/histograms/histograms.xml. |
22 enum CastPlayBackState { | 20 enum CastPlayBackState { |
23 YT_PLAYER_SUCCESS = 0, | 21 YT_PLAYER_SUCCESS = 0, |
24 YT_PLAYER_FAILURE = 1, | 22 YT_PLAYER_FAILURE = 1, |
25 DEFAULT_PLAYER_SUCCESS = 2, | 23 DEFAULT_PLAYER_SUCCESS = 2, |
26 DEFAULT_PLAYER_FAILURE = 3, | 24 DEFAULT_PLAYER_FAILURE = 3, |
(...skipping 18 matching lines...) Expand all Loading... |
45 | 43 |
46 namespace remote_media { | 44 namespace remote_media { |
47 static void RecordRemotePlaybackDeviceSelected(JNIEnv*, | 45 static void RecordRemotePlaybackDeviceSelected(JNIEnv*, |
48 const JavaParamRef<jclass>&, | 46 const JavaParamRef<jclass>&, |
49 jint device_type) { | 47 jint device_type) { |
50 UMA_HISTOGRAM_ENUMERATION( | 48 UMA_HISTOGRAM_ENUMERATION( |
51 "Cast.Sender.DeviceType", device_type, REMOTE_PLAYBACK_DEVICE_TYPE_COUNT); | 49 "Cast.Sender.DeviceType", device_type, REMOTE_PLAYBACK_DEVICE_TYPE_COUNT); |
52 } | 50 } |
53 | 51 |
54 static void RecordCastPlayRequested(JNIEnv*, const JavaParamRef<jclass>&) { | 52 static void RecordCastPlayRequested(JNIEnv*, const JavaParamRef<jclass>&) { |
55 RecordAction(UserMetricsAction("Cast_Sender_CastPlayRequested")); | 53 base::RecordAction(base::UserMetricsAction("Cast_Sender_CastPlayRequested")); |
56 } | 54 } |
57 | 55 |
58 static void RecordCastDefaultPlayerResult(JNIEnv*, | 56 static void RecordCastDefaultPlayerResult(JNIEnv*, |
59 const JavaParamRef<jclass>&, | 57 const JavaParamRef<jclass>&, |
60 jboolean cast_success) { | 58 jboolean cast_success) { |
61 if (cast_success) { | 59 if (cast_success) { |
62 UMA_HISTOGRAM_ENUMERATION("Cast.Sender.CastPlayerResult", | 60 UMA_HISTOGRAM_ENUMERATION("Cast.Sender.CastPlayerResult", |
63 DEFAULT_PLAYER_SUCCESS, | 61 DEFAULT_PLAYER_SUCCESS, |
64 CAST_PLAYBACK_STATE_COUNT); | 62 CAST_PLAYBACK_STATE_COUNT); |
65 } else { | 63 } else { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 UMA_HISTOGRAM_ENUMERATION("Cast.Sender.CastTimeRemainingPercentage", | 101 UMA_HISTOGRAM_ENUMERATION("Cast.Sender.CastTimeRemainingPercentage", |
104 percent_remaining, 101); | 102 percent_remaining, 101); |
105 } | 103 } |
106 | 104 |
107 // Register native methods | 105 // Register native methods |
108 bool RegisterRecordCastAction(JNIEnv* env) { | 106 bool RegisterRecordCastAction(JNIEnv* env) { |
109 return RegisterNativesImpl(env); | 107 return RegisterNativesImpl(env); |
110 } | 108 } |
111 | 109 |
112 } // namespace remote_media | 110 } // namespace remote_media |
OLD | NEW |