| OLD | NEW |
| 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/metrics_state_manager.h" | 5 #include "chrome/browser/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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (local_state_->GetString(prefs::kMetricsOldClientID).empty()) { | 102 if (local_state_->GetString(prefs::kMetricsOldClientID).empty()) { |
| 103 // Record the timestamp of when the user opted in to UMA. | 103 // Record the timestamp of when the user opted in to UMA. |
| 104 local_state_->SetInt64(prefs::kMetricsReportingEnabledTimestamp, | 104 local_state_->SetInt64(prefs::kMetricsReportingEnabledTimestamp, |
| 105 base::Time::Now().ToTimeT()); | 105 base::Time::Now().ToTimeT()); |
| 106 } else { | 106 } else { |
| 107 UMA_HISTOGRAM_BOOLEAN("UMA.ClientIdMigrated", true); | 107 UMA_HISTOGRAM_BOOLEAN("UMA.ClientIdMigrated", true); |
| 108 } | 108 } |
| 109 local_state_->ClearPref(prefs::kMetricsOldClientID); | 109 local_state_->ClearPref(prefs::kMetricsOldClientID); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void MetricsStateManager::CheckForClonedInstall() { | 112 void MetricsStateManager::CheckForClonedInstall( |
| 113 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 113 DCHECK(!cloned_install_detector_); | 114 DCHECK(!cloned_install_detector_); |
| 114 | 115 |
| 115 MachineIdProvider* provider = MachineIdProvider::CreateInstance(); | 116 MachineIdProvider* provider = MachineIdProvider::CreateInstance(); |
| 116 if (!provider) | 117 if (!provider) |
| 117 return; | 118 return; |
| 118 | 119 |
| 119 cloned_install_detector_.reset(new ClonedInstallDetector(provider)); | 120 cloned_install_detector_.reset(new ClonedInstallDetector(provider)); |
| 120 cloned_install_detector_->CheckForClonedInstall(local_state_); | 121 cloned_install_detector_->CheckForClonedInstall(local_state_, task_runner); |
| 121 } | 122 } |
| 122 | 123 |
| 123 scoped_ptr<const base::FieldTrial::EntropyProvider> | 124 scoped_ptr<const base::FieldTrial::EntropyProvider> |
| 124 MetricsStateManager::CreateEntropyProvider() { | 125 MetricsStateManager::CreateEntropyProvider() { |
| 125 // For metrics reporting-enabled users, we combine the client ID and low | 126 // For metrics reporting-enabled users, we combine the client ID and low |
| 126 // entropy source to get the final entropy source. Otherwise, only use the low | 127 // entropy source to get the final entropy source. Otherwise, only use the low |
| 127 // entropy source. | 128 // entropy source. |
| 128 // This has two useful properties: | 129 // This has two useful properties: |
| 129 // 1) It makes the entropy source less identifiable for parties that do not | 130 // 1) It makes the entropy source less identifiable for parties that do not |
| 130 // know the low entropy source. | 131 // know the low entropy source. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 225 |
| 225 DCHECK(client_id_.empty()); | 226 DCHECK(client_id_.empty()); |
| 226 DCHECK_EQ(kLowEntropySourceNotSet, low_entropy_source_); | 227 DCHECK_EQ(kLowEntropySourceNotSet, low_entropy_source_); |
| 227 | 228 |
| 228 local_state_->ClearPref(prefs::kMetricsClientID); | 229 local_state_->ClearPref(prefs::kMetricsClientID); |
| 229 local_state_->ClearPref(prefs::kMetricsLowEntropySource); | 230 local_state_->ClearPref(prefs::kMetricsLowEntropySource); |
| 230 local_state_->ClearPref(prefs::kMetricsResetIds); | 231 local_state_->ClearPref(prefs::kMetricsResetIds); |
| 231 } | 232 } |
| 232 | 233 |
| 233 } // namespace metrics | 234 } // namespace metrics |
| OLD | NEW |