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(base::Callback<void(bool)> obs) { |
| 781 pref_notifier_->AddInitObserver(obs); |
| 782 } |
| 783 |
782 void PrefService::RegisterPreference(const char* path, | 784 void PrefService::RegisterPreference(const char* path, |
783 Value* default_value, | 785 Value* default_value, |
784 PrefSyncStatus sync_status) { | 786 PrefSyncStatus sync_status) { |
785 DCHECK(CalledOnValidThread()); | 787 DCHECK(CalledOnValidThread()); |
786 | 788 |
787 // The main code path takes ownership, but most don't. We'll be safe. | 789 // The main code path takes ownership, but most don't. We'll be safe. |
788 scoped_ptr<Value> scoped_value(default_value); | 790 scoped_ptr<Value> scoped_value(default_value); |
789 | 791 |
790 DCHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path; | 792 DCHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path; |
791 | 793 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 1059 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
1058 } | 1060 } |
1059 | 1061 |
1060 bool PrefService::Preference::IsUserModifiable() const { | 1062 bool PrefService::Preference::IsUserModifiable() const { |
1061 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 1063 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
1062 } | 1064 } |
1063 | 1065 |
1064 bool PrefService::Preference::IsExtensionModifiable() const { | 1066 bool PrefService::Preference::IsExtensionModifiable() const { |
1065 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 1067 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
1066 } | 1068 } |
OLD | NEW |