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 // This file defines a service that collects information about the user | 5 // This file defines a service that collects information about the user |
6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
7 | 7 |
8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ | 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ |
9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ | 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 void EnableReporting(); | 144 void EnableReporting(); |
145 void DisableReporting(); | 145 void DisableReporting(); |
146 | 146 |
147 // Returns the client ID for this client, or the empty string if metrics | 147 // Returns the client ID for this client, or the empty string if metrics |
148 // recording is not currently running. | 148 // recording is not currently running. |
149 std::string GetClientId(); | 149 std::string GetClientId(); |
150 | 150 |
151 // Returns the install date of the application, in seconds since the epoch. | 151 // Returns the install date of the application, in seconds since the epoch. |
152 int64 GetInstallDate(); | 152 int64 GetInstallDate(); |
153 | 153 |
154 // Returns the date at which the current metrics client ID was created as | |
155 // an int64 containing seconds since the epoch8. | |
Ilya Sherman
2015/03/23 21:59:29
nit: What's an "epoch8"?
Olivier
2015/03/24 16:28:02
Done.
| |
156 int64 GetMetricsReportingEnabledDate(); | |
157 | |
154 // Returns the preferred entropy provider used to seed persistent activities | 158 // Returns the preferred entropy provider used to seed persistent activities |
155 // based on whether or not metrics reporting will be permitted on this client. | 159 // based on whether or not metrics reporting will be permitted on this client. |
156 // | 160 // |
157 // If metrics reporting is enabled, this method returns an entropy provider | 161 // If metrics reporting is enabled, this method returns an entropy provider |
158 // that has a high source of entropy, partially based on the client ID. | 162 // that has a high source of entropy, partially based on the client ID. |
159 // Otherwise, it returns an entropy provider that is based on a low entropy | 163 // Otherwise, it returns an entropy provider that is based on a low entropy |
160 // source. | 164 // source. |
161 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(); | 165 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(); |
162 | 166 |
163 // At startup, prefs needs to be called with a list of all the pref names and | 167 // At startup, prefs needs to be called with a list of all the pref names and |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 | 240 |
237 // Check if this install was cloned or imaged from another machine. If a | 241 // Check if this install was cloned or imaged from another machine. If a |
238 // clone is detected, reset the client id and low entropy source. This | 242 // clone is detected, reset the client id and low entropy source. This |
239 // should not be called more than once. | 243 // should not be called more than once. |
240 void CheckForClonedInstall( | 244 void CheckForClonedInstall( |
241 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 245 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
242 | 246 |
243 // Clears the stability metrics that are saved in local state. | 247 // Clears the stability metrics that are saved in local state. |
244 void ClearSavedStabilityMetrics(); | 248 void ClearSavedStabilityMetrics(); |
245 | 249 |
250 // Sets the connection type callback used to pass to the scheduler. | |
251 void SetConnectionTypeCallback( | |
252 base::Callback<void(bool*)> is_cellular_callback); | |
Ilya Sherman
2015/03/23 21:59:29
Why are these three lines included in the diff?
Olivier
2015/03/24 16:28:02
Done.
| |
253 | |
254 // Pushes a log that has been generated by an external component. | |
255 void PushExternalLog(const std::string& log); | |
256 | |
246 protected: | 257 protected: |
247 // Exposed for testing. | 258 // Exposed for testing. |
248 MetricsLogManager* log_manager() { return &log_manager_; } | 259 MetricsLogManager* log_manager() { return &log_manager_; } |
249 | 260 |
250 private: | 261 private: |
251 // The MetricsService has a lifecycle that is stored as a state. | 262 // The MetricsService has a lifecycle that is stored as a state. |
252 // See metrics_service.cc for description of this lifecycle. | 263 // See metrics_service.cc for description of this lifecycle. |
253 enum State { | 264 enum State { |
254 INITIALIZED, // Constructor was called. | 265 INITIALIZED, // Constructor was called. |
255 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to finish. | 266 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to finish. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 // Weak pointers factory used for saving state. All weak pointers managed by | 499 // Weak pointers factory used for saving state. All weak pointers managed by |
489 // this factory are invalidated in ScheduleNextStateSave. | 500 // this factory are invalidated in ScheduleNextStateSave. |
490 base::WeakPtrFactory<MetricsService> state_saver_factory_; | 501 base::WeakPtrFactory<MetricsService> state_saver_factory_; |
491 | 502 |
492 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 503 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
493 }; | 504 }; |
494 | 505 |
495 } // namespace metrics | 506 } // namespace metrics |
496 | 507 |
497 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ | 508 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |