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

Side by Side Diff: chrome/browser/android/metrics/uma_session_stats.cc

Issue 2222903004: Clear client id prefs when opting out of UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove early return in ForceClientIdCreation(). Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/metrics/uma_session_stats.h" 5 #include "chrome/browser/android/metrics/uma_session_stats.h"
6 6
7 #include "base/android/jni_array.h" 7 #include "base/android/jni_array.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (metrics->recording_active() != may_record) { 110 if (metrics->recording_active() != may_record) {
111 // This function puts a consent file with the ClientID in the 111 // This function puts a consent file with the ClientID in the
112 // data directory. The ID is passed to the renderer for crash 112 // data directory. The ID is passed to the renderer for crash
113 // reporting when things go wrong. 113 // reporting when things go wrong.
114 content::BrowserThread::GetBlockingPool()->PostTask(FROM_HERE, 114 content::BrowserThread::GetBlockingPool()->PostTask(FROM_HERE,
115 base::Bind( 115 base::Bind(
116 base::IgnoreResult(GoogleUpdateSettings::SetCollectStatsConsent), 116 base::IgnoreResult(GoogleUpdateSettings::SetCollectStatsConsent),
117 may_record)); 117 may_record));
118 } 118 }
119 119
120 // Clear the client id pref when opting out. Note: Mirrors code in
121 // metrics_reporting_state.cc. TODO(asvitkine): Unify.
122 if (!may_record) {
123 // Note: Clearing client id will not affect the running state (e.g. field
124 // trial randomization), as the pref is only read on startup.
125 g_browser_process->local_state()->ClearPref(
126 metrics::prefs::kMetricsClientID);
127 g_browser_process->local_state()->ClearPref(
128 metrics::prefs::kMetricsReportingEnabledTimestamp);
129 }
130
120 g_browser_process->GetMetricsServicesManager()->UpdatePermissions( 131 g_browser_process->GetMetricsServicesManager()->UpdatePermissions(
121 may_record, may_upload); 132 may_record, may_upload);
122 } 133 }
123 134
124 // Renderer process crashed in the foreground. 135 // Renderer process crashed in the foreground.
125 static void LogRendererCrash(JNIEnv*, const JavaParamRef<jclass>&) { 136 static void LogRendererCrash(JNIEnv*, const JavaParamRef<jclass>&) {
126 DCHECK(g_browser_process); 137 DCHECK(g_browser_process);
127 // Increment the renderer crash count in stability metrics. 138 // Increment the renderer crash count in stability metrics.
128 PrefService* pref = g_browser_process->local_state(); 139 PrefService* pref = g_browser_process->local_state();
129 DCHECK(pref); 140 DCHECK(pref);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // We should have only one UmaSessionStats instance. 223 // We should have only one UmaSessionStats instance.
213 DCHECK(!g_uma_session_stats); 224 DCHECK(!g_uma_session_stats);
214 g_uma_session_stats = new UmaSessionStats(); 225 g_uma_session_stats = new UmaSessionStats();
215 return reinterpret_cast<intptr_t>(g_uma_session_stats); 226 return reinterpret_cast<intptr_t>(g_uma_session_stats);
216 } 227 }
217 228
218 // Register native methods 229 // Register native methods
219 bool RegisterUmaSessionStats(JNIEnv* env) { 230 bool RegisterUmaSessionStats(JNIEnv* env) {
220 return RegisterNativesImpl(env); 231 return RegisterNativesImpl(env);
221 } 232 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_reporting_state.cc » ('j') | chrome/installer/util/google_update_settings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698