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 CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class ChromeOSMetricsProvider; | 22 class ChromeOSMetricsProvider; |
23 class GoogleUpdateMetricsProviderWin; | 23 class GoogleUpdateMetricsProviderWin; |
24 class PluginMetricsProvider; | 24 class PluginMetricsProvider; |
25 class PrefRegistrySimple; | 25 class PrefRegistrySimple; |
26 class PrefService; | 26 class PrefService; |
27 | 27 |
28 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) | 28 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) |
29 class SigninStatusMetricsProvider; | 29 class SigninStatusMetricsProvider; |
30 #endif | 30 #endif |
31 | 31 |
| 32 namespace base { |
| 33 class FilePath; |
| 34 } // namespace base |
| 35 |
32 namespace metrics { | 36 namespace metrics { |
33 class DriveMetricsProvider; | 37 class DriveMetricsProvider; |
34 class MetricsService; | 38 class MetricsService; |
35 class MetricsStateManager; | 39 class MetricsStateManager; |
36 class ProfilerMetricsProvider; | 40 class ProfilerMetricsProvider; |
37 } // namespace metrics | 41 } // namespace metrics |
38 | 42 |
39 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient | 43 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient |
40 // that depends on chrome/. | 44 // that depends on chrome/. |
41 class ChromeMetricsServiceClient | 45 class ChromeMetricsServiceClient |
42 : public metrics::MetricsServiceClient, | 46 : public metrics::MetricsServiceClient, |
43 public metrics::TrackingSynchronizerObserver, | 47 public metrics::TrackingSynchronizerObserver, |
44 public content::NotificationObserver { | 48 public content::NotificationObserver { |
45 public: | 49 public: |
46 ~ChromeMetricsServiceClient() override; | 50 ~ChromeMetricsServiceClient() override; |
47 | 51 |
48 // Factory function. | 52 // Factory function. |
49 static scoped_ptr<ChromeMetricsServiceClient> Create( | 53 static scoped_ptr<ChromeMetricsServiceClient> Create( |
50 metrics::MetricsStateManager* state_manager, | 54 metrics::MetricsStateManager* state_manager, |
51 PrefService* local_state); | 55 PrefService* local_state); |
52 | 56 |
53 // Registers local state prefs used by this class. | 57 // Registers local state prefs used by this class. |
54 static void RegisterPrefs(PrefRegistrySimple* registry); | 58 static void RegisterPrefs(PrefRegistrySimple* registry); |
55 | 59 |
56 // metrics::MetricsServiceClient: | 60 // metrics::MetricsServiceClient: |
57 metrics::MetricsService* GetMetricsService() override; | |
58 void SetMetricsClientId(const std::string& client_id) override; | 61 void SetMetricsClientId(const std::string& client_id) override; |
59 void OnRecordingDisabled() override; | 62 void OnRecordingDisabled() override; |
60 bool IsOffTheRecordSessionActive() override; | 63 bool IsOffTheRecordSessionActive() override; |
61 int32 GetProduct() override; | 64 int32 GetProduct() override; |
62 std::string GetApplicationLocale() override; | 65 std::string GetApplicationLocale() override; |
63 bool GetBrand(std::string* brand_code) override; | 66 bool GetBrand(std::string* brand_code) override; |
64 metrics::SystemProfileProto::Channel GetChannel() override; | 67 metrics::SystemProfileProto::Channel GetChannel() override; |
65 std::string GetVersionString() override; | 68 std::string GetVersionString() override; |
66 void OnLogUploadComplete() override; | 69 void OnLogUploadComplete() override; |
67 void InitializeSystemProfileMetrics( | 70 void InitializeSystemProfileMetrics( |
68 const base::Closure& done_callback) override; | 71 const base::Closure& done_callback) override; |
69 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; | 72 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; |
70 scoped_ptr<metrics::MetricsLogUploader> CreateUploader( | 73 scoped_ptr<metrics::MetricsLogUploader> CreateUploader( |
71 const base::Callback<void(int)>& on_upload_complete) override; | 74 const base::Callback<void(int)>& on_upload_complete) override; |
72 base::TimeDelta GetStandardUploadInterval() override; | 75 base::TimeDelta GetStandardUploadInterval() override; |
73 base::string16 GetRegistryBackupKey() override; | 76 base::string16 GetRegistryBackupKey() override; |
74 void OnPluginLoadingError(const base::FilePath& plugin_path) override; | 77 |
| 78 metrics::MetricsService* metrics_service() { return metrics_service_.get(); } |
| 79 |
| 80 void LogPluginLoadingError(const base::FilePath& plugin_path); |
75 | 81 |
76 private: | 82 private: |
77 explicit ChromeMetricsServiceClient( | 83 explicit ChromeMetricsServiceClient( |
78 metrics::MetricsStateManager* state_manager); | 84 metrics::MetricsStateManager* state_manager); |
79 | 85 |
80 // Completes the two-phase initialization of ChromeMetricsServiceClient. | 86 // Completes the two-phase initialization of ChromeMetricsServiceClient. |
81 void Initialize(); | 87 void Initialize(); |
82 | 88 |
83 // Callback that continues the init task by loading plugin information. | 89 // Callback that continues the init task by loading plugin information. |
84 void OnInitTaskGotHardwareClass(); | 90 void OnInitTaskGotHardwareClass(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Whether this client has already uploaded profiler data during this session. | 207 // Whether this client has already uploaded profiler data during this session. |
202 // Profiler data is uploaded at most once per session. | 208 // Profiler data is uploaded at most once per session. |
203 bool has_uploaded_profiler_data_; | 209 bool has_uploaded_profiler_data_; |
204 | 210 |
205 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; | 211 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; |
206 | 212 |
207 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); | 213 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); |
208 }; | 214 }; |
209 | 215 |
210 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 216 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |