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

Side by Side Diff: chrome/browser/metrics/metrics_service.h

Issue 10830318: Use a different algorithm with the low entropy source for field trials. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
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 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 CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
10 10
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/metrics/field_trial.h"
19 #include "base/process_util.h" 20 #include "base/process_util.h"
20 #include "chrome/browser/metrics/metrics_log.h" 21 #include "chrome/browser/metrics/metrics_log.h"
21 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" 22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h"
22 #include "chrome/common/metrics/metrics_service_base.h" 23 #include "chrome/common/metrics/metrics_service_base.h"
23 #include "chrome/installer/util/google_update_settings.h" 24 #include "chrome/installer/util/google_update_settings.h"
24 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
25 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
26 #include "net/url_request/url_fetcher_delegate.h" 27 #include "net/url_request/url_fetcher_delegate.h"
27 28
28 #if defined(OS_CHROMEOS) 29 #if defined(OS_CHROMEOS)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // StartRecordingOnly starts the metrics recording but not reporting, for use 80 // StartRecordingOnly starts the metrics recording but not reporting, for use
80 // in tests only. 81 // in tests only.
81 void Start(); 82 void Start();
82 void StartRecordingOnly(); 83 void StartRecordingOnly();
83 void Stop(); 84 void Stop();
84 85
85 // Returns the client ID for this client, or the empty string if metrics 86 // Returns the client ID for this client, or the empty string if metrics
86 // recording is not currently running. 87 // recording is not currently running.
87 std::string GetClientId(); 88 std::string GetClientId();
88 89
89 // Returns the preferred entropy source used to seed persistent activities 90 // Returns the preferred entropy provider used to seed persistent activities
90 // based on whether or not metrics reporting will permitted on this client. 91 // based on whether or not metrics reporting will be permitted on this client.
91 // The caller must determine if metrics reporting will be enabled for this 92 // The caller must determine if metrics reporting will be enabled for this
92 // client and pass that state in as |reporting_will_be_enabled|. If 93 // client and pass that state in as |reporting_will_be_enabled|.
93 // |reporting_will_be_enabled| is true, this method returns the client ID 94 //
94 // concatenated with the low entropy source. Otherwise, this method just 95 // If |reporting_will_be_enabled| is true, this method returns an entropy
95 // returns the low entropy source. Note that this reporting state can not be 96 // provider that has a high source of entropy, partially based on the client
96 // checked by reporting_active() because this method may need to be called 97 // ID. Otherwise, an entropy provider that is based on a low entropy source
97 // before the MetricsService needs to be started. 98 // is returned.
98 std::string GetEntropySource(bool reporting_will_be_enabled); 99 //
100 // Note that this reporting state can not be checked by reporting_active()
101 // because this method may need to be called before the MetricsService needs
102 // to be started.
103 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(
104 bool reporting_will_be_enabled);
99 105
100 // Force the client ID to be generated. This is useful in case it's needed 106 // Force the client ID to be generated. This is useful in case it's needed
101 // before recording. 107 // before recording.
102 void ForceClientIdCreation(); 108 void ForceClientIdCreation();
103 109
104 // At startup, prefs needs to be called with a list of all the pref names and 110 // At startup, prefs needs to be called with a list of all the pref names and
105 // types we'll be using. 111 // types we'll be using.
106 static void RegisterPrefs(PrefService* local_state); 112 static void RegisterPrefs(PrefService* local_state);
107 113
108 // Set up notifications which indicate that a user is performing work. This is 114 // Set up notifications which indicate that a user is performing work. This is
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 friend bool prerender::IsOmniboxEnabled(Profile* profile); 513 friend bool prerender::IsOmniboxEnabled(Profile* profile);
508 friend class extensions::ExtensionDownloader; 514 friend class extensions::ExtensionDownloader;
509 515
510 // Returns true if prefs::kMetricsReportingEnabled is set. 516 // Returns true if prefs::kMetricsReportingEnabled is set.
511 static bool IsMetricsReportingEnabled(); 517 static bool IsMetricsReportingEnabled();
512 518
513 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); 519 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
514 }; 520 };
515 521
516 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 522 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_unittest.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698