| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 client_id_with_dashes.push_back(*client_id_it); | 250 client_id_with_dashes.push_back(*client_id_it); |
| 251 ++client_id_it; | 251 ++client_id_it; |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 DCHECK(client_id_it == client_info->client_id.end()); | 254 DCHECK(client_id_it == client_info->client_id.end()); |
| 255 client_info->client_id.assign(client_id_with_dashes); | 255 client_info->client_id.assign(client_id_with_dashes); |
| 256 } | 256 } |
| 257 | 257 |
| 258 // The GUID retrieved (and possibly fixed above) should be valid unless | 258 // The GUID retrieved (and possibly fixed above) should be valid unless |
| 259 // retrieval failed. | 259 // retrieval failed. |
| 260 DCHECK(!client_info || base::IsValidGUID(client_info->client_id)); | 260 // DCHECK(!client_info || base::IsValidGUID(client_info->client_id)); |
| 261 // Temporary hack for http://crbug.com/635255. |
| 262 // TODO(asvitkine): address this the right way. |
| 263 if (client_info && !base::IsValidGUID(client_info->client_id)) |
| 264 return nullptr; |
| 261 | 265 |
| 262 return client_info; | 266 return client_info; |
| 263 } | 267 } |
| 264 | 268 |
| 265 int MetricsStateManager::GetLowEntropySource() { | 269 int MetricsStateManager::GetLowEntropySource() { |
| 266 UpdateLowEntropySource(); | 270 UpdateLowEntropySource(); |
| 267 return low_entropy_source_; | 271 return low_entropy_source_; |
| 268 } | 272 } |
| 269 | 273 |
| 270 void MetricsStateManager::UpdateLowEntropySource() { | 274 void MetricsStateManager::UpdateLowEntropySource() { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 321 |
| 318 local_state_->ClearPref(prefs::kMetricsClientID); | 322 local_state_->ClearPref(prefs::kMetricsClientID); |
| 319 local_state_->ClearPref(prefs::kMetricsLowEntropySource); | 323 local_state_->ClearPref(prefs::kMetricsLowEntropySource); |
| 320 local_state_->ClearPref(prefs::kMetricsResetIds); | 324 local_state_->ClearPref(prefs::kMetricsResetIds); |
| 321 | 325 |
| 322 // Also clear the backed up client info. | 326 // Also clear the backed up client info. |
| 323 store_client_info_.Run(ClientInfo()); | 327 store_client_info_.Run(ClientInfo()); |
| 324 } | 328 } |
| 325 | 329 |
| 326 } // namespace metrics | 330 } // namespace metrics |
| OLD | NEW |