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

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

Issue 28315: The MetricsService are not initialized unless the user have opted in... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 10 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 10695)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -423,6 +423,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 {
@@ -585,16 +598,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->SetString(prefs::kMetricsClientIDTimestamp,
- Int64ToWString(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