| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 factory.set_extension_prefs( | 110 factory.set_extension_prefs( |
| 111 new ExtensionPrefStore(extension_pref_value_map_.get(), false)); | 111 new ExtensionPrefStore(extension_pref_value_map_.get(), false)); |
| 112 pref_service_ = factory.CreateSyncable(pref_registry_.get()).Pass(); | 112 pref_service_ = factory.CreateSyncable(pref_registry_.get()).Pass(); |
| 113 | 113 |
| 114 prefs_.reset(ExtensionPrefs::Create( | 114 prefs_.reset(ExtensionPrefs::Create( |
| 115 pref_service_.get(), | 115 pref_service_.get(), |
| 116 temp_dir_.path(), | 116 temp_dir_.path(), |
| 117 extension_pref_value_map_.get(), | 117 extension_pref_value_map_.get(), |
| 118 ExtensionsBrowserClient::Get()->CreateAppSorting().Pass(), | 118 ExtensionsBrowserClient::Get()->CreateAppSorting().Pass(), |
| 119 extensions_disabled_, | 119 extensions_disabled_, |
| 120 std::vector<ExtensionPrefsObserver*>(), |
| 120 // Guarantee that no two extensions get the same installation time | 121 // Guarantee that no two extensions get the same installation time |
| 121 // stamp and we can reliably assert the installation order in the tests. | 122 // stamp and we can reliably assert the installation order in the tests. |
| 122 scoped_ptr<ExtensionPrefs::TimeProvider>( | 123 scoped_ptr<ExtensionPrefs::TimeProvider>(new IncrementalTimeProvider()))); |
| 123 new IncrementalTimeProvider()))); | |
| 124 } | 124 } |
| 125 | 125 |
| 126 scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) { | 126 scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) { |
| 127 base::DictionaryValue dictionary; | 127 base::DictionaryValue dictionary; |
| 128 dictionary.SetString(manifest_keys::kName, name); | 128 dictionary.SetString(manifest_keys::kName, name); |
| 129 dictionary.SetString(manifest_keys::kVersion, "0.1"); | 129 dictionary.SetString(manifest_keys::kVersion, "0.1"); |
| 130 return AddExtensionWithManifest(dictionary, Manifest::INTERNAL); | 130 return AddExtensionWithManifest(dictionary, Manifest::INTERNAL); |
| 131 } | 131 } |
| 132 | 132 |
| 133 scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) { | 133 scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 177 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
| 178 return pref_service_->CreateIncognitoPrefService( | 178 return pref_service_->CreateIncognitoPrefService( |
| 179 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 179 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 182 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
| 183 extensions_disabled_ = extensions_disabled; | 183 extensions_disabled_ = extensions_disabled; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |