| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_METRICS_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_METRICS_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 class Version; | 12 class Version; |
| 13 } // namespace base | 13 } // namespace base |
| 14 | 14 |
| 15 #if !defined(OS_ANDROID) | |
| 16 namespace extensions { | 15 namespace extensions { |
| 17 class Extension; | 16 class Extension; |
| 18 } // namespace extensions | 17 } // namespace extensions |
| 19 #endif // !defined(OS_ANDROID) | |
| 20 | 18 |
| 21 namespace media_router { | 19 namespace media_router { |
| 22 | 20 |
| 23 // NOTE: Do not renumber enums as that would confuse interpretation of | 21 // NOTE: Do not renumber enums as that would confuse interpretation of |
| 24 // previously logged data. When making changes, also update the enum list | 22 // previously logged data. When making changes, also update the enum list |
| 25 // in tools/metrics/histograms/histograms.xml to keep it in sync. | 23 // in tools/metrics/histograms/histograms.xml to keep it in sync. |
| 26 | 24 |
| 27 // Where the user clicked to open the Media Router dialog. | |
| 28 enum class MediaRouterDialogOpenOrigin { | |
| 29 TOOLBAR = 0, | |
| 30 OVERFLOW_MENU = 1, | |
| 31 CONTEXTUAL_MENU = 2, | |
| 32 PAGE = 3, | |
| 33 | |
| 34 // NOTE: Add entries only immediately above this line. | |
| 35 TOTAL_COUNT = 4 | |
| 36 }; | |
| 37 | |
| 38 // The possible outcomes from a route creation response. | |
| 39 enum class MediaRouterRouteCreationOutcome { | |
| 40 SUCCESS = 0, | |
| 41 FAILURE_NO_ROUTE = 1, | |
| 42 FAILURE_INVALID_SINK = 2, | |
| 43 | |
| 44 // Note: Add entries only immediately above this line. | |
| 45 TOTAL_COUNT = 3, | |
| 46 }; | |
| 47 | |
| 48 // The possible actions a user can take while interacting with the Media Router | |
| 49 // dialog. | |
| 50 enum class MediaRouterUserAction { | |
| 51 CHANGE_MODE = 0, | |
| 52 START_LOCAL = 1, | |
| 53 STOP_LOCAL = 2, | |
| 54 CLOSE = 3, | |
| 55 STATUS_REMOTE = 4, | |
| 56 | |
| 57 // Note: Add entries only immediately above this line. | |
| 58 TOTAL_COUNT = 5 | |
| 59 }; | |
| 60 | |
| 61 #if !defined(OS_ANDROID) | |
| 62 // Why the Media Route Provider process was woken up. | 25 // Why the Media Route Provider process was woken up. |
| 63 enum class MediaRouteProviderWakeReason { | 26 enum class MediaRouteProviderWakeReason { |
| 64 CREATE_ROUTE = 0, | 27 CREATE_ROUTE = 0, |
| 65 JOIN_ROUTE = 1, | 28 JOIN_ROUTE = 1, |
| 66 TERMINATE_ROUTE = 2, | 29 TERMINATE_ROUTE = 2, |
| 67 SEND_SESSION_MESSAGE = 3, | 30 SEND_SESSION_MESSAGE = 3, |
| 68 SEND_SESSION_BINARY_MESSAGE = 4, | 31 SEND_SESSION_BINARY_MESSAGE = 4, |
| 69 DETACH_ROUTE = 5, | 32 DETACH_ROUTE = 5, |
| 70 START_OBSERVING_MEDIA_SINKS = 6, | 33 START_OBSERVING_MEDIA_SINKS = 6, |
| 71 STOP_OBSERVING_MEDIA_SINKS = 7, | 34 STOP_OBSERVING_MEDIA_SINKS = 7, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 }; | 61 }; |
| 99 | 62 |
| 100 // The outcome of an attempt to wake the Media Router component event page. | 63 // The outcome of an attempt to wake the Media Router component event page. |
| 101 enum class MediaRouteProviderWakeup { | 64 enum class MediaRouteProviderWakeup { |
| 102 SUCCESS = 0, | 65 SUCCESS = 0, |
| 103 ERROR_UNKNOWN = 1, | 66 ERROR_UNKNOWN = 1, |
| 104 ERROR_TOO_MANY_RETRIES = 2, | 67 ERROR_TOO_MANY_RETRIES = 2, |
| 105 // Note: Add entries only immediately above this line. | 68 // Note: Add entries only immediately above this line. |
| 106 TOTAL_COUNT = 3 | 69 TOTAL_COUNT = 3 |
| 107 }; | 70 }; |
| 108 #endif // !defined(OS_ANDROID) | |
| 109 | 71 |
| 110 class MediaRouterMetrics { | 72 class MediaRouterMojoMetrics { |
| 111 public: | 73 public: |
| 112 // Records where the user clicked to open the Media Router dialog. | |
| 113 static void RecordMediaRouterDialogOrigin( | |
| 114 MediaRouterDialogOpenOrigin origin); | |
| 115 | |
| 116 // Records the duration it takes for the Media Router dialog to open and | |
| 117 // finish painting after a user clicks to open the dialog. | |
| 118 static void RecordMediaRouterDialogPaint( | |
| 119 const base::TimeDelta delta); | |
| 120 | |
| 121 // Records the duration it takes for the Media Router dialog to load its | |
| 122 // initial data after a user clicks to open the dialog. | |
| 123 static void RecordMediaRouterDialogLoaded( | |
| 124 const base::TimeDelta delta); | |
| 125 | |
| 126 // Records the first action the user took after the Media Router dialog | |
| 127 // opened. | |
| 128 static void RecordMediaRouterInitialUserAction( | |
| 129 MediaRouterUserAction action); | |
| 130 | |
| 131 // Records the outcome in a create route response. | |
| 132 static void RecordRouteCreationOutcome( | |
| 133 MediaRouterRouteCreationOutcome outcome); | |
| 134 | |
| 135 #if !defined(OS_ANDROID) | |
| 136 // Records the installed version of the Media Router component extension. | 74 // Records the installed version of the Media Router component extension. |
| 137 static void RecordMediaRouteProviderVersion( | 75 static void RecordMediaRouteProviderVersion( |
| 138 const extensions::Extension& extension); | 76 const extensions::Extension& extension); |
| 139 | 77 |
| 140 // Records why the media route provider extension was woken up. | 78 // Records why the media route provider extension was woken up. |
| 141 static void RecordMediaRouteProviderWakeReason( | 79 static void RecordMediaRouteProviderWakeReason( |
| 142 MediaRouteProviderWakeReason reason); | 80 MediaRouteProviderWakeReason reason); |
| 143 | 81 |
| 144 // Records the outcome of an attempt to wake the Media Router component event | 82 // Records the outcome of an attempt to wake the Media Router component event |
| 145 // page. | 83 // page. |
| 146 static void RecordMediaRouteProviderWakeup(MediaRouteProviderWakeup wakeup); | 84 static void RecordMediaRouteProviderWakeup(MediaRouteProviderWakeup wakeup); |
| 147 | 85 |
| 148 private: | 86 private: |
| 149 FRIEND_TEST_ALL_PREFIXES(MediaRouteProviderMetricsTest, | 87 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoMetricsTest, |
| 150 TestGetMediaRouteProviderVersion); | 88 TestGetMediaRouteProviderVersion); |
| 151 | 89 |
| 152 // Returns the version status of the Media Router component extension. | 90 // Returns the version status of the Media Router component extension. |
| 153 static MediaRouteProviderVersion GetMediaRouteProviderVersion( | 91 static MediaRouteProviderVersion GetMediaRouteProviderVersion( |
| 154 const base::Version& extension_version, | 92 const base::Version& extension_version, |
| 155 const base::Version& browser_version); | 93 const base::Version& browser_version); |
| 156 #endif // !defined(OS_ANDROID) | |
| 157 }; | 94 }; |
| 158 | 95 |
| 159 } // namespace media_router | 96 } // namespace media_router |
| 160 | 97 |
| 161 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ | 98 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_METRICS_H_ |
| OLD | NEW |