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

Side by Side Diff: ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h

Issue 2567263003: Basic UkmService implementation (Closed)
Patch Set: Fix small bugs Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_CLIENT_H_ 5 #ifndef IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_CLIENT_H_
6 #define IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_CLIENT_H_ 6 #define IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 class IOSChromeStabilityMetricsProvider; 22 class IOSChromeStabilityMetricsProvider;
23 class PrefRegistrySimple; 23 class PrefRegistrySimple;
24 24
25 namespace metrics { 25 namespace metrics {
26 class DriveMetricsProvider; 26 class DriveMetricsProvider;
27 class MetricsService; 27 class MetricsService;
28 class MetricsStateManager; 28 class MetricsStateManager;
29 class ProfilerMetricsProvider; 29 class ProfilerMetricsProvider;
30 } // namespace metrics 30 } // namespace metrics
31 31
32 namespace ukm {
33 class UkmService;
34 }
35
32 // IOSChromeMetricsServiceClient provides an implementation of 36 // IOSChromeMetricsServiceClient provides an implementation of
33 // MetricsServiceClient that depends on //ios/chrome/. 37 // MetricsServiceClient that depends on //ios/chrome/.
34 class IOSChromeMetricsServiceClient 38 class IOSChromeMetricsServiceClient
35 : public metrics::MetricsServiceClient, 39 : public metrics::MetricsServiceClient,
36 public metrics::TrackingSynchronizerObserver, 40 public metrics::TrackingSynchronizerObserver,
37 public web::GlobalWebStateObserver { 41 public web::GlobalWebStateObserver {
38 public: 42 public:
39 ~IOSChromeMetricsServiceClient() override; 43 ~IOSChromeMetricsServiceClient() override;
40 44
41 // Factory function. 45 // Factory function.
42 static std::unique_ptr<IOSChromeMetricsServiceClient> Create( 46 static std::unique_ptr<IOSChromeMetricsServiceClient> Create(
43 metrics::MetricsStateManager* state_manager); 47 metrics::MetricsStateManager* state_manager);
44 48
45 // Registers local state prefs used by this class. 49 // Registers local state prefs used by this class.
46 static void RegisterPrefs(PrefRegistrySimple* registry); 50 static void RegisterPrefs(PrefRegistrySimple* registry);
47 51
48 // metrics::MetricsServiceClient: 52 // metrics::MetricsServiceClient:
49 metrics::MetricsService* GetMetricsService() override; 53 metrics::MetricsService* GetMetricsService() override;
54 ukm::UkmService* GetUkmService() override;
50 void SetMetricsClientId(const std::string& client_id) override; 55 void SetMetricsClientId(const std::string& client_id) override;
51 int32_t GetProduct() override; 56 int32_t GetProduct() override;
52 std::string GetApplicationLocale() override; 57 std::string GetApplicationLocale() override;
53 bool GetBrand(std::string* brand_code) override; 58 bool GetBrand(std::string* brand_code) override;
54 metrics::SystemProfileProto::Channel GetChannel() override; 59 metrics::SystemProfileProto::Channel GetChannel() override;
55 std::string GetVersionString() override; 60 std::string GetVersionString() override;
56 void OnLogUploadComplete() override; 61 void OnLogUploadComplete() override;
57 void InitializeSystemProfileMetrics( 62 void InitializeSystemProfileMetrics(
58 const base::Closure& done_callback) override; 63 const base::Closure& done_callback) override;
59 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; 64 void CollectFinalMetricsForLog(const base::Closure& done_callback) override;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void OnURLOpenedFromOmnibox(OmniboxLog* log); 116 void OnURLOpenedFromOmnibox(OmniboxLog* log);
112 117
113 base::ThreadChecker thread_checker_; 118 base::ThreadChecker thread_checker_;
114 119
115 // Weak pointer to the MetricsStateManager. 120 // Weak pointer to the MetricsStateManager.
116 metrics::MetricsStateManager* metrics_state_manager_; 121 metrics::MetricsStateManager* metrics_state_manager_;
117 122
118 // The MetricsService that |this| is a client of. 123 // The MetricsService that |this| is a client of.
119 std::unique_ptr<metrics::MetricsService> metrics_service_; 124 std::unique_ptr<metrics::MetricsService> metrics_service_;
120 125
126 // The UkmService that |this| is a client of.
127 std::unique_ptr<ukm::UkmService> ukm_service_;
128
121 // The IOSChromeStabilityMetricsProvider instance that was registered with 129 // The IOSChromeStabilityMetricsProvider instance that was registered with
122 // MetricsService. Has the same lifetime as |metrics_service_|. 130 // MetricsService. Has the same lifetime as |metrics_service_|.
123 IOSChromeStabilityMetricsProvider* stability_metrics_provider_; 131 IOSChromeStabilityMetricsProvider* stability_metrics_provider_;
124 132
125 // Saved callback received from CollectFinalMetricsForLog(). 133 // Saved callback received from CollectFinalMetricsForLog().
126 base::Closure collect_final_metrics_done_callback_; 134 base::Closure collect_final_metrics_done_callback_;
127 135
128 // The ProfilerMetricsProvider instance that was registered with 136 // The ProfilerMetricsProvider instance that was registered with
129 // MetricsService. Has the same lifetime as |metrics_service_|. 137 // MetricsService. Has the same lifetime as |metrics_service_|.
130 metrics::ProfilerMetricsProvider* profiler_metrics_provider_; 138 metrics::ProfilerMetricsProvider* profiler_metrics_provider_;
(...skipping 20 matching lines...) Expand all
151 // Whether this client has already uploaded profiler data during this session. 159 // Whether this client has already uploaded profiler data during this session.
152 // Profiler data is uploaded at most once per session. 160 // Profiler data is uploaded at most once per session.
153 bool has_uploaded_profiler_data_; 161 bool has_uploaded_profiler_data_;
154 162
155 base::WeakPtrFactory<IOSChromeMetricsServiceClient> weak_ptr_factory_; 163 base::WeakPtrFactory<IOSChromeMetricsServiceClient> weak_ptr_factory_;
156 164
157 DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsServiceClient); 165 DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsServiceClient);
158 }; 166 };
159 167
160 #endif // IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_CLIENT_H_ 168 #endif // IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698