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