Chromium Code Reviews| 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_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ | 5 #ifndef CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ |
| 6 #define CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ | 6 #define CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "components/metrics/metrics_service_client.h" | 16 #include "components/metrics/metrics_service_client.h" |
| 17 | 17 |
| 18 class PrefRegistrySimple; | 18 class PrefRegistrySimple; |
| 19 class PrefService; | 19 class PrefService; |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 23 class TaskRunner; | 23 class TaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace metrics { | 26 namespace metrics { |
| 27 struct ClientInfo; | 27 struct ClientInfo; |
| 28 class EnabledStateProvider; | |
| 28 class MetricsService; | 29 class MetricsService; |
| 29 class MetricsStateManager; | 30 class MetricsStateManager; |
| 30 } // namespace metrics | 31 } // namespace metrics |
| 31 | 32 |
| 32 namespace net { | 33 namespace net { |
| 33 class URLRequestContextGetter; | 34 class URLRequestContextGetter; |
| 34 } // namespace net | 35 } // namespace net |
| 35 | 36 |
| 36 namespace chromecast { | 37 namespace chromecast { |
| 37 | 38 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 std::unique_ptr<::metrics::MetricsLogUploader> CreateUploader( | 82 std::unique_ptr<::metrics::MetricsLogUploader> CreateUploader( |
| 82 const base::Callback<void(int)>& on_upload_complete) override; | 83 const base::Callback<void(int)>& on_upload_complete) override; |
| 83 base::TimeDelta GetStandardUploadInterval() override; | 84 base::TimeDelta GetStandardUploadInterval() override; |
| 84 | 85 |
| 85 // Starts/stops the metrics service. | 86 // Starts/stops the metrics service. |
| 86 void EnableMetricsService(bool enabled); | 87 void EnableMetricsService(bool enabled); |
| 87 | 88 |
| 88 std::string client_id() const { return client_id_; } | 89 std::string client_id() const { return client_id_; } |
| 89 | 90 |
| 90 private: | 91 private: |
| 92 class CastEnabledStateProvider; | |
|
Alexei Svitkine (slow)
2016/05/11 17:16:28
Nit: Same comment as for Aw client - just make it
jwd
2016/05/11 18:31:38
Done.
| |
| 93 | |
| 91 CastMetricsServiceClient(base::TaskRunner* io_task_runner, | 94 CastMetricsServiceClient(base::TaskRunner* io_task_runner, |
| 92 PrefService* pref_service, | 95 PrefService* pref_service, |
| 93 net::URLRequestContextGetter* request_context); | 96 net::URLRequestContextGetter* request_context); |
| 94 | 97 |
| 95 // Returns whether or not metrics reporting is enabled. | 98 // Returns whether or not metrics reporting is enabled. |
| 96 bool IsReportingEnabled(); | 99 bool IsReportingEnabled(); |
| 97 | 100 |
| 98 std::unique_ptr<::metrics::ClientInfo> LoadClientInfo(); | 101 std::unique_ptr<::metrics::ClientInfo> LoadClientInfo(); |
| 99 void StoreClientInfo(const ::metrics::ClientInfo& client_info); | 102 void StoreClientInfo(const ::metrics::ClientInfo& client_info); |
| 100 | 103 |
| 101 base::TaskRunner* const io_task_runner_; | 104 base::TaskRunner* const io_task_runner_; |
| 102 PrefService* const pref_service_; | 105 PrefService* const pref_service_; |
| 103 CastService* cast_service_; | 106 CastService* cast_service_; |
| 104 std::string client_id_; | 107 std::string client_id_; |
| 105 std::string force_client_id_; | 108 std::string force_client_id_; |
| 106 bool client_info_loaded_; | 109 bool client_info_loaded_; |
| 107 | 110 |
| 108 #if defined(OS_LINUX) | 111 #if defined(OS_LINUX) |
| 109 ExternalMetrics* external_metrics_; | 112 ExternalMetrics* external_metrics_; |
| 110 ExternalMetrics* platform_metrics_; | 113 ExternalMetrics* platform_metrics_; |
| 111 #endif // defined(OS_LINUX) | 114 #endif // defined(OS_LINUX) |
| 112 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 115 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 113 std::unique_ptr<::metrics::MetricsStateManager> metrics_state_manager_; | 116 std::unique_ptr<::metrics::MetricsStateManager> metrics_state_manager_; |
| 114 std::unique_ptr<::metrics::MetricsService> metrics_service_; | 117 std::unique_ptr<::metrics::MetricsService> metrics_service_; |
| 118 std::unique_ptr<::metrics::EnabledStateProvider> enabled_state_provider_; | |
| 115 net::URLRequestContextGetter* const request_context_; | 119 net::URLRequestContextGetter* const request_context_; |
| 116 | 120 |
| 117 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); | 121 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 } // namespace metrics | 124 } // namespace metrics |
| 121 } // namespace chromecast | 125 } // namespace chromecast |
| 122 | 126 |
| 123 #endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ | 127 #endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ |
| OLD | NEW |