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 "extensions/browser/app_sorting.h" | 12 #include "extensions/browser/app_sorting.h" |
13 #include "extensions/browser/extension_function_registry.h" | 13 #include "extensions/browser/extension_function_registry.h" |
14 #include "extensions/browser/extension_host_delegate.h" | |
15 #include "extensions/browser/extension_prefs.h" | 14 #include "extensions/browser/extension_prefs.h" |
16 #include "extensions/common/api/generated_api.h" | 15 #include "extensions/common/api/generated_api.h" |
17 #include "extensions/shell/browser/api/shell_extensions_api_client.h" | 16 #include "extensions/shell/browser/api/shell_extensions_api_client.h" |
18 #include "extensions/shell/browser/shell_app_sorting.h" | 17 #include "extensions/shell/browser/shell_app_sorting.h" |
| 18 #include "extensions/shell/browser/shell_extension_host_delegate.h" |
19 #include "extensions/shell/browser/shell_extension_system_factory.h" | 19 #include "extensions/shell/browser/shell_extension_system_factory.h" |
20 #include "extensions/shell/browser/shell_extension_web_contents_observer.h" | |
21 #include "extensions/shell/browser/shell_runtime_api_delegate.h" | 20 #include "extensions/shell/browser/shell_runtime_api_delegate.h" |
22 #include "extensions/shell/common/api/generated_api.h" | 21 #include "extensions/shell/common/api/generated_api.h" |
23 | 22 |
24 using content::BrowserContext; | 23 using content::BrowserContext; |
25 | 24 |
26 namespace extensions { | 25 namespace extensions { |
27 namespace { | 26 namespace { |
28 | 27 |
29 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc | 28 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc |
30 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { | 29 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { |
31 ExtensionPrefs::RegisterProfilePrefs(registry); | 30 ExtensionPrefs::RegisterProfilePrefs(registry); |
32 } | 31 } |
33 | 32 |
34 // A minimal ExtensionHostDelegate. | |
35 class ShellExtensionHostDelegate : public ExtensionHostDelegate { | |
36 public: | |
37 ShellExtensionHostDelegate() {} | |
38 virtual ~ShellExtensionHostDelegate() {} | |
39 | |
40 // ExtensionHostDelegate implementation. | |
41 virtual void OnExtensionHostCreated( | |
42 content::WebContents* web_contents) OVERRIDE; | |
43 | |
44 virtual void OnRenderViewCreatedForBackgroundPage( | |
45 ExtensionHost* host) OVERRIDE {} | |
46 | |
47 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() | |
48 OVERRIDE { | |
49 // TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from | |
50 // content_shell. | |
51 NOTREACHED(); | |
52 return NULL; | |
53 } | |
54 | |
55 virtual void CreateTab(content::WebContents* web_contents, | |
56 const std::string& extension_id, | |
57 WindowOpenDisposition disposition, | |
58 const gfx::Rect& initial_pos, | |
59 bool user_gesture) OVERRIDE { | |
60 // TODO(jamescook): Should app_shell support opening popup windows? | |
61 NOTREACHED(); | |
62 } | |
63 | |
64 virtual void ProcessMediaAccessRequest( | |
65 content::WebContents* web_contents, | |
66 const content::MediaStreamRequest& request, | |
67 const content::MediaResponseCallback& callback, | |
68 const Extension* extension) OVERRIDE { | |
69 // app_shell does not support media capture. | |
70 NOTREACHED(); | |
71 } | |
72 }; | |
73 | |
74 void ShellExtensionHostDelegate::OnExtensionHostCreated( | |
75 content::WebContents* web_contents) { | |
76 ShellExtensionWebContentsObserver::CreateForWebContents(web_contents); | |
77 } | |
78 | |
79 } // namespace | 33 } // namespace |
80 | 34 |
81 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( | 35 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( |
82 BrowserContext* context) | 36 BrowserContext* context) |
83 : browser_context_(context), api_client_(new ShellExtensionsAPIClient) { | 37 : browser_context_(context), api_client_(new ShellExtensionsAPIClient) { |
84 // Set up the preferences service. | 38 // Set up the preferences service. |
85 base::PrefServiceFactory factory; | 39 base::PrefServiceFactory factory; |
86 factory.set_user_prefs(new TestingPrefStore); | 40 factory.set_user_prefs(new TestingPrefStore); |
87 factory.set_extension_prefs(new TestingPrefStore); | 41 factory.set_extension_prefs(new TestingPrefStore); |
88 // app_shell should not require syncable preferences, but for now we need to | 42 // app_shell should not require syncable preferences, but for now we need to |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ComponentExtensionResourceManager* | 194 ComponentExtensionResourceManager* |
241 ShellExtensionsBrowserClient::GetComponentExtensionResourceManager() { | 195 ShellExtensionsBrowserClient::GetComponentExtensionResourceManager() { |
242 return NULL; | 196 return NULL; |
243 } | 197 } |
244 | 198 |
245 net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { | 199 net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { |
246 return NULL; | 200 return NULL; |
247 } | 201 } |
248 | 202 |
249 } // namespace extensions | 203 } // namespace extensions |
OLD | NEW |