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 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "chrome/browser/metrics/metrics_network_observer.h" | 15 #include "chrome/browser/metrics/metrics_network_observer.h" |
16 #include "chrome/common/metrics/metrics_log_base.h" | 16 #include "chrome/common/metrics/metrics_log_base.h" |
17 #include "chrome/common/metrics/variations/variations_util.h" | 17 #include "chrome/common/metrics/variations/variations_util.h" |
18 #include "chrome/installer/util/google_update_settings.h" | 18 #include "chrome/installer/util/google_update_settings.h" |
19 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
20 | 20 |
21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
22 #include "chrome/browser/metrics/perf_provider_chromeos.h" | 22 #include "metrics_log_chromeos.h" |
23 #endif | 23 #endif |
24 | 24 |
25 class MetricsNetworkObserver; | 25 class MetricsNetworkObserver; |
26 struct OmniboxLog; | 26 struct OmniboxLog; |
27 class PrefService; | 27 class PrefService; |
28 class PrefRegistrySimple; | 28 class PrefRegistrySimple; |
29 | 29 |
30 namespace base { | 30 namespace base { |
31 class DictionaryValue; | 31 class DictionaryValue; |
32 } | 32 } |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 struct WebPluginInfo; | 35 struct WebPluginInfo; |
36 } | 36 } |
37 | 37 |
38 namespace device { | |
39 class BluetoothAdapter; | |
40 } | |
41 | |
42 namespace tracked_objects { | 38 namespace tracked_objects { |
43 struct ProcessDataSnapshot; | 39 struct ProcessDataSnapshot; |
44 } | 40 } |
45 | 41 |
46 namespace chrome_variations { | 42 namespace chrome_variations { |
47 struct ActiveGroupId; | 43 struct ActiveGroupId; |
48 } | 44 } |
49 | 45 |
50 // This is a small helper struct to pass Google Update metrics in a single | 46 // This is a small helper struct to pass Google Update metrics in a single |
51 // reference argument to MetricsLog::RecordEnvironment(). | 47 // reference argument to MetricsLog::RecordEnvironment(). |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 virtual float GetScreenDeviceScaleFactor() const; | 134 virtual float GetScreenDeviceScaleFactor() const; |
139 | 135 |
140 // Returns the number of monitors the user is using. | 136 // Returns the number of monitors the user is using. |
141 virtual int GetScreenCount() const; | 137 virtual int GetScreenCount() const; |
142 | 138 |
143 // Fills |field_trial_ids| with the list of initialized field trials name and | 139 // Fills |field_trial_ids| with the list of initialized field trials name and |
144 // group ids. | 140 // group ids. |
145 virtual void GetFieldTrialIds( | 141 virtual void GetFieldTrialIds( |
146 std::vector<chrome_variations::ActiveGroupId>* field_trial_ids) const; | 142 std::vector<chrome_variations::ActiveGroupId>* field_trial_ids) const; |
147 | 143 |
| 144 // Exposed to allow dependency injection for tests. |
| 145 #if defined(OS_CHROMEOS) |
| 146 scoped_ptr<MetricsLogChromeOS> metrics_log_chromeos_; |
| 147 #endif |
| 148 |
148 private: | 149 private: |
149 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); | 150 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); |
150 | 151 |
151 // Returns true if the environment has already been filled in by a call to | 152 // Returns true if the environment has already been filled in by a call to |
152 // RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). | 153 // RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). |
153 bool HasEnvironment() const; | 154 bool HasEnvironment() const; |
154 | 155 |
155 // Returns true if the stability metrics have already been filled in by a | 156 // Returns true if the stability metrics have already been filled in by a |
156 // call to RecordStabilityMetrics(). | 157 // call to RecordStabilityMetrics(). |
157 bool HasStabilityMetrics() const; | 158 bool HasStabilityMetrics() const; |
(...skipping 11 matching lines...) Expand all Loading... |
169 void WriteRealtimeStabilityAttributes(PrefService* pref, | 170 void WriteRealtimeStabilityAttributes(PrefService* pref, |
170 base::TimeDelta incremental_uptime); | 171 base::TimeDelta incremental_uptime); |
171 | 172 |
172 // Writes the list of installed plugins. | 173 // Writes the list of installed plugins. |
173 void WritePluginList(const std::vector<content::WebPluginInfo>& plugin_list); | 174 void WritePluginList(const std::vector<content::WebPluginInfo>& plugin_list); |
174 | 175 |
175 // Writes info about the Google Update install that is managing this client. | 176 // Writes info about the Google Update install that is managing this client. |
176 // This is a no-op if called on a non-Windows platform. | 177 // This is a no-op if called on a non-Windows platform. |
177 void WriteGoogleUpdateProto(const GoogleUpdateMetrics& google_update_metrics); | 178 void WriteGoogleUpdateProto(const GoogleUpdateMetrics& google_update_metrics); |
178 | 179 |
179 // Sets the Bluetooth Adapter instance used for the WriteBluetoothProto() | |
180 // call. | |
181 void SetBluetoothAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | |
182 | |
183 // Writes info about paired Bluetooth devices on this system. | |
184 // This is a no-op if called on a non-Chrome OS platform. | |
185 virtual void WriteBluetoothProto( | |
186 metrics::SystemProfileProto::Hardware* hardware); | |
187 | |
188 #if defined(OS_CHROMEOS) | |
189 // Update the number of users logged into a multi-profile session. | |
190 // If the number of users change while the log is open, the call invalidates | |
191 // the user count value. | |
192 void UpdateMultiProfileUserCount(); | |
193 #endif | |
194 | |
195 // Observes network state to provide values for SystemProfile::Network. | 180 // Observes network state to provide values for SystemProfile::Network. |
196 MetricsNetworkObserver network_observer_; | 181 MetricsNetworkObserver network_observer_; |
197 | 182 |
198 #if defined(OS_CHROMEOS) | |
199 metrics::PerfProvider perf_provider_; | |
200 #endif | |
201 | |
202 // Bluetooth Adapter instance for collecting information about paired devices. | |
203 scoped_refptr<device::BluetoothAdapter> adapter_; | |
204 | |
205 // The time when the current log was created. | 183 // The time when the current log was created. |
206 const base::TimeTicks creation_time_; | 184 const base::TimeTicks creation_time_; |
207 | 185 |
208 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 186 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
209 }; | 187 }; |
210 | 188 |
211 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 189 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
OLD | NEW |