| 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 "chrome/browser/extensions/extension_devtools_manager.h" | 7 #include "chrome/browser/extensions/extension_devtools_manager.h" |
| 8 #include "chrome/browser/extensions/extension_event_router.h" | 8 #include "chrome/browser/extensions/extension_event_router.h" |
| 9 #include "chrome/browser/extensions/extension_info_map.h" | 9 #include "chrome/browser/extensions/extension_info_map.h" |
| 10 #include "chrome/browser/extensions/extension_message_service.h" | 10 #include "chrome/browser/extensions/extension_message_service.h" |
| 11 #include "chrome/browser/extensions/extension_pref_value_map.h" | 11 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 12 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" |
| 12 #include "chrome/browser/extensions/extension_process_manager.h" | 13 #include "chrome/browser/extensions/extension_process_manager.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
| 15 #include "chrome/browser/extensions/user_script_master.h" | 16 #include "chrome/browser/extensions/user_script_master.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 | 19 |
| 19 | 20 |
| 20 TestExtensionSystem::TestExtensionSystem(Profile* profile) | 21 TestExtensionSystem::TestExtensionSystem(Profile* profile) |
| 21 : profile_(profile) { | 22 : profile_(profile) { |
| 22 } | 23 } |
| 23 | 24 |
| 24 TestExtensionSystem::~TestExtensionSystem() { | 25 TestExtensionSystem::~TestExtensionSystem() { |
| 25 } | 26 } |
| 26 | 27 |
| 27 void TestExtensionSystem::Shutdown() { | 28 void TestExtensionSystem::Shutdown() { |
| 28 extension_process_manager_.reset(); | 29 extension_process_manager_.reset(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void TestExtensionSystem::CreateExtensionProcessManager() { | 32 void TestExtensionSystem::CreateExtensionProcessManager() { |
| 32 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); | 33 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); |
| 33 } | 34 } |
| 34 | 35 |
| 35 ExtensionService* TestExtensionSystem::CreateExtensionService( | 36 ExtensionService* TestExtensionSystem::CreateExtensionService( |
| 36 const CommandLine* command_line, | 37 const CommandLine* command_line, |
| 37 const FilePath& install_directory, | 38 const FilePath& install_directory, |
| 38 bool autoupdate_enabled) { | 39 bool autoupdate_enabled) { |
| 39 // Extension pref store, created for use by |extension_prefs_|. | |
| 40 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | |
| 41 | |
| 42 bool extensions_disabled = | 40 bool extensions_disabled = |
| 43 command_line && command_line->HasSwitch(switches::kDisableExtensions); | 41 command_line && command_line->HasSwitch(switches::kDisableExtensions); |
| 44 | 42 |
| 45 // Note that the GetPrefs() creates a TestingPrefService, therefore | 43 // Note that the GetPrefs() creates a TestingPrefService, therefore |
| 46 // the extension controlled pref values set in extension_prefs_ | 44 // the extension controlled pref values set in extension_prefs_ |
| 47 // are not reflected in the pref service. One would need to | 45 // are not reflected in the pref service. One would need to |
| 48 // inject a new ExtensionPrefStore(extension_pref_value_map_.get(), false). | 46 // inject a new ExtensionPrefStore(extension_pref_value_map, false). |
| 49 | 47 |
| 50 extension_prefs_.reset( | 48 extension_prefs_.reset(new ExtensionPrefs( |
| 51 new ExtensionPrefs(profile_->GetPrefs(), | 49 profile_->GetPrefs(), |
| 52 install_directory, | 50 install_directory, |
| 53 extension_pref_value_map_.get())); | 51 ExtensionPrefValueMapFactory::GetForProfile(profile_))); |
| 54 extension_prefs_->Init(extensions_disabled); | 52 extension_prefs_->Init(extensions_disabled); |
| 55 extension_service_.reset(new ExtensionService(profile_, | 53 extension_service_.reset(new ExtensionService(profile_, |
| 56 command_line, | 54 command_line, |
| 57 install_directory, | 55 install_directory, |
| 58 extension_prefs_.get(), | 56 extension_prefs_.get(), |
| 59 autoupdate_enabled, | 57 autoupdate_enabled, |
| 60 true)); | 58 true)); |
| 61 return extension_service_.get(); | 59 return extension_service_.get(); |
| 62 } | 60 } |
| 63 | 61 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 98 |
| 101 extensions::RulesRegistryService* | 99 extensions::RulesRegistryService* |
| 102 TestExtensionSystem::rules_registry_service() { | 100 TestExtensionSystem::rules_registry_service() { |
| 103 return NULL; | 101 return NULL; |
| 104 } | 102 } |
| 105 | 103 |
| 106 // static | 104 // static |
| 107 ProfileKeyedService* TestExtensionSystem::Build(Profile* profile) { | 105 ProfileKeyedService* TestExtensionSystem::Build(Profile* profile) { |
| 108 return new TestExtensionSystem(profile); | 106 return new TestExtensionSystem(profile); |
| 109 } | 107 } |
| OLD | NEW |