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

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

Issue 2916163002: [MediaRouter] Record DIAL device counts in DialMediaSinkServiceImpl (Closed)
Patch Set: resolve code review comments from Mark Created 3 years, 6 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 <memory>
9
8 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/time/clock.h"
9 #include "base/time/time.h" 12 #include "base/time/time.h"
10 13
11 namespace media_router { 14 namespace media_router {
12 15
13 // NOTE: Do not renumber enums as that would confuse interpretation of 16 // NOTE: Do not renumber enums as that would confuse interpretation of
14 // previously logged data. When making changes, also update the enum list 17 // previously logged data. When making changes, also update the enum list
15 // in tools/metrics/histograms/histograms.xml to keep it in sync. 18 // in tools/metrics/histograms/histograms.xml to keep it in sync.
16 19
17 // NOTE: For metrics specific to the Media Router component extension, see 20 // NOTE: For metrics specific to the Media Router component extension, see
18 // mojo/media_router_mojo_metrics.h. 21 // mojo/media_router_mojo_metrics.h.
(...skipping 28 matching lines...) Expand all
47 CLOSE = 3, 50 CLOSE = 3,
48 STATUS_REMOTE = 4, 51 STATUS_REMOTE = 4,
49 REPLACE_LOCAL_ROUTE = 5, 52 REPLACE_LOCAL_ROUTE = 5,
50 53
51 // Note: Add entries only immediately above this line. 54 // Note: Add entries only immediately above this line.
52 TOTAL_COUNT = 6 55 TOTAL_COUNT = 6
53 }; 56 };
54 57
55 class MediaRouterMetrics { 58 class MediaRouterMetrics {
56 public: 59 public:
60 MediaRouterMetrics();
61 ~MediaRouterMetrics();
62
57 // UMA histogram names. 63 // UMA histogram names.
64 static const char kHistogramDialAvailableDeviceCount[];
65 static const char kHistogramDialKnownDeviceCount[];
58 static const char kHistogramIconClickLocation[]; 66 static const char kHistogramIconClickLocation[];
59 static const char kHistogramUiDialogPaint[]; 67 static const char kHistogramUiDialogPaint[];
60 static const char kHistogramUiDialogLoadedWithData[]; 68 static const char kHistogramUiDialogLoadedWithData[];
61 static const char kHistogramUiFirstAction[]; 69 static const char kHistogramUiFirstAction[];
62 static const char kHistogramRouteCreationOutcome[]; 70 static const char kHistogramRouteCreationOutcome[];
63 71
64 // Records where the user clicked to open the Media Router dialog. 72 // Records where the user clicked to open the Media Router dialog.
65 static void RecordMediaRouterDialogOrigin( 73 static void RecordMediaRouterDialogOrigin(
66 MediaRouterDialogOpenOrigin origin); 74 MediaRouterDialogOpenOrigin origin);
67 75
68 // Records the duration it takes for the Media Router dialog to open and 76 // Records the duration it takes for the Media Router dialog to open and
69 // finish painting after a user clicks to open the dialog. 77 // finish painting after a user clicks to open the dialog.
70 static void RecordMediaRouterDialogPaint( 78 static void RecordMediaRouterDialogPaint(
71 const base::TimeDelta delta); 79 const base::TimeDelta delta);
72 80
73 // Records the duration it takes for the Media Router dialog to load its 81 // Records the duration it takes for the Media Router dialog to load its
74 // initial data after a user clicks to open the dialog. 82 // initial data after a user clicks to open the dialog.
75 static void RecordMediaRouterDialogLoaded( 83 static void RecordMediaRouterDialogLoaded(
76 const base::TimeDelta delta); 84 const base::TimeDelta delta);
77 85
78 // Records the first action the user took after the Media Router dialog 86 // Records the first action the user took after the Media Router dialog
79 // opened. 87 // opened.
80 static void RecordMediaRouterInitialUserAction( 88 static void RecordMediaRouterInitialUserAction(
81 MediaRouterUserAction action); 89 MediaRouterUserAction action);
82 90
83 // Records the outcome in a create route response. 91 // Records the outcome in a create route response.
84 static void RecordRouteCreationOutcome( 92 static void RecordRouteCreationOutcome(
85 MediaRouterRouteCreationOutcome outcome); 93 MediaRouterRouteCreationOutcome outcome);
94
95 // Records device counts.
96 // TODO(zhaobin): Move device count specific metrics and state into its own
97 // class eventually.
98 void RecordDialDeviceCounts(size_t available_device_count,
99 size_t known_device_count);
100
101 // Allows tests to swap in a fake clock.
102 void SetClockForTest(std::unique_ptr<base::Clock> clock);
103
104 private:
105 base::Time device_count_metrics_record_time_;
106
107 std::unique_ptr<base::Clock> clock_;
86 }; 108 };
87 109
88 } // namespace media_router 110 } // namespace media_router
89 111
90 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ 112 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698