Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: chromecast/browser/metrics/cast_metrics_service_client.h

Issue 1298473004: [Chromecast] Moves persistent UMA client ID handling to common code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: GN updates, initialize pointer to nullptr Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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. If used, SetForceClientId must be called before Initialize.
53 void SetForceClientId(const std::string& client_id);
51 void OnApplicationNotIdle(); 54 void OnApplicationNotIdle();
55
52 void Initialize(CastService* cast_service); 56 void Initialize(CastService* cast_service);
53 void Finalize(); 57 void Finalize();
54 58
55 // metrics::MetricsServiceClient implementation: 59 // metrics::MetricsServiceClient implementation:
56 void SetMetricsClientId(const std::string& client_id) override; 60 void SetMetricsClientId(const std::string& client_id) override;
57 void OnRecordingDisabled() override; 61 void OnRecordingDisabled() override;
58 bool IsOffTheRecordSessionActive() override; 62 bool IsOffTheRecordSessionActive() override;
59 int32_t GetProduct() override; 63 int32_t GetProduct() override;
60 std::string GetApplicationLocale() override; 64 std::string GetApplicationLocale() override;
61 bool GetBrand(std::string* brand_code) override; 65 bool GetBrand(std::string* brand_code) override;
(...skipping 19 matching lines...) Expand all
81 // Returns whether or not metrics reporting is enabled. 85 // Returns whether or not metrics reporting is enabled.
82 bool IsReportingEnabled(); 86 bool IsReportingEnabled();
83 87
84 scoped_ptr< ::metrics::ClientInfo> LoadClientInfo(); 88 scoped_ptr< ::metrics::ClientInfo> LoadClientInfo();
85 void StoreClientInfo(const ::metrics::ClientInfo& client_info); 89 void StoreClientInfo(const ::metrics::ClientInfo& client_info);
86 90
87 base::TaskRunner* const io_task_runner_; 91 base::TaskRunner* const io_task_runner_;
88 PrefService* const pref_service_; 92 PrefService* const pref_service_;
89 CastService* cast_service_; 93 CastService* cast_service_;
90 std::string client_id_; 94 std::string client_id_;
95 std::string force_client_id_;
96 bool client_info_loaded_;
91 97
92 #if defined(OS_LINUX) 98 #if defined(OS_LINUX)
93 ExternalMetrics* external_metrics_; 99 ExternalMetrics* external_metrics_;
94 ExternalMetrics* platform_metrics_; 100 ExternalMetrics* platform_metrics_;
95 #endif // defined(OS_LINUX) 101 #endif // defined(OS_LINUX)
96 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 102 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
97 scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_; 103 scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_;
98 scoped_ptr< ::metrics::MetricsService> metrics_service_; 104 scoped_ptr< ::metrics::MetricsService> metrics_service_;
99 net::URLRequestContextGetter* const request_context_; 105 net::URLRequestContextGetter* const request_context_;
100 106
101 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); 107 DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient);
102 }; 108 };
103 109
104 } // namespace metrics 110 } // namespace metrics
105 } // namespace chromecast 111 } // namespace chromecast
106 112
107 #endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ 113 #endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « chromecast/browser/metrics/BUILD.gn ('k') | chromecast/browser/metrics/cast_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698