| 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_system.h" | 5 #include "chrome/browser/extensions/test_extension_system.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/extensions/blacklist.h" | 9 #include "chrome/browser/extensions/blacklist.h" |
| 10 #include "chrome/browser/extensions/declarative_user_script_master.h" | 10 #include "chrome/browser/extensions/declarative_user_script_master.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool autoupdate_enabled) { | 80 bool autoupdate_enabled) { |
| 81 if (!ExtensionPrefs::Get(profile_)) | 81 if (!ExtensionPrefs::Get(profile_)) |
| 82 CreateExtensionPrefs(command_line, install_directory); | 82 CreateExtensionPrefs(command_line, install_directory); |
| 83 install_verifier_.reset( | 83 install_verifier_.reset( |
| 84 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); | 84 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); |
| 85 // The ownership of |value_store_| is immediately transferred to state_store_, | 85 // The ownership of |value_store_| is immediately transferred to state_store_, |
| 86 // but we keep a naked pointer to the TestingValueStore. | 86 // but we keep a naked pointer to the TestingValueStore. |
| 87 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); | 87 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); |
| 88 value_store_ = value_store.get(); | 88 value_store_ = value_store.get(); |
| 89 state_store_.reset(new StateStore(profile_, value_store.Pass())); | 89 state_store_.reset(new StateStore(profile_, value_store.Pass())); |
| 90 blacklist_.reset(new Blacklist(ExtensionPrefs::Get(profile_))); | |
| 91 management_policy_.reset(new ManagementPolicy()); | 90 management_policy_.reset(new ManagementPolicy()); |
| 92 management_policy_->RegisterProviders( | 91 management_policy_->RegisterProviders( |
| 93 ExtensionManagementFactory::GetForBrowserContext(profile_) | 92 ExtensionManagementFactory::GetForBrowserContext(profile_) |
| 94 ->GetProviders()); | 93 ->GetProviders()); |
| 95 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); | 94 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); |
| 96 extension_service_.reset(new ExtensionService(profile_, | 95 extension_service_.reset(new ExtensionService(profile_, |
| 97 command_line, | 96 command_line, |
| 98 install_directory, | 97 install_directory, |
| 99 ExtensionPrefs::Get(profile_), | 98 ExtensionPrefs::Get(profile_), |
| 100 blacklist_.get(), | 99 Blacklist::Get(profile_), |
| 101 autoupdate_enabled, | 100 autoupdate_enabled, |
| 102 true, | 101 true, |
| 103 &ready_)); | 102 &ready_)); |
| 104 extension_service_->ClearProvidersForTesting(); | 103 extension_service_->ClearProvidersForTesting(); |
| 105 return extension_service_.get(); | 104 return extension_service_.get(); |
| 106 } | 105 } |
| 107 | 106 |
| 108 ExtensionService* TestExtensionSystem::extension_service() { | 107 ExtensionService* TestExtensionSystem::extension_service() { |
| 109 return extension_service_.get(); | 108 return extension_service_.get(); |
| 110 } | 109 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 139 TestExtensionSystem::lazy_background_task_queue() { | 138 TestExtensionSystem::lazy_background_task_queue() { |
| 140 return NULL; | 139 return NULL; |
| 141 } | 140 } |
| 142 | 141 |
| 143 void TestExtensionSystem::SetEventRouter(scoped_ptr<EventRouter> event_router) { | 142 void TestExtensionSystem::SetEventRouter(scoped_ptr<EventRouter> event_router) { |
| 144 event_router_.reset(event_router.release()); | 143 event_router_.reset(event_router.release()); |
| 145 } | 144 } |
| 146 | 145 |
| 147 EventRouter* TestExtensionSystem::event_router() { return event_router_.get(); } | 146 EventRouter* TestExtensionSystem::event_router() { return event_router_.get(); } |
| 148 | 147 |
| 149 Blacklist* TestExtensionSystem::blacklist() { | |
| 150 return blacklist_.get(); | |
| 151 } | |
| 152 | |
| 153 ErrorConsole* TestExtensionSystem::error_console() { | 148 ErrorConsole* TestExtensionSystem::error_console() { |
| 154 return error_console_.get(); | 149 return error_console_.get(); |
| 155 } | 150 } |
| 156 | 151 |
| 157 InstallVerifier* TestExtensionSystem::install_verifier() { | 152 InstallVerifier* TestExtensionSystem::install_verifier() { |
| 158 return install_verifier_.get(); | 153 return install_verifier_.get(); |
| 159 } | 154 } |
| 160 | 155 |
| 161 QuotaService* TestExtensionSystem::quota_service() { | 156 QuotaService* TestExtensionSystem::quota_service() { |
| 162 return quota_service_.get(); | 157 return quota_service_.get(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 191 } |
| 197 return master; | 192 return master; |
| 198 } | 193 } |
| 199 | 194 |
| 200 // static | 195 // static |
| 201 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { | 196 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { |
| 202 return new TestExtensionSystem(static_cast<Profile*>(profile)); | 197 return new TestExtensionSystem(static_cast<Profile*>(profile)); |
| 203 } | 198 } |
| 204 | 199 |
| 205 } // namespace extensions | 200 } // namespace extensions |
| OLD | NEW |