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