OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ | 5 #ifndef CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ |
6 #define CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ | 6 #define CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // events internally unless SetMetricsSink(NULL) is called. | 96 // events internally unless SetMetricsSink(NULL) is called. |
97 // CastMetricsHelper can only hold one MetricsSink instance. | 97 // CastMetricsHelper can only hold one MetricsSink instance. |
98 // Caller retains ownership of MetricsSink. | 98 // Caller retains ownership of MetricsSink. |
99 virtual void SetMetricsSink(MetricsSink* delegate); | 99 virtual void SetMetricsSink(MetricsSink* delegate); |
100 | 100 |
101 // Sets a default callback to record user action when MetricsSink is not set. | 101 // Sets a default callback to record user action when MetricsSink is not set. |
102 // This function could be called multiple times (in unittests), and | 102 // This function could be called multiple times (in unittests), and |
103 // CastMetricsHelper only honors the last one. | 103 // CastMetricsHelper only honors the last one. |
104 virtual void SetRecordActionCallback(const RecordActionCallback& callback); | 104 virtual void SetRecordActionCallback(const RecordActionCallback& callback); |
105 | 105 |
| 106 // Sets an all-0's session ID for running browser tests. |
| 107 void SetDummySessionIdForTesting(); |
| 108 |
106 protected: | 109 protected: |
107 // Creates a CastMetricsHelper instance with no task runner. This should only | 110 // Creates a CastMetricsHelper instance with no task runner. This should only |
108 // be used by tests, since invoking any non-overridden methods on this | 111 // be used by tests, since invoking any non-overridden methods on this |
109 // instance will cause a failure. | 112 // instance will cause a failure. |
110 CastMetricsHelper(); | 113 CastMetricsHelper(); |
111 | 114 |
112 private: | 115 private: |
113 static std::string EncodeAppInfoIntoMetricsName( | 116 static std::string EncodeAppInfoIntoMetricsName( |
114 const std::string& action_name, | 117 const std::string& action_name, |
115 const std::string& app_id, | 118 const std::string& app_id, |
(...skipping 27 matching lines...) Expand all Loading... |
143 // Default RecordAction callback when metrics_sink_ is not set. | 146 // Default RecordAction callback when metrics_sink_ is not set. |
144 RecordActionCallback record_action_callback_; | 147 RecordActionCallback record_action_callback_; |
145 | 148 |
146 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper); | 149 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper); |
147 }; | 150 }; |
148 | 151 |
149 } // namespace metrics | 152 } // namespace metrics |
150 } // namespace chromecast | 153 } // namespace chromecast |
151 | 154 |
152 #endif // CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ | 155 #endif // CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ |
OLD | NEW |