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 "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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return client_info.Pass(); | 263 return client_info.Pass(); |
264 } | 264 } |
265 | 265 |
266 int MetricsStateManager::GetLowEntropySource() { | 266 int MetricsStateManager::GetLowEntropySource() { |
267 // Note that the default value for the low entropy source and the default pref | 267 // Note that the default value for the low entropy source and the default pref |
268 // value are both kLowEntropySourceNotSet, which is used to identify if the | 268 // value are both kLowEntropySourceNotSet, which is used to identify if the |
269 // value has been set or not. | 269 // value has been set or not. |
270 if (low_entropy_source_ != kLowEntropySourceNotSet) | 270 if (low_entropy_source_ != kLowEntropySourceNotSet) |
271 return low_entropy_source_; | 271 return low_entropy_source_; |
272 | 272 |
273 const CommandLine* command_line(CommandLine::ForCurrentProcess()); | 273 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
274 // Only try to load the value from prefs if the user did not request a | 274 // Only try to load the value from prefs if the user did not request a |
275 // reset. | 275 // reset. |
276 // Otherwise, skip to generating a new value. | 276 // Otherwise, skip to generating a new value. |
277 if (!command_line->HasSwitch(switches::kResetVariationState)) { | 277 if (!command_line->HasSwitch(switches::kResetVariationState)) { |
278 int value = local_state_->GetInteger(prefs::kMetricsLowEntropySource); | 278 int value = local_state_->GetInteger(prefs::kMetricsLowEntropySource); |
279 // If the value is outside the [0, kMaxLowEntropySize) range, re-generate | 279 // If the value is outside the [0, kMaxLowEntropySize) range, re-generate |
280 // it below. | 280 // it below. |
281 if (value >= 0 && value < kMaxLowEntropySize) { | 281 if (value >= 0 && value < kMaxLowEntropySize) { |
282 low_entropy_source_ = value; | 282 low_entropy_source_ = value; |
283 UMA_HISTOGRAM_BOOLEAN("UMA.GeneratedLowEntropySource", false); | 283 UMA_HISTOGRAM_BOOLEAN("UMA.GeneratedLowEntropySource", false); |
(...skipping 22 matching lines...) Expand all Loading... |
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 |
OLD | NEW |