| 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 "components/prefs/pref_service.h" | 5 #include "components/prefs/pref_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 528 |
| 529 const std::string PrefService::Preference::name() const { | 529 const std::string PrefService::Preference::name() const { |
| 530 return name_; | 530 return name_; |
| 531 } | 531 } |
| 532 | 532 |
| 533 base::Value::Type PrefService::Preference::GetType() const { | 533 base::Value::Type PrefService::Preference::GetType() const { |
| 534 return type_; | 534 return type_; |
| 535 } | 535 } |
| 536 | 536 |
| 537 const base::Value* PrefService::Preference::GetValue() const { | 537 const base::Value* PrefService::Preference::GetValue() const { |
| 538 const base::Value* result= pref_service_->GetPreferenceValue(name_); | 538 const base::Value* result = pref_service_->GetPreferenceValue(name_); |
| 539 DCHECK(result) << "Must register pref before getting its value"; | 539 DCHECK(result) << "Must register pref before getting its value"; |
| 540 return result; | 540 return result; |
| 541 } | 541 } |
| 542 | 542 |
| 543 const base::Value* PrefService::Preference::GetRecommendedValue() const { | 543 const base::Value* PrefService::Preference::GetRecommendedValue() const { |
| 544 DCHECK(pref_service_->FindPreference(name_)) | 544 DCHECK(pref_service_->FindPreference(name_)) |
| 545 << "Must register pref before getting its value"; | 545 << "Must register pref before getting its value"; |
| 546 | 546 |
| 547 const base::Value* found_value = NULL; | 547 const base::Value* found_value = NULL; |
| 548 if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) { | 548 if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 DCHECK(found_value->IsType(default_type)); | 613 DCHECK(found_value->IsType(default_type)); |
| 614 return found_value; | 614 return found_value; |
| 615 } else { | 615 } else { |
| 616 // Every registered preference has at least a default value. | 616 // Every registered preference has at least a default value. |
| 617 NOTREACHED() << "no valid value found for registered pref " << path; | 617 NOTREACHED() << "no valid value found for registered pref " << path; |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 return NULL; | 621 return NULL; |
| 622 } | 622 } |
| OLD | NEW |