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

Unified Diff: chrome/browser/metrics/metrics_service.h

Issue 10830241: Inform GetEntropySource of whether or not metrics reporting will be enabled. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added browsertest 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_service.h
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 90e0ea5ec2cce2de4f8a59fe04821a906c1351da..9438907ea4f50daec992474e8a328236a5cf87d8 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -71,6 +71,15 @@ class MetricsService
public net::URLFetcherDelegate,
public MetricsServiceBase {
public:
+ // Designates which entropy source was returned from this MetricsService.
+ // This is used for testing to validate that we return the correct source
+ // depending on the state of the service.
+ enum EntropySourceReturned {
+ LAST_ENTROPY_NONE,
+ LAST_ENTROPY_LOW,
+ LAST_ENTROPY_HIGH,
+ };
Ilya Sherman 2012/08/09 20:41:18 nit: Can we make this (and the corresponding gette
SteveT 2012/08/09 21:07:59 Sure can! Done.
+
MetricsService();
virtual ~MetricsService();
@@ -87,10 +96,22 @@ class MetricsService
std::string GetClientId();
// Returns the preferred entropy source used to seed persistent activities
- // based on whether or not metrics reporting is permitted on this client. If
- // it is permitted, this returns the client ID concatenated with the low
- // entropy source. Otherwise, this just returns the low entropy source.
- std::string GetEntropySource();
+ // based on whether or not metrics reporting will permitted on this client.
+ // The caller must determine if metrics reporting will be enabled for this
+ // client and pass that state in as |reporting_will_be_enabled|. If
+ // |reporting_will_be_enabled| is true, this method returns the client ID
+ // concatenated with the low entropy source. Otherwise, this method just
+ // returns the low entropy source. Note that this reporting state can not be
+ // checked by reporting_active() because this method may need to be called
+ // before the MetricsService needs to be started.
+ std::string GetEntropySource(bool reporting_will_be_enabled);
+
+ // Returns the last entropy source that was returned by this service since
+ // start up, or NONE if neither was returned yet. This is exposed for testing
+ // only.
+ EntropySourceReturned entropy_source_returned() const {
+ return entropy_source_returned_;
+ }
// Force the client ID to be generated. This is useful in case it's needed
// before recording.
@@ -462,6 +483,9 @@ class MetricsService
scoped_refptr<chromeos::ExternalMetrics> external_metrics_;
#endif
+ // The last entropy source returned by this service, used for testing.
+ EntropySourceReturned entropy_source_returned_;
+
// Reduntant marker to check that we completed our shutdown, and set the
// exited-cleanly bit in the prefs.
static ShutdownCleanliness clean_shutdown_status_;

Powered by Google App Engine
This is Rietveld 408576698