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

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

Issue 40274: The MetricsService are not initialized unless the user have opted in... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
===================================================================
--- chrome/browser/metrics/metrics_service.cc (revision 11199)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -430,6 +430,19 @@
return;
if (enabled) {
+ if (client_id_.empty()) {
+ PrefService* pref = g_browser_process->local_state();
+ DCHECK(pref);
+ client_id_ = WideToUTF8(pref->GetString(prefs::kMetricsClientID));
+ if (client_id_.empty()) {
+ client_id_ = GenerateClientID();
+ pref->SetString(prefs::kMetricsClientID, UTF8ToWide(client_id_));
+
+ // Might as well make a note of how long this ID has existed
+ pref->SetString(prefs::kMetricsClientIDTimestamp,
+ Int64ToWString(Time::Now().ToTimeT()));
+ }
+ }
StartRecording();
ListenerRegistration(true);
} else {
@@ -592,15 +605,6 @@
UTF8ToWide(MetricsLog::GetVersionString()));
}
- client_id_ = WideToUTF8(pref->GetString(prefs::kMetricsClientID));
- if (client_id_.empty()) {
- client_id_ = GenerateClientID();
- pref->SetString(prefs::kMetricsClientID, UTF8ToWide(client_id_));
-
- // Might as well make a note of how long this ID has existed
- pref->SetInt64(prefs::kMetricsClientIDTimestamp, Time::Now().ToTimeT());
- }
-
// Update session ID
session_id_ = pref->GetInteger(prefs::kMetricsSessionID);
++session_id_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698