Index: chrome/browser/metrics/metrics_state_manager.h |
diff --git a/chrome/browser/metrics/metrics_state_manager.h b/chrome/browser/metrics/metrics_state_manager.h |
index 5b2f954887a490623e14f957fc8a8577611e6390..bf8f1f4e6ba6ed7d6eef18ad59ee55bcd3504f06 100644 |
--- a/chrome/browser/metrics/metrics_state_manager.h |
+++ b/chrome/browser/metrics/metrics_state_manager.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "base/gtest_prod_util.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/metrics/field_trial.h" |
@@ -27,8 +28,6 @@ class MetricsStateManager { |
virtual ~MetricsStateManager(); |
// Returns true if the user opted in to sending metric reports. |
- // TODO(asvitkine): This function does not report the correct value on |
- // Android, see http://crbug.com/362192. |
bool IsMetricsReportingEnabled(); |
// Returns the client ID for this client, or the empty string if the user is |
@@ -55,7 +54,9 @@ class MetricsStateManager { |
// Creates the MetricsStateManager, enforcing that only a single instance |
// of the class exists at a time. Returns NULL if an instance exists already. |
- static scoped_ptr<MetricsStateManager> Create(PrefService* local_state); |
+ static scoped_ptr<MetricsStateManager> Create( |
+ PrefService* local_state, |
+ const base::Callback<bool(void)>& is_reporting_enabled_callback); |
// Registers local state prefs used by this class. |
static void RegisterPrefs(PrefRegistrySimple* registry); |
@@ -77,10 +78,13 @@ class MetricsStateManager { |
ENTROPY_SOURCE_HIGH, |
}; |
- // Creates the MetricsStateManager with the given |local_state|. Clients |
- // should instead use Create(), which enforces a single instance of this class |
- // is alive at any given time. |
- explicit MetricsStateManager(PrefService* local_state); |
+ // Creates the MetricsStateManager with the given |local_state|. Calls |
+ // |is_reporting_enabled_callback| to query whether metrics reporting is |
+ // enabled. Clients should instead use Create(), which enforces a single |
+ // instance of this class is alive at any given time. |
+ MetricsStateManager( |
+ PrefService* local_state, |
+ const base::Callback<bool(void)>& is_reporting_enabled_callback); |
// Returns the low entropy source for this client. This is a random value |
// that is non-identifying amongst browser clients. This method will |
@@ -103,7 +107,9 @@ class MetricsStateManager { |
static bool instance_exists_; |
// Weak pointer to the local state prefs store. |
- PrefService* local_state_; |
+ PrefService* const local_state_; |
Alexei Svitkine (slow)
2014/05/19 14:00:11
Nit: I don't think this type of const for pointers
Ilya Sherman
2014/05/19 14:03:36
Codesearch suggests it's used a lot. I like const
|
+ |
+ const base::Callback<bool(void)> is_reporting_enabled_callback_; |
// The identifier that's sent to the server with the log reports. |
std::string client_id_; |