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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 class CastMetricsServiceClient : public ::metrics::MetricsServiceClient { | 41 class CastMetricsServiceClient : public ::metrics::MetricsServiceClient { |
| 42 public: | 42 public: |
| 43 ~CastMetricsServiceClient() override; | 43 ~CastMetricsServiceClient() override; |
| 44 | 44 |
| 45 static scoped_ptr<CastMetricsServiceClient> Create( | 45 static scoped_ptr<CastMetricsServiceClient> Create( |
| 46 base::TaskRunner* io_task_runner, | 46 base::TaskRunner* io_task_runner, |
| 47 PrefService* pref_service, | 47 PrefService* pref_service, |
| 48 net::URLRequestContextGetter* request_context); | 48 net::URLRequestContextGetter* request_context); |
| 49 static void RegisterPrefs(PrefRegistrySimple* registry); | 49 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 50 | 50 |
| 51 // Use |client_id| when starting MetricsService instead of generating a new | |
| 52 // client ID. Must be called before Initialize. | |
|
byungchul
2015/08/19 21:38:19
comment that it is optional.
gunsch
2015/08/19 21:46:51
Done.
| |
| 53 void SetForceClientId(const std::string& client_id); | |
| 54 | |
| 51 void Initialize(CastService* cast_service); | 55 void Initialize(CastService* cast_service); |
| 52 void Finalize(); | 56 void Finalize(); |
| 53 | 57 |
| 54 // metrics::MetricsServiceClient implementation: | 58 // metrics::MetricsServiceClient implementation: |
| 55 void SetMetricsClientId(const std::string& client_id) override; | 59 void SetMetricsClientId(const std::string& client_id) override; |
| 56 void OnRecordingDisabled() override; | 60 void OnRecordingDisabled() override; |
| 57 bool IsOffTheRecordSessionActive() override; | 61 bool IsOffTheRecordSessionActive() override; |
| 58 int32_t GetProduct() override; | 62 int32_t GetProduct() override; |
| 59 std::string GetApplicationLocale() override; | 63 std::string GetApplicationLocale() override; |
| 60 bool GetBrand(std::string* brand_code) override; | 64 bool GetBrand(std::string* brand_code) override; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 80 // Returns whether or not metrics reporting is enabled. | 84 // Returns whether or not metrics reporting is enabled. |
| 81 bool IsReportingEnabled(); | 85 bool IsReportingEnabled(); |
| 82 | 86 |
| 83 scoped_ptr< ::metrics::ClientInfo> LoadClientInfo(); | 87 scoped_ptr< ::metrics::ClientInfo> LoadClientInfo(); |
| 84 void StoreClientInfo(const ::metrics::ClientInfo& client_info); | 88 void StoreClientInfo(const ::metrics::ClientInfo& client_info); |
| 85 | 89 |
| 86 base::TaskRunner* const io_task_runner_; | 90 base::TaskRunner* const io_task_runner_; |
| 87 PrefService* const pref_service_; | 91 PrefService* const pref_service_; |
| 88 CastService* cast_service_; | 92 CastService* cast_service_; |
| 89 std::string client_id_; | 93 std::string client_id_; |
| 94 std::string force_client_id_; | |
| 95 bool client_info_loaded_; | |
| 90 | 96 |
| 91 #if defined(OS_LINUX) | 97 #if defined(OS_LINUX) |
| 92 ExternalMetrics* external_metrics_; | 98 ExternalMetrics* external_metrics_; |
| 93 ExternalMetrics* platform_metrics_; | 99 ExternalMetrics* platform_metrics_; |
| 94 #endif // defined(OS_LINUX) | 100 #endif // defined(OS_LINUX) |
| 95 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 101 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 96 scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_; | 102 scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_; |
| 97 scoped_ptr< ::metrics::MetricsService> metrics_service_; | 103 scoped_ptr< ::metrics::MetricsService> metrics_service_; |
| 98 net::URLRequestContextGetter* const request_context_; | 104 net::URLRequestContextGetter* const request_context_; |
| 99 | 105 |
| 100 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); | 106 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); |
| 101 }; | 107 }; |
| 102 | 108 |
| 103 } // namespace metrics | 109 } // namespace metrics |
| 104 } // namespace chromecast | 110 } // namespace chromecast |
| 105 | 111 |
| 106 #endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ | 112 #endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ |
| OLD | NEW |