| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 return; | 831 return; |
| 832 } | 832 } |
| 833 | 833 |
| 834 user_pref_store_->SetValue(path, owned_value.release()); | 834 user_pref_store_->SetValue(path, owned_value.release()); |
| 835 } | 835 } |
| 836 | 836 |
| 837 SyncableService* PrefService::GetSyncableService() { | 837 SyncableService* PrefService::GetSyncableService() { |
| 838 return pref_sync_associator_.get(); | 838 return pref_sync_associator_.get(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 void PrefService::CheckIfValueDestroyed(const char* path, | |
| 842 base::Value::Type type) { | |
| 843 // Make sure the value exists. | |
| 844 Value* value = GetMutableUserPref(path, type); | |
| 845 if (!value) { | |
| 846 const Preference* pref = FindPreference(path); | |
| 847 CHECK(pref); | |
| 848 CHECK_EQ(type, pref->GetType()); | |
| 849 CHECK(false); | |
| 850 } | |
| 851 | |
| 852 user_pref_store_->CheckIfValueDestroyed(path); | |
| 853 } | |
| 854 | |
| 855 /////////////////////////////////////////////////////////////////////////////// | 841 /////////////////////////////////////////////////////////////////////////////// |
| 856 // PrefService::Preference | 842 // PrefService::Preference |
| 857 | 843 |
| 858 PrefService::Preference::Preference(const PrefService* service, | 844 PrefService::Preference::Preference(const PrefService* service, |
| 859 const char* name, | 845 const char* name, |
| 860 base::Value::Type type) | 846 base::Value::Type type) |
| 861 : name_(name), | 847 : name_(name), |
| 862 type_(type), | 848 type_(type), |
| 863 pref_service_(service) { | 849 pref_service_(service) { |
| 864 DCHECK(name); | 850 DCHECK(name); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 894 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 909 } | 895 } |
| 910 | 896 |
| 911 bool PrefService::Preference::IsUserModifiable() const { | 897 bool PrefService::Preference::IsUserModifiable() const { |
| 912 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 898 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 913 } | 899 } |
| 914 | 900 |
| 915 bool PrefService::Preference::IsExtensionModifiable() const { | 901 bool PrefService::Preference::IsExtensionModifiable() const { |
| 916 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 902 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 917 } | 903 } |
| OLD | NEW |