Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Side by Side Diff: chrome/browser/media/router/media_router_metrics.h

Issue 1765143002: [Media Router] Add UMA histograms tracking component extension version/wakeups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to isherman@ comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 namespace extensions {
16 class Extension;
17 } // namespace extensions
18
10 namespace media_router { 19 namespace media_router {
11 20
12 // NOTE: Do not renumber enums as that would confuse interpretation of 21 // NOTE: Do not renumber enums as that would confuse interpretation of
13 // previously logged data. When making changes, also update the enum list 22 // previously logged data. When making changes, also update the enum list
14 // in tools/metrics/histograms/histograms.xml to keep it in sync. 23 // in tools/metrics/histograms/histograms.xml to keep it in sync.
15 24
16 // Where the user clicked to open the Media Router dialog. 25 // Where the user clicked to open the Media Router dialog.
17 enum class MediaRouterDialogOpenOrigin { 26 enum class MediaRouterDialogOpenOrigin {
18 TOOLBAR = 0, 27 TOOLBAR = 0,
19 OVERFLOW_MENU = 1, 28 OVERFLOW_MENU = 1,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 CHANGE_MODE = 0, 71 CHANGE_MODE = 0,
63 START_LOCAL = 1, 72 START_LOCAL = 1,
64 STOP_LOCAL = 2, 73 STOP_LOCAL = 2,
65 CLOSE = 3, 74 CLOSE = 3,
66 STATUS_REMOTE = 4, 75 STATUS_REMOTE = 4,
67 76
68 // Note: Add entries only immediately above this line. 77 // Note: Add entries only immediately above this line.
69 TOTAL_COUNT = 5 78 TOTAL_COUNT = 5
70 }; 79 };
71 80
81 // The install status of the Media Router component extension.
82 enum class MediaRouteProviderVersion {
83 // Installed but version is invalid or cannot be determined.
84 UNKNOWN = 0,
85 // Installed and the extension version matches the browser version.
86 SAME_VERSION_AS_CHROME = 1,
87 // Installed and the extension version is one version behind the browser
88 // version.
89 ONE_VERSION_BEHIND_CHROME = 2,
90 // Installed and the extension version is more than one version behind the
91 // browser version.
92 MULTIPLE_VERSIONS_BEHIND_CHROME = 3,
93 // Note: Add entries only immediately above this line.
94 TOTAL_COUNT = 4
95 };
96
97 // The outcome of an attempt to wake the Media Router component event page.
98 enum class MediaRouteProviderWakeup {
99 SUCCESS = 0,
100 ERROR_UNKNOWN = 1,
101 ERROR_TOO_MANY_RETRIES = 2,
102 // Note: Add entries only immediately above this line.
103 TOTAL_COUNT = 3
104 };
105
72 class MediaRouterMetrics { 106 class MediaRouterMetrics {
73 public: 107 public:
74 // Records where the user clicked to open the Media Router dialog. 108 // Records where the user clicked to open the Media Router dialog.
75 static void RecordMediaRouterDialogOrigin( 109 static void RecordMediaRouterDialogOrigin(
76 MediaRouterDialogOpenOrigin origin); 110 MediaRouterDialogOpenOrigin origin);
77 111
78 // Records why the media route provider extension was woken up. 112 // Records why the media route provider extension was woken up.
79 static void RecordMediaRouteProviderWakeReason( 113 static void RecordMediaRouteProviderWakeReason(
80 MediaRouteProviderWakeReason reason); 114 MediaRouteProviderWakeReason reason);
81 115
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 // Records the installed version of the Media Router component extension.
136 static void RecordMediaRouteProviderVersion(
137 const extensions::Extension& extension);
138
139 // Records the outcome of an attempt to wake the Media Router component event
140 // page.
141 static void RecordMediaRouteProviderWakeup(MediaRouteProviderWakeup wakeup);
142
143 private:
144 FRIEND_TEST_ALL_PREFIXES(MediaRouteProviderMetricsTest,
145 TestGetVersionDifference);
146
147 // Records the install status of the Media Router component extension.
148 static void RecordMediaRouteProviderVersion(
149 MediaRouteProviderVersion version);
150
151 // Returns the integer difference between the major versions of |first| and
152 // |second|, or std::numeric_limits<int>::min() if the difference cannot be
153 // determined.
154 static int GetVersionDifference(const base::Version& first,
155 const base::Version& second);
100 }; 156 };
101 157
102 } // namespace media_router 158 } // namespace media_router
103 159
104 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ 160 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698