| 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 "chrome/browser/prefs/pref_service.h" | 5 #include "chrome/browser/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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 return NULL; | 762 return NULL; |
| 763 } | 763 } |
| 764 const Value* value = pref->GetValue(); | 764 const Value* value = pref->GetValue(); |
| 765 if (value->GetType() != Value::TYPE_LIST) { | 765 if (value->GetType() != Value::TYPE_LIST) { |
| 766 NOTREACHED(); | 766 NOTREACHED(); |
| 767 return NULL; | 767 return NULL; |
| 768 } | 768 } |
| 769 return static_cast<const ListValue*>(value); | 769 return static_cast<const ListValue*>(value); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void PrefService::AddPrefObserver(const char* path, | 772 void PrefService::AddPrefObserver(const char* path, PrefObserver* obs) { |
| 773 content::NotificationObserver* obs) { | |
| 774 pref_notifier_->AddPrefObserver(path, obs); | 773 pref_notifier_->AddPrefObserver(path, obs); |
| 775 } | 774 } |
| 776 | 775 |
| 777 void PrefService::RemovePrefObserver(const char* path, | 776 void PrefService::RemovePrefObserver(const char* path, PrefObserver* obs) { |
| 778 content::NotificationObserver* obs) { | |
| 779 pref_notifier_->RemovePrefObserver(path, obs); | 777 pref_notifier_->RemovePrefObserver(path, obs); |
| 780 } | 778 } |
| 781 | 779 |
| 780 void PrefService::AddPrefInitObserver(PrefInitObserver* obs) { |
| 781 pref_notifier_->AddInitObserver(obs); |
| 782 } |
| 783 |
| 784 void PrefService::RemovePrefInitObserver(PrefInitObserver* obs) { |
| 785 pref_notifier_->RemoveInitObserver(obs); |
| 786 } |
| 787 |
| 782 void PrefService::RegisterPreference(const char* path, | 788 void PrefService::RegisterPreference(const char* path, |
| 783 Value* default_value, | 789 Value* default_value, |
| 784 PrefSyncStatus sync_status) { | 790 PrefSyncStatus sync_status) { |
| 785 DCHECK(CalledOnValidThread()); | 791 DCHECK(CalledOnValidThread()); |
| 786 | 792 |
| 787 // The main code path takes ownership, but most don't. We'll be safe. | 793 // The main code path takes ownership, but most don't. We'll be safe. |
| 788 scoped_ptr<Value> scoped_value(default_value); | 794 scoped_ptr<Value> scoped_value(default_value); |
| 789 | 795 |
| 790 if (FindPreference(path)) { | 796 if (FindPreference(path)) { |
| 791 NOTREACHED() << "Tried to register duplicate pref " << path; | 797 NOTREACHED() << "Tried to register duplicate pref " << path; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 1066 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 1061 } | 1067 } |
| 1062 | 1068 |
| 1063 bool PrefService::Preference::IsUserModifiable() const { | 1069 bool PrefService::Preference::IsUserModifiable() const { |
| 1064 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 1070 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 1065 } | 1071 } |
| 1066 | 1072 |
| 1067 bool PrefService::Preference::IsExtensionModifiable() const { | 1073 bool PrefService::Preference::IsExtensionModifiable() const { |
| 1068 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 1074 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 1069 } | 1075 } |
| OLD | NEW |