| 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" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/shared_module_service.h" | 12 #include "chrome/browser/extensions/shared_module_service.h" |
| 13 #include "chrome/browser/extensions/sidebar_manager.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 16 #include "extensions/browser/extension_pref_value_map.h" | 17 #include "extensions/browser/extension_pref_value_map.h" |
| 17 #include "extensions/browser/extension_pref_value_map_factory.h" | 18 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 18 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
| 19 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
| 20 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 21 #include "extensions/browser/extensions_browser_client.h" | 22 #include "extensions/browser/extensions_browser_client.h" |
| 22 #include "extensions/browser/info_map.h" | 23 #include "extensions/browser/info_map.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 65 |
| 65 ExtensionService* TestExtensionSystem::CreateExtensionService( | 66 ExtensionService* TestExtensionSystem::CreateExtensionService( |
| 66 const base::CommandLine* command_line, | 67 const base::CommandLine* command_line, |
| 67 const base::FilePath& install_directory, | 68 const base::FilePath& install_directory, |
| 68 bool autoupdate_enabled) { | 69 bool autoupdate_enabled) { |
| 69 // The ownership of |value_store_| is immediately transferred to state_store_, | 70 // The ownership of |value_store_| is immediately transferred to state_store_, |
| 70 // but we keep a naked pointer to the TestingValueStore. | 71 // but we keep a naked pointer to the TestingValueStore. |
| 71 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); | 72 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); |
| 72 value_store_ = value_store.get(); | 73 value_store_ = value_store.get(); |
| 73 state_store_.reset(new StateStore(profile_, value_store.Pass())); | 74 state_store_.reset(new StateStore(profile_, value_store.Pass())); |
| 75 sidebar_manager_.reset(new SidebarManager()); |
| 74 management_policy_.reset(new ManagementPolicy()); | 76 management_policy_.reset(new ManagementPolicy()); |
| 75 management_policy_->RegisterProviders( | 77 management_policy_->RegisterProviders( |
| 76 ExtensionManagementFactory::GetForBrowserContext(profile_) | 78 ExtensionManagementFactory::GetForBrowserContext(profile_) |
| 77 ->GetProviders()); | 79 ->GetProviders()); |
| 78 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); | 80 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); |
| 79 extension_service_.reset(new ExtensionService(profile_, | 81 extension_service_.reset(new ExtensionService(profile_, |
| 80 command_line, | 82 command_line, |
| 81 install_directory, | 83 install_directory, |
| 82 ExtensionPrefs::Get(profile_), | 84 ExtensionPrefs::Get(profile_), |
| 83 Blacklist::Get(profile_), | 85 Blacklist::Get(profile_), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 109 } | 111 } |
| 110 | 112 |
| 111 StateStore* TestExtensionSystem::state_store() { | 113 StateStore* TestExtensionSystem::state_store() { |
| 112 return state_store_.get(); | 114 return state_store_.get(); |
| 113 } | 115 } |
| 114 | 116 |
| 115 StateStore* TestExtensionSystem::rules_store() { | 117 StateStore* TestExtensionSystem::rules_store() { |
| 116 return state_store_.get(); | 118 return state_store_.get(); |
| 117 } | 119 } |
| 118 | 120 |
| 121 SidebarManager* TestExtensionSystem::sidebar_manager() { |
| 122 return sidebar_manager_.get(); |
| 123 } |
| 124 |
| 119 InfoMap* TestExtensionSystem::info_map() { return info_map_.get(); } | 125 InfoMap* TestExtensionSystem::info_map() { return info_map_.get(); } |
| 120 | 126 |
| 121 QuotaService* TestExtensionSystem::quota_service() { | 127 QuotaService* TestExtensionSystem::quota_service() { |
| 122 return quota_service_.get(); | 128 return quota_service_.get(); |
| 123 } | 129 } |
| 124 | 130 |
| 125 const OneShotEvent& TestExtensionSystem::ready() const { | 131 const OneShotEvent& TestExtensionSystem::ready() const { |
| 126 return ready_; | 132 return ready_; |
| 127 } | 133 } |
| 128 | 134 |
| 129 ContentVerifier* TestExtensionSystem::content_verifier() { | 135 ContentVerifier* TestExtensionSystem::content_verifier() { |
| 130 return NULL; | 136 return NULL; |
| 131 } | 137 } |
| 132 | 138 |
| 133 scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions( | 139 scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions( |
| 134 const Extension* extension) { | 140 const Extension* extension) { |
| 135 return extension_service()->shared_module_service()->GetDependentExtensions( | 141 return extension_service()->shared_module_service()->GetDependentExtensions( |
| 136 extension); | 142 extension); |
| 137 } | 143 } |
| 138 | 144 |
| 139 // static | 145 // static |
| 140 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { | 146 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { |
| 141 return new TestExtensionSystem(static_cast<Profile*>(profile)); | 147 return new TestExtensionSystem(static_cast<Profile*>(profile)); |
| 142 } | 148 } |
| 143 | 149 |
| 144 } // namespace extensions | 150 } // namespace extensions |
| OLD | NEW |