| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/pref_service.h" | 5 #include "chrome/browser/pref_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 Source<PrefService> source(pref); | 87 Source<PrefService> source(pref); |
| 88 NotificationService::current()->Notify(NotificationType::PROFILE_ERROR, | 88 NotificationService::current()->Notify(NotificationType::PROFILE_ERROR, |
| 89 source, Details<int>(&message_id)); | 89 source, Details<int>(&message_id)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace | 92 } // namespace |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 PrefService* PrefService::CreatePrefService(const FilePath& pref_filename) { | 95 PrefService* PrefService::CreatePrefService(const FilePath& pref_filename) { |
| 96 PrefStore* managed_prefs = NULL; | 96 PrefStore* managed_prefs = NULL; |
| 97 ExtensionPrefStore* extension_prefs = new ExtensionPrefStore(NULL); | 97 // TODO(pamg): Reinstate extension pref store after Mstone6 branch, when its |
| 98 // memory leaks are fixed and any extension API is using it. |
| 99 // ExtensionPrefStore* extension_prefs = new ExtensionPrefStore(NULL); |
| 100 ExtensionPrefStore* extension_prefs = NULL; |
| 98 CommandLinePrefStore* command_line_prefs = new CommandLinePrefStore( | 101 CommandLinePrefStore* command_line_prefs = new CommandLinePrefStore( |
| 99 CommandLine::ForCurrentProcess()); | 102 CommandLine::ForCurrentProcess()); |
| 100 PrefStore* local_prefs = new JsonPrefStore( | 103 PrefStore* local_prefs = new JsonPrefStore( |
| 101 pref_filename, | 104 pref_filename, |
| 102 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)); | 105 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)); |
| 103 PrefStore* recommended_prefs = NULL; | 106 PrefStore* recommended_prefs = NULL; |
| 104 | 107 |
| 105 ConfigurationPolicyProvider* managed_prefs_provider = NULL; | 108 ConfigurationPolicyProvider* managed_prefs_provider = NULL; |
| 106 ConfigurationPolicyProvider* recommended_prefs_provider = NULL; | 109 ConfigurationPolicyProvider* recommended_prefs_provider = NULL; |
| 107 | 110 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 135 | 138 |
| 136 // The PrefValueStore takes ownership of the PrefStores. | 139 // The PrefValueStore takes ownership of the PrefStores. |
| 137 PrefValueStore* value_store = new PrefValueStore( | 140 PrefValueStore* value_store = new PrefValueStore( |
| 138 managed_prefs, | 141 managed_prefs, |
| 139 extension_prefs, | 142 extension_prefs, |
| 140 command_line_prefs, | 143 command_line_prefs, |
| 141 local_prefs, | 144 local_prefs, |
| 142 recommended_prefs); | 145 recommended_prefs); |
| 143 | 146 |
| 144 PrefService* pref_service = new PrefService(value_store); | 147 PrefService* pref_service = new PrefService(value_store); |
| 145 extension_prefs->SetPrefService(pref_service); | 148 // TODO(pamg): Uncomment when ExtensionPrefStore is reinstated. |
| 149 // extension_prefs->SetPrefService(pref_service); |
| 146 | 150 |
| 147 return pref_service; | 151 return pref_service; |
| 148 } | 152 } |
| 149 | 153 |
| 150 // static | 154 // static |
| 151 PrefService* PrefService::CreateUserPrefService( | 155 PrefService* PrefService::CreateUserPrefService( |
| 152 const FilePath& pref_filename) { | 156 const FilePath& pref_filename) { |
| 153 PrefValueStore* value_store = new PrefValueStore( | 157 PrefValueStore* value_store = new PrefValueStore( |
| 154 NULL, /* no enforced prefs */ | 158 NULL, /* no enforced prefs */ |
| 155 NULL, /* no extension prefs */ | 159 NULL, /* no extension prefs */ |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 return pref_value_store_->PrefValueInUserStore(name_.c_str()); | 857 return pref_value_store_->PrefValueInUserStore(name_.c_str()); |
| 854 } | 858 } |
| 855 | 859 |
| 856 bool PrefService::Preference::IsExtensionControlled() const { | 860 bool PrefService::Preference::IsExtensionControlled() const { |
| 857 return pref_value_store_->PrefValueFromExtensionStore(name_.c_str()); | 861 return pref_value_store_->PrefValueFromExtensionStore(name_.c_str()); |
| 858 } | 862 } |
| 859 | 863 |
| 860 bool PrefService::Preference::IsUserControlled() const { | 864 bool PrefService::Preference::IsUserControlled() const { |
| 861 return pref_value_store_->PrefValueFromUserStore(name_.c_str()); | 865 return pref_value_store_->PrefValueFromUserStore(name_.c_str()); |
| 862 } | 866 } |
| OLD | NEW |