| 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/extensions/test_extension_prefs.h" | 5 #include "chrome/browser/extensions/test_extension_prefs.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return pref_service_.get(); | 75 return pref_service_.get(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 const scoped_refptr<user_prefs::PrefRegistrySyncable>& | 78 const scoped_refptr<user_prefs::PrefRegistrySyncable>& |
| 79 TestExtensionPrefs::pref_registry() { | 79 TestExtensionPrefs::pref_registry() { |
| 80 return pref_registry_; | 80 return pref_registry_; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void TestExtensionPrefs::ResetPrefRegistry() { | 83 void TestExtensionPrefs::ResetPrefRegistry() { |
| 84 pref_registry_ = new user_prefs::PrefRegistrySyncable; | 84 pref_registry_ = new user_prefs::PrefRegistrySyncable; |
| 85 ExtensionPrefs::RegisterUserPrefs(pref_registry_.get()); | 85 ExtensionPrefs::RegisterProfilePrefs(pref_registry_.get()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void TestExtensionPrefs::RecreateExtensionPrefs() { | 88 void TestExtensionPrefs::RecreateExtensionPrefs() { |
| 89 // We persist and reload the PrefService's PrefStores because this process | 89 // We persist and reload the PrefService's PrefStores because this process |
| 90 // deletes all empty dictionaries. The ExtensionPrefs implementation | 90 // deletes all empty dictionaries. The ExtensionPrefs implementation |
| 91 // needs to be able to handle this situation. | 91 // needs to be able to handle this situation. |
| 92 if (pref_service_) { | 92 if (pref_service_) { |
| 93 // Commit a pending write (which posts a task to task_runner_) and wait for | 93 // Commit a pending write (which posts a task to task_runner_) and wait for |
| 94 // it to finish. | 94 // it to finish. |
| 95 pref_service_->CommitPendingWrite(); | 95 pref_service_->CommitPendingWrite(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 173 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
| 174 return pref_service_->CreateIncognitoPrefService( | 174 return pref_service_->CreateIncognitoPrefService( |
| 175 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 175 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 178 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
| 179 extensions_disabled_ = extensions_disabled; | 179 extensions_disabled_ = extensions_disabled; |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |