| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } else { | 254 } else { |
| 255 client_id_with_dashes.push_back(*client_id_it); | 255 client_id_with_dashes.push_back(*client_id_it); |
| 256 ++client_id_it; | 256 ++client_id_it; |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 DCHECK(client_id_it == client_info->client_id.end()); | 259 DCHECK(client_id_it == client_info->client_id.end()); |
| 260 client_info->client_id.assign(client_id_with_dashes); | 260 client_info->client_id.assign(client_id_with_dashes); |
| 261 } | 261 } |
| 262 | 262 |
| 263 // The GUID retrieved (and possibly fixed above) should be valid unless | 263 // The GUID retrieved (and possibly fixed above) should be valid unless |
| 264 // retrieval failed. | 264 // retrieval failed. If not, return nullptr. This will result in a new GUID |
| 265 // DCHECK(!client_info || base::IsValidGUID(client_info->client_id)); | 265 // being generated by the calling function ForceClientIdCreation(). |
| 266 // Temporary hack for http://crbug.com/635255. | |
| 267 // TODO(asvitkine): address this the right way. | |
| 268 if (client_info && !base::IsValidGUID(client_info->client_id)) | 266 if (client_info && !base::IsValidGUID(client_info->client_id)) |
| 269 return nullptr; | 267 return nullptr; |
| 270 | 268 |
| 271 return client_info; | 269 return client_info; |
| 272 } | 270 } |
| 273 | 271 |
| 274 int MetricsStateManager::GetLowEntropySource() { | 272 int MetricsStateManager::GetLowEntropySource() { |
| 275 UpdateLowEntropySource(); | 273 UpdateLowEntropySource(); |
| 276 return low_entropy_source_; | 274 return low_entropy_source_; |
| 277 } | 275 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 324 |
| 327 local_state_->ClearPref(prefs::kMetricsClientID); | 325 local_state_->ClearPref(prefs::kMetricsClientID); |
| 328 local_state_->ClearPref(prefs::kMetricsLowEntropySource); | 326 local_state_->ClearPref(prefs::kMetricsLowEntropySource); |
| 329 local_state_->ClearPref(prefs::kMetricsResetIds); | 327 local_state_->ClearPref(prefs::kMetricsResetIds); |
| 330 | 328 |
| 331 // Also clear the backed up client info. | 329 // Also clear the backed up client info. |
| 332 store_client_info_.Run(ClientInfo()); | 330 store_client_info_.Run(ClientInfo()); |
| 333 } | 331 } |
| 334 | 332 |
| 335 } // namespace metrics | 333 } // namespace metrics |
| OLD | NEW |