Chromium Code Reviews| 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); |
|
Alexei Svitkine (slow)
2014/03/26 21:34:50
Is there a way we can make the querying and settin
|
| + } 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 |