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