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

Unified 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, 9 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
Index: chrome/browser/metrics/cloned_install_detector.cc
diff --git a/chrome/browser/metrics/cloned_install_detector.cc b/chrome/browser/metrics/cloned_install_detector.cc
index 3ecfd2ccea742a6e4a0d5c52cf70f0b7ddc5f6c9..329bf865d86a8c023d58755e6873bc0e1f67c625 100644
--- a/chrome/browser/metrics/cloned_install_detector.cc
+++ b/chrome/browser/metrics/cloned_install_detector.cc
@@ -49,7 +49,8 @@ ClonedInstallDetector::ClonedInstallDetector(MachineIdProvider* raw_id_provider)
ClonedInstallDetector::~ClonedInstallDetector() {}
void ClonedInstallDetector::CheckForClonedInstall(PrefService* local_state) {
- content::BrowserThread::PostTaskAndReplyWithResult(
+ DVLOG(2) << "\n\nabout to post some tasks.\n\n";
+ bool res = content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&metrics::MachineIdProvider::GetMachineId,
@@ -57,11 +58,13 @@ void ClonedInstallDetector::CheckForClonedInstall(PrefService* local_state) {
base::Bind(&metrics::ClonedInstallDetector::SaveMachineId,
weak_ptr_factory_.GetWeakPtr(),
local_state));
+ DVLOG(2) << "\n\ntask posted? " << res << "\n\n";
}
void ClonedInstallDetector::SaveMachineId(
PrefService* local_state,
std::string raw_id) {
+ DVLOG(2) << "\n\nsaving id: " << raw_id << "\n\n";
if (raw_id.empty()) {
LogMachineIdState(ID_GENERATION_FAILED);
local_state->ClearPref(prefs::kMetricsMachineId);
@@ -72,8 +75,12 @@ void ClonedInstallDetector::SaveMachineId(
MachineIdState id_state = ID_NO_STORED_VALUE;
if (local_state->HasPrefPath(prefs::kMetricsMachineId)) {
- id_state = local_state->GetInteger(prefs::kMetricsMachineId) == hashed_id ?
- ID_UNCHANGED : ID_CHANGED;
+ if (local_state->GetInteger(prefs::kMetricsMachineId) != hashed_id) {
+ id_state = ID_CHANGED;
+ local_state->SetBoolean(prefs::kMetricsCloneDetected, true);
+ } else {
+ id_state = ID_UNCHANGED;
+ }
}
LogMachineIdState(id_state);
@@ -84,6 +91,7 @@ void ClonedInstallDetector::SaveMachineId(
// static
void ClonedInstallDetector::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterIntegerPref(prefs::kMetricsMachineId, 0);
+ registry->RegisterBooleanPref(prefs::kMetricsCloneDetected, false);
}
} // namespace metrics

Powered by Google App Engine
This is Rietveld 408576698