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

Unified Diff: components/metrics/metrics_state_manager.h

Issue 372473004: Retrieve client_id from GoogleUpdateSettings when its missing from Local State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 5 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: components/metrics/metrics_state_manager.h
diff --git a/components/metrics/metrics_state_manager.h b/components/metrics/metrics_state_manager.h
index 6f13ee9573588c9db1bc298dccd677926c0f1ef2..66870d6275acfd0b86b8c0462d8d22593d867ed3 100644
--- a/components/metrics/metrics_state_manager.h
+++ b/components/metrics/metrics_state_manager.h
@@ -25,6 +25,14 @@ class ClonedInstallDetector;
// not be instantiating or using this class directly.
class MetricsStateManager {
public:
+ // A callback that can be invoked to save client info.
+ typedef base::Callback<bool(const std::string& client_id,
grt (UTC plus 2) 2014/07/08 14:48:01 why not void? the return value is ignored in the i
gab 2014/07/09 19:16:59 Done.
+ int64 installation_date)> SaveClientInfoCallback;
+ // A callback that can be invoked to retrieve client info saved through the
grt (UTC plus 2) 2014/07/08 14:48:01 newline above how about Load/Store rather than Ret
gab 2014/07/09 19:16:59 I like it, done in precursor rename CL.
+ // SaveClientInfoCallback.
+ typedef base::Callback<bool(std::string* client_id, int64* installation_date)>
grt (UTC plus 2) 2014/07/08 14:48:01 consider making this a void function too, and stip
gab 2014/07/09 19:16:59 Actually changed the API altogether here, introduc
+ RetrieveClientInfoCallback;
+
virtual ~MetricsStateManager();
// Returns true if the user opted in to sending metric reports.
@@ -57,7 +65,9 @@ class MetricsStateManager {
// of the class exists at a time. Returns NULL if an instance exists already.
static scoped_ptr<MetricsStateManager> Create(
PrefService* local_state,
- const base::Callback<bool(void)>& is_reporting_enabled_callback);
+ const base::Callback<bool(void)>& is_reporting_enabled_callback,
+ const SaveClientInfoCallback& save_client_info,
+ const RetrieveClientInfoCallback& retrieve_client_info);
// Registers local state prefs used by this class.
static void RegisterPrefs(PrefRegistrySimple* registry);
@@ -81,11 +91,15 @@ class MetricsStateManager {
// 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.
+ // enabled. Clients should instead use Create(), which enforces that a single
+ // instance of this class be alive at any given time.
+ // |save_client_info| should back up client info to solid state such that it
grt (UTC plus 2) 2014/07/08 14:48:01 solid state -> persistent storage (not everyone ro
gab 2014/07/09 19:16:59 Done.
+ // is later retrievable by |retrieve_client_info|.
MetricsStateManager(
PrefService* local_state,
- const base::Callback<bool(void)>& is_reporting_enabled_callback);
+ const base::Callback<bool(void)>& is_reporting_enabled_callback,
+ const SaveClientInfoCallback& save_client_info,
+ const RetrieveClientInfoCallback& retrieve_client_info);
// Returns the low entropy source for this client. This is a random value
// that is non-identifying amongst browser clients. This method will
@@ -112,6 +126,9 @@ class MetricsStateManager {
const base::Callback<bool(void)> is_reporting_enabled_callback_;
+ const SaveClientInfoCallback save_client_info_;
grt (UTC plus 2) 2014/07/08 14:48:01 add doc comments
gab 2014/07/09 19:16:59 I find that in the case of typedef'ed callbacks, a
grt (UTC plus 2) 2014/07/10 14:03:32 sorry i left out the justification for the request
+ const RetrieveClientInfoCallback retrieve_client_info_;
+
// The identifier that's sent to the server with the log reports.
std::string client_id_;

Powered by Google App Engine
This is Rietveld 408576698