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

Side by Side Diff: chrome/browser/metrics/cloned_install_detector.cc

Issue 213363004: Resetting metrics ids on clump detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 "chrome/browser/metrics/cloned_install_detector.h" 5 #include "chrome/browser/metrics/cloned_install_detector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (raw_id.empty()) { 65 if (raw_id.empty()) {
66 LogMachineIdState(ID_GENERATION_FAILED); 66 LogMachineIdState(ID_GENERATION_FAILED);
67 local_state->ClearPref(prefs::kMetricsMachineId); 67 local_state->ClearPref(prefs::kMetricsMachineId);
68 return; 68 return;
69 } 69 }
70 70
71 int hashed_id = HashRawId(raw_id); 71 int hashed_id = HashRawId(raw_id);
72 72
73 MachineIdState id_state = ID_NO_STORED_VALUE; 73 MachineIdState id_state = ID_NO_STORED_VALUE;
74 if (local_state->HasPrefPath(prefs::kMetricsMachineId)) { 74 if (local_state->HasPrefPath(prefs::kMetricsMachineId)) {
75 id_state = local_state->GetInteger(prefs::kMetricsMachineId) == hashed_id ? 75 if (local_state->GetInteger(prefs::kMetricsMachineId) != hashed_id) {
76 ID_UNCHANGED : ID_CHANGED; 76 id_state = ID_CHANGED;
77 // TODO(jwd): Use a callback to set the reset pref. That way
78 // ClonedInstallDetector doesn't need to know about this pref.
79 local_state->SetBoolean(prefs::kMetricsResetIds, true);
80 } else {
81 id_state = ID_UNCHANGED;
82 }
77 } 83 }
78 84
79 LogMachineIdState(id_state); 85 LogMachineIdState(id_state);
80 86
81 local_state->SetInteger(prefs::kMetricsMachineId, hashed_id); 87 local_state->SetInteger(prefs::kMetricsMachineId, hashed_id);
82 } 88 }
83 89
84 // static 90 // static
85 void ClonedInstallDetector::RegisterPrefs(PrefRegistrySimple* registry) { 91 void ClonedInstallDetector::RegisterPrefs(PrefRegistrySimple* registry) {
86 registry->RegisterIntegerPref(prefs::kMetricsMachineId, 0); 92 registry->RegisterIntegerPref(prefs::kMetricsMachineId, 0);
87 } 93 }
88 94
89 } // namespace metrics 95 } // namespace metrics
OLDNEW
« no previous file with comments | « chrome/browser/metrics/cloned_install_detector.h ('k') | chrome/browser/metrics/cloned_install_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698