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

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

Issue 284293003: [Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_services_manager.cc ('k') | chrome/browser/metrics/metrics_state_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « chrome/browser/metrics/metrics_services_manager.cc ('k') | chrome/browser/metrics/metrics_state_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698