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

Side by Side Diff: components/metrics/metrics_state_manager.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/metrics/metrics_state_manager.h" 5 #include "components/metrics/metrics_state_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 MetricsStateManager::~MetricsStateManager() { 76 MetricsStateManager::~MetricsStateManager() {
77 DCHECK(instance_exists_); 77 DCHECK(instance_exists_);
78 instance_exists_ = false; 78 instance_exists_ = false;
79 } 79 }
80 80
81 bool MetricsStateManager::IsMetricsReportingEnabled() { 81 bool MetricsStateManager::IsMetricsReportingEnabled() {
82 return enabled_state_provider_->IsReportingEnabled(); 82 return enabled_state_provider_->IsReportingEnabled();
83 } 83 }
84 84
85 void MetricsStateManager::ForceClientIdCreation() { 85 void MetricsStateManager::ForceClientIdCreation() {
86 if (!client_id_.empty())
87 return;
88
89 client_id_ = local_state_->GetString(prefs::kMetricsClientID); 86 client_id_ = local_state_->GetString(prefs::kMetricsClientID);
90 if (!client_id_.empty()) { 87 if (!client_id_.empty()) {
91 // It is technically sufficient to only save a backup of the client id when 88 // It is technically sufficient to only save a backup of the client id when
92 // it is initially generated below, but since the backup was only introduced 89 // it is initially generated below, but since the backup was only introduced
93 // in M38, seed it explicitly from here for some time. 90 // in M38, seed it explicitly from here for some time.
94 BackUpCurrentClientInfo(); 91 BackUpCurrentClientInfo();
95 return; 92 return;
96 } 93 }
97 94
98 const std::unique_ptr<ClientInfo> client_info_backup = 95 const std::unique_ptr<ClientInfo> client_info_backup =
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 314
318 local_state_->ClearPref(prefs::kMetricsClientID); 315 local_state_->ClearPref(prefs::kMetricsClientID);
319 local_state_->ClearPref(prefs::kMetricsLowEntropySource); 316 local_state_->ClearPref(prefs::kMetricsLowEntropySource);
320 local_state_->ClearPref(prefs::kMetricsResetIds); 317 local_state_->ClearPref(prefs::kMetricsResetIds);
321 318
322 // Also clear the backed up client info. 319 // Also clear the backed up client info.
323 store_client_info_.Run(ClientInfo()); 320 store_client_info_.Run(ClientInfo());
324 } 321 }
325 322
326 } // namespace metrics 323 } // namespace metrics
OLDNEW
« chrome/installer/util/google_update_settings.cc ('K') | « components/metrics/metrics_pref_names.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698