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

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

Issue 1984003002: Use low entropy for studies that send experiment IDs to Google properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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_service.cc ('k') | components/metrics/metrics_state_manager.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 #ifndef COMPONENTS_METRICS_METRICS_STATE_MANAGER_H_ 5 #ifndef COMPONENTS_METRICS_METRICS_STATE_MANAGER_H_
6 #define COMPONENTS_METRICS_METRICS_STATE_MANAGER_H_ 6 #define COMPONENTS_METRICS_METRICS_STATE_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Checks if this install was cloned or imaged from another machine. If a 55 // Checks if this install was cloned or imaged from another machine. If a
56 // clone is detected, resets the client id and low entropy source. This 56 // clone is detected, resets the client id and low entropy source. This
57 // should not be called more than once. 57 // should not be called more than once.
58 void CheckForClonedInstall( 58 void CheckForClonedInstall(
59 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
60 60
61 // Returns the preferred entropy provider used to seed persistent activities 61 // Returns the preferred entropy provider used to seed persistent activities
62 // based on whether or not metrics reporting is permitted on this client. 62 // based on whether or not metrics reporting is permitted on this client.
63 // 63 //
64 // If metrics reporting is enabled, this method returns an entropy provider 64 // If there's consent to report metrics, this method returns an entropy
65 // that has a high source of entropy, partially based on the client ID. 65 // provider that has a high source of entropy, partially based on the client
66 // Otherwise, it returns an entropy provider that is based on a low entropy 66 // ID. Otherwise, it returns an entropy provider that is based on a low
67 // source. 67 // entropy source.
68 std::unique_ptr<const base::FieldTrial::EntropyProvider> 68 std::unique_ptr<const base::FieldTrial::EntropyProvider>
69 CreateEntropyProvider(); 69 CreateDefaultEntropyProvider();
70
71 // Returns an entropy provider that is based on a low entropy source. This
72 // provider is the same type of provider returned by
73 // CreateDefaultEntropyProvider when there's no consent to report metrics, but
74 // will be a new instance.
75 std::unique_ptr<const base::FieldTrial::EntropyProvider>
76 CreateLowEntropyProvider();
70 77
71 // Creates the MetricsStateManager, enforcing that only a single instance 78 // Creates the MetricsStateManager, enforcing that only a single instance
72 // of the class exists at a time. Returns NULL if an instance exists already. 79 // of the class exists at a time. Returns NULL if an instance exists already.
73 static std::unique_ptr<MetricsStateManager> Create( 80 static std::unique_ptr<MetricsStateManager> Create(
74 PrefService* local_state, 81 PrefService* local_state,
75 EnabledStateProvider* enabled_state_provider, 82 EnabledStateProvider* enabled_state_provider,
76 const StoreClientInfoCallback& store_client_info, 83 const StoreClientInfoCallback& store_client_info,
77 const LoadClientInfoCallback& load_client_info); 84 const LoadClientInfoCallback& load_client_info);
78 85
79 // Registers local state prefs used by this class. 86 // Registers local state prefs used by this class.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 EntropySourceType entropy_source_returned_; 175 EntropySourceType entropy_source_returned_;
169 176
170 std::unique_ptr<ClonedInstallDetector> cloned_install_detector_; 177 std::unique_ptr<ClonedInstallDetector> cloned_install_detector_;
171 178
172 DISALLOW_COPY_AND_ASSIGN(MetricsStateManager); 179 DISALLOW_COPY_AND_ASSIGN(MetricsStateManager);
173 }; 180 };
174 181
175 } // namespace metrics 182 } // namespace metrics
176 183
177 #endif // COMPONENTS_METRICS_METRICS_STATE_MANAGER_H_ 184 #endif // COMPONENTS_METRICS_METRICS_STATE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/metrics/metrics_service.cc ('k') | components/metrics/metrics_state_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698