| 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/extension_management.h" | 10 #include "chrome/browser/extensions/extension_management.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 extension_prefs); | 76 extension_prefs); |
| 77 return extension_prefs; | 77 return extension_prefs; |
| 78 } | 78 } |
| 79 | 79 |
| 80 ExtensionService* TestExtensionSystem::CreateExtensionService( | 80 ExtensionService* TestExtensionSystem::CreateExtensionService( |
| 81 const base::CommandLine* command_line, | 81 const base::CommandLine* command_line, |
| 82 const base::FilePath& install_directory, | 82 const base::FilePath& install_directory, |
| 83 bool autoupdate_enabled) { | 83 bool autoupdate_enabled) { |
| 84 if (!ExtensionPrefs::Get(profile_)) | 84 if (!ExtensionPrefs::Get(profile_)) |
| 85 CreateExtensionPrefs(command_line, install_directory); | 85 CreateExtensionPrefs(command_line, install_directory); |
| 86 install_verifier_.reset( | |
| 87 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); | |
| 88 // The ownership of |value_store_| is immediately transferred to state_store_, | 86 // The ownership of |value_store_| is immediately transferred to state_store_, |
| 89 // but we keep a naked pointer to the TestingValueStore. | 87 // but we keep a naked pointer to the TestingValueStore. |
| 90 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); | 88 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); |
| 91 value_store_ = value_store.get(); | 89 value_store_ = value_store.get(); |
| 92 state_store_.reset(new StateStore(profile_, value_store.Pass())); | 90 state_store_.reset(new StateStore(profile_, value_store.Pass())); |
| 93 declarative_user_script_manager_.reset( | 91 declarative_user_script_manager_.reset( |
| 94 new DeclarativeUserScriptManager(profile_)); | 92 new DeclarativeUserScriptManager(profile_)); |
| 95 management_policy_.reset(new ManagementPolicy()); | 93 management_policy_.reset(new ManagementPolicy()); |
| 96 management_policy_->RegisterProviders( | 94 management_policy_->RegisterProviders( |
| 97 ExtensionManagementFactory::GetForBrowserContext(profile_) | 95 ExtensionManagementFactory::GetForBrowserContext(profile_) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 TestExtensionSystem::lazy_background_task_queue() { | 146 TestExtensionSystem::lazy_background_task_queue() { |
| 149 return lazy_background_task_queue_.get(); | 147 return lazy_background_task_queue_.get(); |
| 150 } | 148 } |
| 151 | 149 |
| 152 void TestExtensionSystem::SetEventRouter(scoped_ptr<EventRouter> event_router) { | 150 void TestExtensionSystem::SetEventRouter(scoped_ptr<EventRouter> event_router) { |
| 153 event_router_.reset(event_router.release()); | 151 event_router_.reset(event_router.release()); |
| 154 } | 152 } |
| 155 | 153 |
| 156 EventRouter* TestExtensionSystem::event_router() { return event_router_.get(); } | 154 EventRouter* TestExtensionSystem::event_router() { return event_router_.get(); } |
| 157 | 155 |
| 158 InstallVerifier* TestExtensionSystem::install_verifier() { | |
| 159 return install_verifier_.get(); | |
| 160 } | |
| 161 | |
| 162 QuotaService* TestExtensionSystem::quota_service() { | 156 QuotaService* TestExtensionSystem::quota_service() { |
| 163 return quota_service_.get(); | 157 return quota_service_.get(); |
| 164 } | 158 } |
| 165 | 159 |
| 166 const OneShotEvent& TestExtensionSystem::ready() const { | 160 const OneShotEvent& TestExtensionSystem::ready() const { |
| 167 return ready_; | 161 return ready_; |
| 168 } | 162 } |
| 169 | 163 |
| 170 ContentVerifier* TestExtensionSystem::content_verifier() { | 164 ContentVerifier* TestExtensionSystem::content_verifier() { |
| 171 return NULL; | 165 return NULL; |
| 172 } | 166 } |
| 173 | 167 |
| 174 scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions( | 168 scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions( |
| 175 const Extension* extension) { | 169 const Extension* extension) { |
| 176 return extension_service()->shared_module_service()->GetDependentExtensions( | 170 return extension_service()->shared_module_service()->GetDependentExtensions( |
| 177 extension); | 171 extension); |
| 178 } | 172 } |
| 179 | 173 |
| 180 // static | 174 // static |
| 181 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { | 175 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { |
| 182 return new TestExtensionSystem(static_cast<Profile*>(profile)); | 176 return new TestExtensionSystem(static_cast<Profile*>(profile)); |
| 183 } | 177 } |
| 184 | 178 |
| 185 } // namespace extensions | 179 } // namespace extensions |
| OLD | NEW |