| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Factory function. | 50 // Factory function. |
| 51 static scoped_ptr<ChromeMetricsServiceClient> Create( | 51 static scoped_ptr<ChromeMetricsServiceClient> Create( |
| 52 metrics::MetricsStateManager* state_manager, | 52 metrics::MetricsStateManager* state_manager, |
| 53 PrefService* local_state); | 53 PrefService* local_state); |
| 54 | 54 |
| 55 // Registers local state prefs used by this class. | 55 // Registers local state prefs used by this class. |
| 56 static void RegisterPrefs(PrefRegistrySimple* registry); | 56 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 57 | 57 |
| 58 // metrics::MetricsServiceClient: | 58 // metrics::MetricsServiceClient: |
| 59 virtual void SetMetricsClientId(const std::string& client_id) OVERRIDE; | 59 virtual void SetMetricsClientId(const std::string& client_id) override; |
| 60 virtual bool IsOffTheRecordSessionActive() OVERRIDE; | 60 virtual bool IsOffTheRecordSessionActive() override; |
| 61 virtual int32 GetProduct() OVERRIDE; | 61 virtual int32 GetProduct() override; |
| 62 virtual std::string GetApplicationLocale() OVERRIDE; | 62 virtual std::string GetApplicationLocale() override; |
| 63 virtual bool GetBrand(std::string* brand_code) OVERRIDE; | 63 virtual bool GetBrand(std::string* brand_code) override; |
| 64 virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE; | 64 virtual metrics::SystemProfileProto::Channel GetChannel() override; |
| 65 virtual std::string GetVersionString() OVERRIDE; | 65 virtual std::string GetVersionString() override; |
| 66 virtual void OnLogUploadComplete() OVERRIDE; | 66 virtual void OnLogUploadComplete() override; |
| 67 virtual void StartGatheringMetrics( | 67 virtual void StartGatheringMetrics( |
| 68 const base::Closure& done_callback) OVERRIDE; | 68 const base::Closure& done_callback) override; |
| 69 virtual void CollectFinalMetrics(const base::Closure& done_callback) | 69 virtual void CollectFinalMetrics(const base::Closure& done_callback) |
| 70 OVERRIDE; | 70 override; |
| 71 virtual scoped_ptr<metrics::MetricsLogUploader> CreateUploader( | 71 virtual scoped_ptr<metrics::MetricsLogUploader> CreateUploader( |
| 72 const std::string& server_url, | 72 const std::string& server_url, |
| 73 const std::string& mime_type, | 73 const std::string& mime_type, |
| 74 const base::Callback<void(int)>& on_upload_complete) OVERRIDE; | 74 const base::Callback<void(int)>& on_upload_complete) override; |
| 75 virtual base::string16 GetRegistryBackupKey() OVERRIDE; | 75 virtual base::string16 GetRegistryBackupKey() override; |
| 76 | 76 |
| 77 metrics::MetricsService* metrics_service() { return metrics_service_.get(); } | 77 metrics::MetricsService* metrics_service() { return metrics_service_.get(); } |
| 78 | 78 |
| 79 void LogPluginLoadingError(const base::FilePath& plugin_path); | 79 void LogPluginLoadingError(const base::FilePath& plugin_path); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 explicit ChromeMetricsServiceClient( | 82 explicit ChromeMetricsServiceClient( |
| 83 metrics::MetricsStateManager* state_manager); | 83 metrics::MetricsStateManager* state_manager); |
| 84 | 84 |
| 85 // Completes the two-phase initialization of ChromeMetricsServiceClient. | 85 // Completes the two-phase initialization of ChromeMetricsServiceClient. |
| 86 void Initialize(); | 86 void Initialize(); |
| 87 | 87 |
| 88 // Callback that continues the init task by loading plugin information. | 88 // Callback that continues the init task by loading plugin information. |
| 89 void OnInitTaskGotHardwareClass(); | 89 void OnInitTaskGotHardwareClass(); |
| 90 | 90 |
| 91 // Called after the Plugin init task has been completed that continues the | 91 // Called after the Plugin init task has been completed that continues the |
| 92 // init task by launching a task to gather Google Update statistics. | 92 // init task by launching a task to gather Google Update statistics. |
| 93 void OnInitTaskGotPluginInfo(); | 93 void OnInitTaskGotPluginInfo(); |
| 94 | 94 |
| 95 // Called after GoogleUpdate init task has been completed that continues the | 95 // Called after GoogleUpdate init task has been completed that continues the |
| 96 // init task by loading profiler data. | 96 // init task by loading profiler data. |
| 97 void OnInitTaskGotGoogleUpdateData(); | 97 void OnInitTaskGotGoogleUpdateData(); |
| 98 | 98 |
| 99 // TrackingSynchronizerObserver: | 99 // TrackingSynchronizerObserver: |
| 100 virtual void ReceivedProfilerData( | 100 virtual void ReceivedProfilerData( |
| 101 const tracked_objects::ProcessDataSnapshot& process_data, | 101 const tracked_objects::ProcessDataSnapshot& process_data, |
| 102 int process_type) OVERRIDE; | 102 int process_type) override; |
| 103 virtual void FinishedReceivingProfilerData() OVERRIDE; | 103 virtual void FinishedReceivingProfilerData() override; |
| 104 | 104 |
| 105 // Callbacks for various stages of final log info collection. Do not call | 105 // Callbacks for various stages of final log info collection. Do not call |
| 106 // these directly. | 106 // these directly. |
| 107 void OnMemoryDetailCollectionDone(); | 107 void OnMemoryDetailCollectionDone(); |
| 108 void OnHistogramSynchronizationDone(); | 108 void OnHistogramSynchronizationDone(); |
| 109 | 109 |
| 110 // Records metrics about the switches present on the command line. | 110 // Records metrics about the switches present on the command line. |
| 111 void RecordCommandLineMetrics(); | 111 void RecordCommandLineMetrics(); |
| 112 | 112 |
| 113 // Registers |this| as an observer for notifications which indicate that a | 113 // Registers |this| as an observer for notifications which indicate that a |
| 114 // user is performing work. This is useful to allow some features to sleep, | 114 // user is performing work. This is useful to allow some features to sleep, |
| 115 // until the machine becomes active, such as precluding UMA uploads unless | 115 // until the machine becomes active, such as precluding UMA uploads unless |
| 116 // there was recent activity. | 116 // there was recent activity. |
| 117 void RegisterForNotifications(); | 117 void RegisterForNotifications(); |
| 118 | 118 |
| 119 // content::NotificationObserver: | 119 // content::NotificationObserver: |
| 120 virtual void Observe(int type, | 120 virtual void Observe(int type, |
| 121 const content::NotificationSource& source, | 121 const content::NotificationSource& source, |
| 122 const content::NotificationDetails& details) OVERRIDE; | 122 const content::NotificationDetails& details) override; |
| 123 | 123 |
| 124 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
| 125 // Counts (and removes) the browser crash dump attempt signals left behind by | 125 // Counts (and removes) the browser crash dump attempt signals left behind by |
| 126 // any previous browser processes which generated a crash dump. | 126 // any previous browser processes which generated a crash dump. |
| 127 void CountBrowserCrashDumpAttempts(); | 127 void CountBrowserCrashDumpAttempts(); |
| 128 #endif // OS_WIN | 128 #endif // OS_WIN |
| 129 | 129 |
| 130 base::ThreadChecker thread_checker_; | 130 base::ThreadChecker thread_checker_; |
| 131 | 131 |
| 132 // Weak pointer to the MetricsStateManager. | 132 // Weak pointer to the MetricsStateManager. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // The MemoryGrowthTracker instance that tracks memory usage growth in | 180 // The MemoryGrowthTracker instance that tracks memory usage growth in |
| 181 // MemoryDetails. | 181 // MemoryDetails. |
| 182 MemoryGrowthTracker memory_growth_tracker_; | 182 MemoryGrowthTracker memory_growth_tracker_; |
| 183 | 183 |
| 184 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; | 184 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; |
| 185 | 185 |
| 186 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); | 186 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ | 189 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ |
| OLD | NEW |