Chromium Code Reviews| 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/gtest_prod_util.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 | 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 | |
| 21 namespace media_router { | 11 namespace media_router { |
| 22 | 12 |
| 23 // NOTE: Do not renumber enums as that would confuse interpretation of | 13 // NOTE: Do not renumber enums as that would confuse interpretation of |
| 24 // previously logged data. When making changes, also update the enum list | 14 // previously logged data. When making changes, also update the enum list |
| 25 // in tools/metrics/histograms/histograms.xml to keep it in sync. | 15 // in tools/metrics/histograms/histograms.xml to keep it in sync. |
| 26 | 16 |
| 17 // NOTE: For metrics specific to the Media Router component, see | |
|
Wez
2016/03/29 00:16:16
Do you mean "Media Router component extension"?
| |
| 18 // mojo/media_router_mojo_metrics.h. | |
| 19 | |
| 27 // Where the user clicked to open the Media Router dialog. | 20 // Where the user clicked to open the Media Router dialog. |
| 28 enum class MediaRouterDialogOpenOrigin { | 21 enum class MediaRouterDialogOpenOrigin { |
| 29 TOOLBAR = 0, | 22 TOOLBAR = 0, |
| 30 OVERFLOW_MENU = 1, | 23 OVERFLOW_MENU = 1, |
| 31 CONTEXTUAL_MENU = 2, | 24 CONTEXTUAL_MENU = 2, |
| 32 PAGE = 3, | 25 PAGE = 3, |
| 33 | 26 |
| 34 // NOTE: Add entries only immediately above this line. | 27 // NOTE: Add entries only immediately above this line. |
| 35 TOTAL_COUNT = 4 | 28 TOTAL_COUNT = 4 |
| 36 }; | 29 }; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 51 CHANGE_MODE = 0, | 44 CHANGE_MODE = 0, |
| 52 START_LOCAL = 1, | 45 START_LOCAL = 1, |
| 53 STOP_LOCAL = 2, | 46 STOP_LOCAL = 2, |
| 54 CLOSE = 3, | 47 CLOSE = 3, |
| 55 STATUS_REMOTE = 4, | 48 STATUS_REMOTE = 4, |
| 56 | 49 |
| 57 // Note: Add entries only immediately above this line. | 50 // Note: Add entries only immediately above this line. |
| 58 TOTAL_COUNT = 5 | 51 TOTAL_COUNT = 5 |
| 59 }; | 52 }; |
| 60 | 53 |
| 61 #if !defined(OS_ANDROID) | |
| 62 // Why the Media Route Provider process was woken up. | |
| 63 enum class MediaRouteProviderWakeReason { | |
| 64 CREATE_ROUTE = 0, | |
| 65 JOIN_ROUTE = 1, | |
| 66 TERMINATE_ROUTE = 2, | |
| 67 SEND_SESSION_MESSAGE = 3, | |
| 68 SEND_SESSION_BINARY_MESSAGE = 4, | |
| 69 DETACH_ROUTE = 5, | |
| 70 START_OBSERVING_MEDIA_SINKS = 6, | |
| 71 STOP_OBSERVING_MEDIA_SINKS = 7, | |
| 72 START_OBSERVING_MEDIA_ROUTES = 8, | |
| 73 STOP_OBSERVING_MEDIA_ROUTES = 9, | |
| 74 LISTEN_FOR_ROUTE_MESSAGES = 10, | |
| 75 STOP_LISTENING_FOR_ROUTE_MESSAGES = 11, | |
| 76 CONNECTION_ERROR = 12, | |
| 77 REGISTER_MEDIA_ROUTE_PROVIDER = 13, | |
| 78 CONNECT_ROUTE_BY_ROUTE_ID = 14, | |
| 79 | |
| 80 // NOTE: Add entries only immediately above this line. | |
| 81 TOTAL_COUNT = 15 | |
| 82 }; | |
| 83 | |
| 84 // The install status of the Media Router component extension. | |
| 85 enum class MediaRouteProviderVersion { | |
| 86 // Installed but version is invalid or cannot be determined. | |
| 87 UNKNOWN = 0, | |
| 88 // Installed and the extension version matches the browser version. | |
| 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, | |
| 96 // Note: Add entries only immediately above this line. | |
| 97 TOTAL_COUNT = 4 | |
| 98 }; | |
| 99 | |
| 100 // The outcome of an attempt to wake the Media Router component event page. | |
| 101 enum class MediaRouteProviderWakeup { | |
| 102 SUCCESS = 0, | |
| 103 ERROR_UNKNOWN = 1, | |
| 104 ERROR_TOO_MANY_RETRIES = 2, | |
| 105 // Note: Add entries only immediately above this line. | |
| 106 TOTAL_COUNT = 3 | |
| 107 }; | |
| 108 #endif // !defined(OS_ANDROID) | |
| 109 | |
| 110 class MediaRouterMetrics { | 54 class MediaRouterMetrics { |
| 111 public: | 55 public: |
| 112 // Records where the user clicked to open the Media Router dialog. | 56 // Records where the user clicked to open the Media Router dialog. |
| 113 static void RecordMediaRouterDialogOrigin( | 57 static void RecordMediaRouterDialogOrigin( |
| 114 MediaRouterDialogOpenOrigin origin); | 58 MediaRouterDialogOpenOrigin origin); |
| 115 | 59 |
| 116 // Records the duration it takes for the Media Router dialog to open and | 60 // Records the duration it takes for the Media Router dialog to open and |
| 117 // finish painting after a user clicks to open the dialog. | 61 // finish painting after a user clicks to open the dialog. |
| 118 static void RecordMediaRouterDialogPaint( | 62 static void RecordMediaRouterDialogPaint( |
| 119 const base::TimeDelta delta); | 63 const base::TimeDelta delta); |
| 120 | 64 |
| 121 // Records the duration it takes for the Media Router dialog to load its | 65 // Records the duration it takes for the Media Router dialog to load its |
| 122 // initial data after a user clicks to open the dialog. | 66 // initial data after a user clicks to open the dialog. |
| 123 static void RecordMediaRouterDialogLoaded( | 67 static void RecordMediaRouterDialogLoaded( |
| 124 const base::TimeDelta delta); | 68 const base::TimeDelta delta); |
| 125 | 69 |
| 126 // Records the first action the user took after the Media Router dialog | 70 // Records the first action the user took after the Media Router dialog |
| 127 // opened. | 71 // opened. |
| 128 static void RecordMediaRouterInitialUserAction( | 72 static void RecordMediaRouterInitialUserAction( |
| 129 MediaRouterUserAction action); | 73 MediaRouterUserAction action); |
| 130 | 74 |
| 131 // Records the outcome in a create route response. | 75 // Records the outcome in a create route response. |
| 132 static void RecordRouteCreationOutcome( | 76 static void RecordRouteCreationOutcome( |
| 133 MediaRouterRouteCreationOutcome outcome); | 77 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) | |
| 157 }; | 78 }; |
| 158 | 79 |
| 159 } // namespace media_router | 80 } // namespace media_router |
| 160 | 81 |
| 161 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ | 82 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ |
| OLD | NEW |