Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 DCHECK(CalledOnValidThread()); | 309 DCHECK(CalledOnValidThread()); |
| 310 // Lookup the preference in the default store. | 310 // Lookup the preference in the default store. |
| 311 const base::Value* value = NULL; | 311 const base::Value* value = NULL; |
| 312 if (!pref_registry_->defaults()->GetValue(path, &value)) { | 312 if (!pref_registry_->defaults()->GetValue(path, &value)) { |
| 313 NOTREACHED() << "Default value missing for pref: " << path; | 313 NOTREACHED() << "Default value missing for pref: " << path; |
| 314 return NULL; | 314 return NULL; |
| 315 } | 315 } |
| 316 return value; | 316 return value; |
| 317 } | 317 } |
| 318 | 318 |
| 319 uint32 PrefService::GetRegistrationFlags(const std::string& path) const { | |
| 320 DCHECK(CalledOnValidThread()); | |
| 321 const auto& it = pref_registry_->registration_flags().find(path); | |
| 322 if (it == pref_registry_->registration_flags().end()) { | |
|
Mattias Nissler (ping if slow)
2015/04/20 09:33:34
I'd prefer having this logic in PrefRegistry, and
raymes
2015/04/21 07:58:54
Sounds good but the function isn't used at all for
| |
| 323 NOTREACHED() << "Registration flags missing for pref: " << path; | |
| 324 return PrefRegistry::NO_REGISTRATION_FLAGS; | |
| 325 } | |
| 326 return it->second; | |
| 327 } | |
| 328 | |
| 319 const base::ListValue* PrefService::GetList(const std::string& path) const { | 329 const base::ListValue* PrefService::GetList(const std::string& path) const { |
| 320 DCHECK(CalledOnValidThread()); | 330 DCHECK(CalledOnValidThread()); |
| 321 | 331 |
| 322 const base::Value* value = GetPreferenceValue(path); | 332 const base::Value* value = GetPreferenceValue(path); |
| 323 if (!value) { | 333 if (!value) { |
| 324 NOTREACHED() << "Trying to read an unregistered pref: " << path; | 334 NOTREACHED() << "Trying to read an unregistered pref: " << path; |
| 325 return NULL; | 335 return NULL; |
| 326 } | 336 } |
| 327 if (value->GetType() != base::Value::TYPE_LIST) { | 337 if (value->GetType() != base::Value::TYPE_LIST) { |
| 328 NOTREACHED(); | 338 NOTREACHED(); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 DCHECK(found_value->IsType(default_type)); | 594 DCHECK(found_value->IsType(default_type)); |
| 585 return found_value; | 595 return found_value; |
| 586 } else { | 596 } else { |
| 587 // Every registered preference has at least a default value. | 597 // Every registered preference has at least a default value. |
| 588 NOTREACHED() << "no valid value found for registered pref " << path; | 598 NOTREACHED() << "no valid value found for registered pref " << path; |
| 589 } | 599 } |
| 590 } | 600 } |
| 591 | 601 |
| 592 return NULL; | 602 return NULL; |
| 593 } | 603 } |
| OLD | NEW |