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