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

Side by Side Diff: components/metrics/metrics_state_manager.cc

Issue 636363004: Make remaining parts of components/metrics use metrics namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix cros compile Created 6 years, 2 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 ClientInfo client_info; 225 ClientInfo client_info;
226 client_info.client_id = client_id_; 226 client_info.client_id = client_id_;
227 client_info.installation_date = local_state_->GetInt64(prefs::kInstallDate); 227 client_info.installation_date = local_state_->GetInt64(prefs::kInstallDate);
228 client_info.reporting_enabled_date = 228 client_info.reporting_enabled_date =
229 local_state_->GetInt64(prefs::kMetricsReportingEnabledTimestamp); 229 local_state_->GetInt64(prefs::kMetricsReportingEnabledTimestamp);
230 store_client_info_.Run(client_info); 230 store_client_info_.Run(client_info);
231 } 231 }
232 232
233 scoped_ptr<ClientInfo> MetricsStateManager::LoadClientInfoAndMaybeMigrate() { 233 scoped_ptr<ClientInfo> MetricsStateManager::LoadClientInfoAndMaybeMigrate() {
234 scoped_ptr<metrics::ClientInfo> client_info = load_client_info_.Run(); 234 scoped_ptr<ClientInfo> client_info = load_client_info_.Run();
235 235
236 // Prior to 2014-07, the client ID was stripped of its dashes before being 236 // Prior to 2014-07, the client ID was stripped of its dashes before being
237 // saved. Migrate back to a proper GUID if this is the case. This migration 237 // saved. Migrate back to a proper GUID if this is the case. This migration
238 // code can be removed in M41+. 238 // code can be removed in M41+.
239 const size_t kGUIDLengthWithoutDashes = 32U; 239 const size_t kGUIDLengthWithoutDashes = 32U;
240 if (client_info && 240 if (client_info &&
241 client_info->client_id.length() == kGUIDLengthWithoutDashes) { 241 client_info->client_id.length() == kGUIDLengthWithoutDashes) {
242 DCHECK(client_info->client_id.find('-') == std::string::npos); 242 DCHECK(client_info->client_id.find('-') == std::string::npos);
243 243
244 std::string client_id_with_dashes; 244 std::string client_id_with_dashes;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 local_state_->ClearPref(prefs::kMetricsClientID); 307 local_state_->ClearPref(prefs::kMetricsClientID);
308 local_state_->ClearPref(prefs::kMetricsLowEntropySource); 308 local_state_->ClearPref(prefs::kMetricsLowEntropySource);
309 local_state_->ClearPref(prefs::kMetricsResetIds); 309 local_state_->ClearPref(prefs::kMetricsResetIds);
310 310
311 // Also clear the backed up client info. 311 // Also clear the backed up client info.
312 store_client_info_.Run(ClientInfo()); 312 store_client_info_.Run(ClientInfo());
313 } 313 }
314 314
315 } // namespace metrics 315 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_service_unittest.cc ('k') | components/metrics/net/network_metrics_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698