| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines a set of user experience metrics data recorded by | 5 // This file defines a set of user experience metrics data recorded by |
| 6 // the MetricsService. This is the unit of data that is sent to the server. | 6 // the MetricsService. This is the unit of data that is sent to the server. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
| 9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 GoogleUpdateSettings::ProductData google_update_data; | 62 GoogleUpdateSettings::ProductData google_update_data; |
| 63 // Details about Google Update's attempts to update this product. | 63 // Details about Google Update's attempts to update this product. |
| 64 GoogleUpdateSettings::ProductData product_data; | 64 GoogleUpdateSettings::ProductData product_data; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class MetricsLog : public metrics::MetricsLogBase { | 67 class MetricsLog : public metrics::MetricsLogBase { |
| 68 public: | 68 public: |
| 69 // Creates a new metrics log of the specified type. | 69 // Creates a new metrics log of the specified type. |
| 70 // client_id is the identifier for this profile on this installation | 70 // client_id is the identifier for this profile on this installation |
| 71 // session_id is an integer that's incremented on each application launch | 71 // session_id is an integer that's incremented on each application launch |
| 72 MetricsLog(const std::string& client_id, int session_id, LogType log_type); | 72 // |local_state| is the PrefService that this instance should use. |
| 73 MetricsLog(const std::string& client_id, |
| 74 int session_id, |
| 75 LogType log_type, |
| 76 PrefService* local_state); |
| 73 virtual ~MetricsLog(); | 77 virtual ~MetricsLog(); |
| 74 | 78 |
| 75 static void RegisterPrefs(PrefRegistrySimple* registry); | 79 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 76 | 80 |
| 77 // Get the current version of the application as a string. | 81 // Get the current version of the application as a string. |
| 78 static std::string GetVersionString(); | 82 static std::string GetVersionString(); |
| 79 | 83 |
| 80 // Use |extension| in all uploaded appversions in addition to the standard | 84 // Use |extension| in all uploaded appversions in addition to the standard |
| 81 // version string. | 85 // version string. |
| 82 static void set_version_extension(const std::string& extension); | 86 static void set_version_extension(const std::string& extension); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void RecordStabilityMetrics(base::TimeDelta incremental_uptime, | 123 void RecordStabilityMetrics(base::TimeDelta incremental_uptime, |
| 120 base::TimeDelta uptime); | 124 base::TimeDelta uptime); |
| 121 | 125 |
| 122 const base::TimeTicks& creation_time() const { | 126 const base::TimeTicks& creation_time() const { |
| 123 return creation_time_; | 127 return creation_time_; |
| 124 } | 128 } |
| 125 | 129 |
| 126 protected: | 130 protected: |
| 127 // Exposed for the sake of mocking in test code. | 131 // Exposed for the sake of mocking in test code. |
| 128 | 132 |
| 129 // Returns the PrefService from which to log metrics data. | |
| 130 virtual PrefService* GetPrefService(); | |
| 131 | |
| 132 // Returns the screen size for the primary monitor. | 133 // Returns the screen size for the primary monitor. |
| 133 virtual gfx::Size GetScreenSize() const; | 134 virtual gfx::Size GetScreenSize() const; |
| 134 | 135 |
| 135 // Returns the device scale factor for the primary monitor. | 136 // Returns the device scale factor for the primary monitor. |
| 136 virtual float GetScreenDeviceScaleFactor() const; | 137 virtual float GetScreenDeviceScaleFactor() const; |
| 137 | 138 |
| 138 // Returns the number of monitors the user is using. | 139 // Returns the number of monitors the user is using. |
| 139 virtual int GetScreenCount() const; | 140 virtual int GetScreenCount() const; |
| 140 | 141 |
| 141 // Fills |field_trial_ids| with the list of initialized field trials name and | 142 // Fills |field_trial_ids| with the list of initialized field trials name and |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 // Observes network state to provide values for SystemProfile::Network. | 184 // Observes network state to provide values for SystemProfile::Network. |
| 184 MetricsNetworkObserver network_observer_; | 185 MetricsNetworkObserver network_observer_; |
| 185 | 186 |
| 186 // The time when the current log was created. | 187 // The time when the current log was created. |
| 187 const base::TimeTicks creation_time_; | 188 const base::TimeTicks creation_time_; |
| 188 | 189 |
| 189 // For including information on which extensions are installed in reports. | 190 // For including information on which extensions are installed in reports. |
| 190 HashedExtensionMetrics extension_metrics_; | 191 HashedExtensionMetrics extension_metrics_; |
| 191 | 192 |
| 193 PrefService* local_state_; |
| 194 |
| 192 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 195 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
| 193 }; | 196 }; |
| 194 | 197 |
| 195 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 198 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
| OLD | NEW |