Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: components/metrics/metrics_service.h

Issue 1030503003: Metrics log modification to handle external components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: newlinewq Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/metrics/metrics_log_unittest.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 epoch.
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
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 // Pushes a log that has been generated by an external component.
251 void PushExternalLog(const std::string& log);
252
246 protected: 253 protected:
247 // Exposed for testing. 254 // Exposed for testing.
248 MetricsLogManager* log_manager() { return &log_manager_; } 255 MetricsLogManager* log_manager() { return &log_manager_; }
249 256
250 private: 257 private:
251 // The MetricsService has a lifecycle that is stored as a state. 258 // The MetricsService has a lifecycle that is stored as a state.
252 // See metrics_service.cc for description of this lifecycle. 259 // See metrics_service.cc for description of this lifecycle.
253 enum State { 260 enum State {
254 INITIALIZED, // Constructor was called. 261 INITIALIZED, // Constructor was called.
255 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to finish. 262 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to finish.
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // Weak pointers factory used for saving state. All weak pointers managed by 495 // Weak pointers factory used for saving state. All weak pointers managed by
489 // this factory are invalidated in ScheduleNextStateSave. 496 // this factory are invalidated in ScheduleNextStateSave.
490 base::WeakPtrFactory<MetricsService> state_saver_factory_; 497 base::WeakPtrFactory<MetricsService> state_saver_factory_;
491 498
492 DISALLOW_COPY_AND_ASSIGN(MetricsService); 499 DISALLOW_COPY_AND_ASSIGN(MetricsService);
493 }; 500 };
494 501
495 } // namespace metrics 502 } // namespace metrics
496 503
497 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ 504 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « components/metrics/metrics_log_unittest.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698