| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 SHUTDOWN_COMPLETE = 700, | 91 SHUTDOWN_COMPLETE = 700, |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // Creates the MetricsService with the given |state_manager|, |client|, and | 94 // Creates the MetricsService with the given |state_manager|, |client|, and |
| 95 // |local_state|. Does not take ownership of the paramaters; instead stores | 95 // |local_state|. Does not take ownership of the paramaters; instead stores |
| 96 // a weak pointer to each. Caller should ensure that the parameters are valid | 96 // a weak pointer to each. Caller should ensure that the parameters are valid |
| 97 // for the lifetime of this class. | 97 // for the lifetime of this class. |
| 98 MetricsService(MetricsStateManager* state_manager, | 98 MetricsService(MetricsStateManager* state_manager, |
| 99 MetricsServiceClient* client, | 99 MetricsServiceClient* client, |
| 100 PrefService* local_state); | 100 PrefService* local_state); |
| 101 virtual ~MetricsService(); | 101 ~MetricsService() override; |
| 102 | 102 |
| 103 // Initializes metrics recording state. Updates various bookkeeping values in | 103 // Initializes metrics recording state. Updates various bookkeeping values in |
| 104 // prefs and sets up the scheduler. This is a separate function rather than | 104 // prefs and sets up the scheduler. This is a separate function rather than |
| 105 // being done by the constructor so that field trials could be created before | 105 // being done by the constructor so that field trials could be created before |
| 106 // this is run. | 106 // this is run. |
| 107 void InitializeMetricsRecordingState(); | 107 void InitializeMetricsRecordingState(); |
| 108 | 108 |
| 109 // Starts the metrics system, turning on recording and uploading of metrics. | 109 // Starts the metrics system, turning on recording and uploading of metrics. |
| 110 // Should be called when starting up with metrics enabled, or when metrics | 110 // Should be called when starting up with metrics enabled, or when metrics |
| 111 // are turned on. | 111 // are turned on. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // that has a high source of entropy, partially based on the client ID. | 145 // that has a high source of entropy, partially based on the client ID. |
| 146 // Otherwise, it returns an entropy provider that is based on a low entropy | 146 // Otherwise, it returns an entropy provider that is based on a low entropy |
| 147 // source. | 147 // source. |
| 148 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(); | 148 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(); |
| 149 | 149 |
| 150 // At startup, prefs needs to be called with a list of all the pref names and | 150 // At startup, prefs needs to be called with a list of all the pref names and |
| 151 // types we'll be using. | 151 // types we'll be using. |
| 152 static void RegisterPrefs(PrefRegistrySimple* registry); | 152 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 153 | 153 |
| 154 // HistogramFlattener: | 154 // HistogramFlattener: |
| 155 virtual void RecordDelta(const base::HistogramBase& histogram, | 155 void RecordDelta(const base::HistogramBase& histogram, |
| 156 const base::HistogramSamples& snapshot) override; | 156 const base::HistogramSamples& snapshot) override; |
| 157 virtual void InconsistencyDetected( | 157 void InconsistencyDetected( |
| 158 base::HistogramBase::Inconsistency problem) override; | 158 base::HistogramBase::Inconsistency problem) override; |
| 159 virtual void UniqueInconsistencyDetected( | 159 void UniqueInconsistencyDetected( |
| 160 base::HistogramBase::Inconsistency problem) override; | 160 base::HistogramBase::Inconsistency problem) override; |
| 161 virtual void InconsistencyDetectedInLoggedCount(int amount) override; | 161 void InconsistencyDetectedInLoggedCount(int amount) override; |
| 162 | 162 |
| 163 // This should be called when the application is not idle, i.e. the user seems | 163 // This should be called when the application is not idle, i.e. the user seems |
| 164 // to be interacting with the application. | 164 // to be interacting with the application. |
| 165 void OnApplicationNotIdle(); | 165 void OnApplicationNotIdle(); |
| 166 | 166 |
| 167 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is | 167 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is |
| 168 // reset when RecordCompletedSessionEnd is invoked. | 168 // reset when RecordCompletedSessionEnd is invoked. |
| 169 void RecordStartOfSessionEnd(); | 169 void RecordStartOfSessionEnd(); |
| 170 | 170 |
| 171 // This should be called when the application is shutting down. It records | 171 // This should be called when the application is shutting down. It records |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 // Weak pointers factory used for saving state. All weak pointers managed by | 466 // Weak pointers factory used for saving state. All weak pointers managed by |
| 467 // this factory are invalidated in ScheduleNextStateSave. | 467 // this factory are invalidated in ScheduleNextStateSave. |
| 468 base::WeakPtrFactory<MetricsService> state_saver_factory_; | 468 base::WeakPtrFactory<MetricsService> state_saver_factory_; |
| 469 | 469 |
| 470 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 470 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 471 }; | 471 }; |
| 472 | 472 |
| 473 } // namespace metrics | 473 } // namespace metrics |
| 474 | 474 |
| 475 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ | 475 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |