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 <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 Loading... | |
| 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 kDialAvailableDeviceCount[]; | |
|
mark a. foltz
2017/06/06 23:45:00
kHistogramDialAvailableDeviceCount (and similarly
zhaobin
2017/06/07 02:05:59
Done.
| |
| 65 static const char kDialKnownDeviceCount[]; | |
| 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 void RecordDialDeviceCounts(size_t available_device_count, | |
| 97 size_t known_device_count); | |
| 98 | |
| 99 // Allows tests to swap in a fake clock. | |
| 100 void SetClockForTest(std::unique_ptr<base::Clock> clock); | |
| 101 | |
| 102 private: | |
| 103 base::Time device_count_metrics_record_time_; | |
| 104 | |
| 105 std::unique_ptr<base::Clock> clock_; | |
| 86 }; | 106 }; |
| 87 | 107 |
| 88 } // namespace media_router | 108 } // namespace media_router |
| 89 | 109 |
| 90 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ | 110 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_METRICS_H_ |
| OLD | NEW |