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/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_pref_value_map_factory.h" |
13 #include "chrome/browser/extensions/extension_prefs.h" | 13 #include "chrome/browser/extensions/extension_prefs.h" |
14 #include "chrome/browser/extensions/extension_prefs_factory.h" | 14 #include "chrome/browser/extensions/extension_prefs_factory.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/extension_system.h" | 16 #include "chrome/browser/extensions/extension_system.h" |
17 #include "chrome/browser/extensions/install_verifier.h" | 17 #include "chrome/browser/extensions/install_verifier.h" |
18 #include "chrome/browser/extensions/management_policy.h" | 18 #include "chrome/browser/extensions/management_policy.h" |
19 #include "chrome/browser/extensions/standard_management_policy_provider.h" | 19 #include "chrome/browser/extensions/standard_management_policy_provider.h" |
20 #include "chrome/browser/extensions/state_store.h" | 20 #include "chrome/browser/extensions/state_store.h" |
21 #include "chrome/browser/extensions/user_script_master.h" | 21 #include "chrome/browser/extensions/user_script_master.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/value_store/testing_value_store.h" | 23 #include "chrome/browser/value_store/testing_value_store.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
26 #include "extensions/browser/event_router.h" | 26 #include "extensions/browser/event_router.h" |
| 27 #include "extensions/browser/extensions_browser_client.h" |
27 #include "extensions/browser/info_map.h" | 28 #include "extensions/browser/info_map.h" |
28 #include "extensions/browser/process_manager.h" | 29 #include "extensions/browser/process_manager.h" |
29 | 30 |
30 using content::BrowserThread; | 31 using content::BrowserThread; |
31 | 32 |
32 namespace extensions { | 33 namespace extensions { |
33 | 34 |
34 TestExtensionSystem::TestExtensionSystem(Profile* profile) | 35 TestExtensionSystem::TestExtensionSystem(Profile* profile) |
35 : profile_(profile), | 36 : profile_(profile), |
36 value_store_(NULL), | 37 value_store_(NULL), |
(...skipping 23 matching lines...) Expand all Loading... |
60 | 61 |
61 // Note that the GetPrefs() creates a TestingPrefService, therefore | 62 // Note that the GetPrefs() creates a TestingPrefService, therefore |
62 // the extension controlled pref values set in ExtensionPrefs | 63 // the extension controlled pref values set in ExtensionPrefs |
63 // are not reflected in the pref service. One would need to | 64 // are not reflected in the pref service. One would need to |
64 // inject a new ExtensionPrefStore(extension_pref_value_map, false). | 65 // inject a new ExtensionPrefStore(extension_pref_value_map, false). |
65 | 66 |
66 ExtensionPrefs* extension_prefs = ExtensionPrefs::Create( | 67 ExtensionPrefs* extension_prefs = ExtensionPrefs::Create( |
67 profile_->GetPrefs(), | 68 profile_->GetPrefs(), |
68 install_directory, | 69 install_directory, |
69 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_), | 70 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_), |
| 71 ExtensionsBrowserClient::Get()->CreateAppSorting().Pass(), |
70 extensions_disabled); | 72 extensions_disabled); |
71 ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting( | 73 ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting( |
72 profile_, | 74 profile_, |
73 extension_prefs); | 75 extension_prefs); |
74 return extension_prefs; | 76 return extension_prefs; |
75 } | 77 } |
76 | 78 |
77 ExtensionService* TestExtensionSystem::CreateExtensionService( | 79 ExtensionService* TestExtensionSystem::CreateExtensionService( |
78 const CommandLine* command_line, | 80 const CommandLine* command_line, |
79 const base::FilePath& install_directory, | 81 const base::FilePath& install_directory, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 return install_verifier_.get(); | 167 return install_verifier_.get(); |
166 } | 168 } |
167 | 169 |
168 // static | 170 // static |
169 BrowserContextKeyedService* TestExtensionSystem::Build( | 171 BrowserContextKeyedService* TestExtensionSystem::Build( |
170 content::BrowserContext* profile) { | 172 content::BrowserContext* profile) { |
171 return new TestExtensionSystem(static_cast<Profile*>(profile)); | 173 return new TestExtensionSystem(static_cast<Profile*>(profile)); |
172 } | 174 } |
173 | 175 |
174 } // namespace extensions | 176 } // namespace extensions |
OLD | NEW |