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/error_console/error_console.h" | 10 #include "chrome/browser/extensions/error_console/error_console.h" |
11 #include "chrome/browser/extensions/event_router.h" | 11 #include "chrome/browser/extensions/event_router.h" |
12 #include "chrome/browser/extensions/extension_pref_value_map.h" | 12 #include "chrome/browser/extensions/extension_pref_value_map.h" |
13 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" | 13 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" |
14 #include "chrome/browser/extensions/extension_prefs.h" | 14 #include "chrome/browser/extensions/extension_prefs.h" |
15 #include "chrome/browser/extensions/extension_prefs_factory.h" | 15 #include "chrome/browser/extensions/extension_prefs_factory.h" |
16 #include "chrome/browser/extensions/extension_process_manager.h" | |
17 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/extension_system.h" | 17 #include "chrome/browser/extensions/extension_system.h" |
19 #include "chrome/browser/extensions/management_policy.h" | 18 #include "chrome/browser/extensions/management_policy.h" |
20 #include "chrome/browser/extensions/standard_management_policy_provider.h" | 19 #include "chrome/browser/extensions/standard_management_policy_provider.h" |
21 #include "chrome/browser/extensions/state_store.h" | 20 #include "chrome/browser/extensions/state_store.h" |
22 #include "chrome/browser/extensions/user_script_master.h" | 21 #include "chrome/browser/extensions/user_script_master.h" |
23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/value_store/testing_value_store.h" | 23 #include "chrome/browser/value_store/testing_value_store.h" |
25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
26 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
27 #include "extensions/browser/info_map.h" | 26 #include "extensions/browser/info_map.h" |
| 27 #include "extensions/browser/process_manager.h" |
28 | 28 |
29 using content::BrowserThread; | 29 using content::BrowserThread; |
30 | 30 |
31 namespace extensions { | 31 namespace extensions { |
32 | 32 |
33 TestExtensionSystem::TestExtensionSystem(Profile* profile) | 33 TestExtensionSystem::TestExtensionSystem(Profile* profile) |
34 : profile_(profile), | 34 : profile_(profile), |
35 value_store_(NULL), | 35 value_store_(NULL), |
36 info_map_(new InfoMap()), | 36 info_map_(new InfoMap()), |
37 error_console_(new ErrorConsole(profile, NULL)) {} | 37 error_console_(new ErrorConsole(profile, NULL)) {} |
38 | 38 |
39 TestExtensionSystem::~TestExtensionSystem() { | 39 TestExtensionSystem::~TestExtensionSystem() { |
40 } | 40 } |
41 | 41 |
42 void TestExtensionSystem::Shutdown() { | 42 void TestExtensionSystem::Shutdown() { |
43 extension_process_manager_.reset(); | 43 process_manager_.reset(); |
44 } | 44 } |
45 | 45 |
46 void TestExtensionSystem::CreateExtensionProcessManager() { | 46 void TestExtensionSystem::CreateProcessManager() { |
47 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); | 47 process_manager_.reset(ProcessManager::Create(profile_)); |
48 } | 48 } |
49 | 49 |
50 void TestExtensionSystem::SetExtensionProcessManager( | 50 void TestExtensionSystem::SetProcessManager(ProcessManager* manager) { |
51 ExtensionProcessManager* manager) { | 51 process_manager_.reset(manager); |
52 extension_process_manager_.reset(manager); | |
53 } | 52 } |
54 | 53 |
55 ExtensionPrefs* TestExtensionSystem::CreateExtensionPrefs( | 54 ExtensionPrefs* TestExtensionSystem::CreateExtensionPrefs( |
56 const CommandLine* command_line, | 55 const CommandLine* command_line, |
57 const base::FilePath& install_directory) { | 56 const base::FilePath& install_directory) { |
58 bool extensions_disabled = | 57 bool extensions_disabled = |
59 command_line && command_line->HasSwitch(switches::kDisableExtensions); | 58 command_line && command_line->HasSwitch(switches::kDisableExtensions); |
60 | 59 |
61 // Note that the GetPrefs() creates a TestingPrefService, therefore | 60 // Note that the GetPrefs() creates a TestingPrefService, therefore |
62 // the extension controlled pref values set in ExtensionPrefs | 61 // the extension controlled pref values set in ExtensionPrefs |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 112 } |
114 | 113 |
115 void TestExtensionSystem::SetExtensionService(ExtensionService* service) { | 114 void TestExtensionSystem::SetExtensionService(ExtensionService* service) { |
116 extension_service_.reset(service); | 115 extension_service_.reset(service); |
117 } | 116 } |
118 | 117 |
119 UserScriptMaster* TestExtensionSystem::user_script_master() { | 118 UserScriptMaster* TestExtensionSystem::user_script_master() { |
120 return NULL; | 119 return NULL; |
121 } | 120 } |
122 | 121 |
123 ExtensionProcessManager* TestExtensionSystem::process_manager() { | 122 ProcessManager* TestExtensionSystem::process_manager() { |
124 return extension_process_manager_.get(); | 123 return process_manager_.get(); |
125 } | 124 } |
126 | 125 |
127 StateStore* TestExtensionSystem::state_store() { | 126 StateStore* TestExtensionSystem::state_store() { |
128 return state_store_.get(); | 127 return state_store_.get(); |
129 } | 128 } |
130 | 129 |
131 StateStore* TestExtensionSystem::rules_store() { | 130 StateStore* TestExtensionSystem::rules_store() { |
132 return state_store_.get(); | 131 return state_store_.get(); |
133 } | 132 } |
134 | 133 |
(...skipping 24 matching lines...) Expand all Loading... |
159 return error_console_.get(); | 158 return error_console_.get(); |
160 } | 159 } |
161 | 160 |
162 // static | 161 // static |
163 BrowserContextKeyedService* TestExtensionSystem::Build( | 162 BrowserContextKeyedService* TestExtensionSystem::Build( |
164 content::BrowserContext* profile) { | 163 content::BrowserContext* profile) { |
165 return new TestExtensionSystem(static_cast<Profile*>(profile)); | 164 return new TestExtensionSystem(static_cast<Profile*>(profile)); |
166 } | 165 } |
167 | 166 |
168 } // namespace extensions | 167 } // namespace extensions |
OLD | NEW |