| 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 27 matching lines...) Expand all Loading... |
| 99 }; | 62 }; |
| 100 | 63 |
| 101 // The outcome of an attempt to wake the Media Router component event page. | 64 // The outcome of an attempt to wake the Media Router component event page. |
| 102 enum class MediaRouteProviderWakeup { | 65 enum class MediaRouteProviderWakeup { |
| 103 SUCCESS = 0, | 66 SUCCESS = 0, |
| 104 ERROR_UNKNOWN = 1, | 67 ERROR_UNKNOWN = 1, |
| 105 ERROR_TOO_MANY_RETRIES = 2, | 68 ERROR_TOO_MANY_RETRIES = 2, |
| 106 // Note: Add entries only immediately above this line. | 69 // Note: Add entries only immediately above this line. |
| 107 TOTAL_COUNT = 3 | 70 TOTAL_COUNT = 3 |
| 108 }; | 71 }; |
| 109 #endif // !defined(OS_ANDROID) | |
| 110 | 72 |
| 111 class MediaRouterMetrics { | 73 class MediaRouterMojoMetrics { |
| 112 public: | 74 public: |
| 113 // Records where the user clicked to open the Media Router dialog. | |
| 114 static void RecordMediaRouterDialogOrigin( | |
| 115 MediaRouterDialogOpenOrigin origin); | |
| 116 | |
| 117 // Records the duration it takes for the Media Router dialog to open and | |
| 118 // finish painting after a user clicks to open the dialog. | |
| 119 static void RecordMediaRouterDialogPaint( | |
| 120 const base::TimeDelta delta); | |
| 121 | |
| 122 // Records the duration it takes for the Media Router dialog to load its | |
| 123 // initial data after a user clicks to open the dialog. | |
| 124 static void RecordMediaRouterDialogLoaded( | |
| 125 const base::TimeDelta delta); | |
| 126 | |
| 127 // Records the first action the user took after the Media Router dialog | |
| 128 // opened. | |
| 129 static void RecordMediaRouterInitialUserAction( | |
| 130 MediaRouterUserAction action); | |
| 131 | |
| 132 // Records the outcome in a create route response. | |
| 133 static void RecordRouteCreationOutcome( | |
| 134 MediaRouterRouteCreationOutcome outcome); | |
| 135 | |
| 136 #if !defined(OS_ANDROID) | |
| 137 // Records the installed version of the Media Router component extension. | 75 // Records the installed version of the Media Router component extension. |
| 138 static void RecordMediaRouteProviderVersion( | 76 static void RecordMediaRouteProviderVersion( |
| 139 const extensions::Extension& extension); | 77 const extensions::Extension& extension); |
| 140 | 78 |
| 141 // Records why the media route provider extension was woken up. | 79 // Records why the media route provider extension was woken up. |
| 142 static void RecordMediaRouteProviderWakeReason( | 80 static void RecordMediaRouteProviderWakeReason( |
| 143 MediaRouteProviderWakeReason reason); | 81 MediaRouteProviderWakeReason reason); |
| 144 | 82 |
| 145 // Records the outcome of an attempt to wake the Media Router component event | 83 // Records the outcome of an attempt to wake the Media Router component event |
| 146 // page. | 84 // page. |
| 147 static void RecordMediaRouteProviderWakeup(MediaRouteProviderWakeup wakeup); | 85 static void RecordMediaRouteProviderWakeup(MediaRouteProviderWakeup wakeup); |
| 148 | 86 |
| 149 private: | 87 private: |
| 150 FRIEND_TEST_ALL_PREFIXES(MediaRouteProviderMetricsTest, | 88 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoMetricsTest, |
| 151 TestGetMediaRouteProviderVersion); | 89 TestGetMediaRouteProviderVersion); |
| 152 | 90 |
| 153 // Returns the version status of the Media Router component extension. | 91 // Returns the version status of the Media Router component extension. |
| 154 static MediaRouteProviderVersion GetMediaRouteProviderVersion( | 92 static MediaRouteProviderVersion GetMediaRouteProviderVersion( |
| 155 const base::Version& extension_version, | 93 const base::Version& extension_version, |
| 156 const base::Version& browser_version); | 94 const base::Version& browser_version); |
| 157 #endif // !defined(OS_ANDROID) | |
| 158 }; | 95 }; |
| 159 | 96 |
| 160 } // namespace media_router | 97 } // namespace media_router |
| 161 | 98 |
| 162 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ | 99 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_METRICS_H_ |
| OLD | NEW |