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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // CastMetricsHelper can only hold one MetricsSink instance. | 105 // CastMetricsHelper can only hold one MetricsSink instance. |
106 // Caller retains ownership of MetricsSink. | 106 // Caller retains ownership of MetricsSink. |
107 virtual void SetMetricsSink(MetricsSink* delegate); | 107 virtual void SetMetricsSink(MetricsSink* delegate); |
108 | 108 |
109 // Sets a default callback to record user action when MetricsSink is not set. | 109 // Sets a default callback to record user action when MetricsSink is not set. |
110 // This function could be called multiple times (in unittests), and | 110 // This function could be called multiple times (in unittests), and |
111 // CastMetricsHelper only honors the last one. | 111 // CastMetricsHelper only honors the last one. |
112 virtual void SetRecordActionCallback(const RecordActionCallback& callback); | 112 virtual void SetRecordActionCallback(const RecordActionCallback& callback); |
113 | 113 |
114 protected: | 114 protected: |
115 // Creates a CastMetricsHelper instance with no MessageLoopProxy. This should | 115 // Creates a CastMetricsHelper instance with no task runner. This should only |
116 // only be used by tests, since invoking any non-overridden methods on this | 116 // be used by tests, since invoking any non-overridden methods on this |
117 // instance will cause a failure. | 117 // instance will cause a failure. |
118 CastMetricsHelper(); | 118 CastMetricsHelper(); |
119 | 119 |
120 private: | 120 private: |
121 static std::string EncodeAppInfoIntoMetricsName( | 121 static std::string EncodeAppInfoIntoMetricsName( |
122 const std::string& action_name, | 122 const std::string& action_name, |
123 const std::string& app_id, | 123 const std::string& app_id, |
124 const std::string& session_id, | 124 const std::string& session_id, |
125 const std::string& sdk_version); | 125 const std::string& sdk_version); |
126 | 126 |
(...skipping 28 matching lines...) Expand all Loading... |
155 // Default RecordAction callback when metrics_sink_ is not set. | 155 // Default RecordAction callback when metrics_sink_ is not set. |
156 RecordActionCallback record_action_callback_; | 156 RecordActionCallback record_action_callback_; |
157 | 157 |
158 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper); | 158 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper); |
159 }; | 159 }; |
160 | 160 |
161 } // namespace metrics | 161 } // namespace metrics |
162 } // namespace chromecast | 162 } // namespace chromecast |
163 | 163 |
164 #endif // CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ | 164 #endif // CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ |
OLD | NEW |