OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_extensions_browser_client.h" | 5 #include "extensions/shell/browser/shell_extensions_browser_client.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/prefs/pref_service_factory.h" | 8 #include "base/prefs/pref_service_factory.h" |
9 #include "base/prefs/testing_pref_store.h" | 9 #include "base/prefs/testing_pref_store.h" |
10 #include "components/pref_registry/pref_registry_syncable.h" | 10 #include "components/pref_registry/pref_registry_syncable.h" |
11 #include "components/user_prefs/user_prefs.h" | 11 #include "components/user_prefs/user_prefs.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "extensions/browser/api/extensions_api_client.h" | 13 #include "extensions/browser/api/extensions_api_client.h" |
14 #include "extensions/browser/api/generated_api_registration.h" | 14 #include "extensions/browser/api/generated_api_registration.h" |
15 #include "extensions/browser/app_sorting.h" | 15 #include "extensions/browser/app_sorting.h" |
16 #include "extensions/browser/event_router.h" | 16 #include "extensions/browser/event_router.h" |
17 #include "extensions/browser/extension_function_registry.h" | 17 #include "extensions/browser/extension_function_registry.h" |
18 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
19 #include "extensions/browser/null_app_sorting.h" | 19 #include "extensions/browser/null_app_sorting.h" |
20 #include "extensions/browser/updater/null_extension_cache.h" | |
21 #include "extensions/browser/url_request_util.h" | 20 #include "extensions/browser/url_request_util.h" |
22 #include "extensions/shell/browser/shell_extension_host_delegate.h" | 21 #include "extensions/shell/browser/shell_extension_host_delegate.h" |
23 #include "extensions/shell/browser/shell_extension_system_factory.h" | 22 #include "extensions/shell/browser/shell_extension_system_factory.h" |
24 #include "extensions/shell/browser/shell_runtime_api_delegate.h" | 23 #include "extensions/shell/browser/shell_runtime_api_delegate.h" |
25 | 24 |
26 using content::BrowserContext; | 25 using content::BrowserContext; |
27 using content::BrowserThread; | 26 using content::BrowserThread; |
28 | 27 |
29 namespace extensions { | 28 namespace extensions { |
30 namespace { | 29 namespace { |
31 | 30 |
32 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc | 31 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc |
33 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { | 32 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { |
34 ExtensionPrefs::RegisterProfilePrefs(registry); | 33 ExtensionPrefs::RegisterProfilePrefs(registry); |
35 } | 34 } |
36 | 35 |
37 } // namespace | 36 } // namespace |
38 | 37 |
39 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( | 38 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( |
40 BrowserContext* context) | 39 BrowserContext* context) |
41 : browser_context_(context), | 40 : browser_context_(context), api_client_(new ExtensionsAPIClient) { |
42 api_client_(new ExtensionsAPIClient), | |
43 extension_cache_(new NullExtensionCache()) { | |
44 // Set up the preferences service. | 41 // Set up the preferences service. |
45 base::PrefServiceFactory factory; | 42 base::PrefServiceFactory factory; |
46 factory.set_user_prefs(new TestingPrefStore); | 43 factory.set_user_prefs(new TestingPrefStore); |
47 factory.set_extension_prefs(new TestingPrefStore); | 44 factory.set_extension_prefs(new TestingPrefStore); |
48 // app_shell should not require syncable preferences, but for now we need to | 45 // app_shell should not require syncable preferences, but for now we need to |
49 // recycle some of the RegisterProfilePrefs() code in Chrome. | 46 // recycle some of the RegisterProfilePrefs() code in Chrome. |
50 // TODO(jamescook): Convert this to PrefRegistrySimple. | 47 // TODO(jamescook): Convert this to PrefRegistrySimple. |
51 user_prefs::PrefRegistrySyncable* pref_registry = | 48 user_prefs::PrefRegistrySyncable* pref_registry = |
52 new user_prefs::PrefRegistrySyncable; | 49 new user_prefs::PrefRegistrySyncable; |
53 // Prefs should be registered before the PrefService is created. | 50 // Prefs should be registered before the PrefService is created. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 212 } |
216 | 213 |
217 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 214 scoped_ptr<Event> event(new Event(event_name, args.Pass())); |
218 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); | 215 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); |
219 } | 216 } |
220 | 217 |
221 net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { | 218 net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { |
222 return NULL; | 219 return NULL; |
223 } | 220 } |
224 | 221 |
225 ExtensionCache* ShellExtensionsBrowserClient::GetExtensionCache() { | |
226 return extension_cache_.get(); | |
227 } | |
228 | |
229 } // namespace extensions | 222 } // namespace extensions |
OLD | NEW |