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