Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: extensions/shell/browser/shell_extensions_browser_client.cc

Issue 412713002: Move apps/shell to extensions/shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 40% Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/shell/browser/shell_extensions_browser_client.h" 5 #include "extensions/shell/browser/shell_extensions_browser_client.h"
6 6
7 #include "apps/shell/browser/shell_app_sorting.h"
8 #include "apps/shell/browser/shell_extension_system_factory.h"
9 #include "apps/shell/browser/shell_extension_web_contents_observer.h"
10 #include "apps/shell/browser/shell_runtime_api_delegate.h"
11 #include "apps/shell/common/api/generated_api.h"
12 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
13 #include "base/prefs/pref_service_factory.h" 8 #include "base/prefs/pref_service_factory.h"
14 #include "base/prefs/testing_pref_store.h" 9 #include "base/prefs/testing_pref_store.h"
15 #include "components/pref_registry/pref_registry_syncable.h" 10 #include "components/pref_registry/pref_registry_syncable.h"
16 #include "components/user_prefs/user_prefs.h" 11 #include "components/user_prefs/user_prefs.h"
17 #include "extensions/browser/api/extensions_api_client.h" 12 #include "extensions/browser/api/extensions_api_client.h"
18 #include "extensions/browser/app_sorting.h" 13 #include "extensions/browser/app_sorting.h"
19 #include "extensions/browser/extension_function_registry.h" 14 #include "extensions/browser/extension_function_registry.h"
20 #include "extensions/browser/extension_host_delegate.h" 15 #include "extensions/browser/extension_host_delegate.h"
21 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
22 #include "extensions/common/api/generated_api.h" 17 #include "extensions/common/api/generated_api.h"
18 #include "extensions/shell/browser/shell_app_sorting.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"
22 #include "extensions/shell/common/api/generated_api.h"
23 23
24 using content::BrowserContext; 24 using content::BrowserContext;
25 25
26 namespace extensions { 26 namespace extensions {
27 namespace { 27 namespace {
28 28
29 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc 29 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc
30 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { 30 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) {
31 ExtensionPrefs::RegisterProfilePrefs(registry); 31 ExtensionPrefs::RegisterProfilePrefs(registry);
32 } 32 }
33 33
34 // A minimal ExtensionHostDelegate. 34 // A minimal ExtensionHostDelegate.
35 class ShellExtensionHostDelegate : public ExtensionHostDelegate { 35 class ShellExtensionHostDelegate : public ExtensionHostDelegate {
36 public: 36 public:
37 ShellExtensionHostDelegate() {} 37 ShellExtensionHostDelegate() {}
38 virtual ~ShellExtensionHostDelegate() {} 38 virtual ~ShellExtensionHostDelegate() {}
39 39
40 // ExtensionHostDelegate implementation. 40 // ExtensionHostDelegate implementation.
41 virtual void OnExtensionHostCreated(content::WebContents* web_contents) 41 virtual void OnExtensionHostCreated(
42 OVERRIDE; 42 content::WebContents* web_contents) OVERRIDE;
43 43
44 virtual void OnRenderViewCreatedForBackgroundPage(ExtensionHost* host) 44 virtual void OnRenderViewCreatedForBackgroundPage(
45 OVERRIDE {} 45 ExtensionHost* host) OVERRIDE {}
46 46
47 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() 47 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager()
48 OVERRIDE { 48 OVERRIDE {
49 // TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from 49 // TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from
50 // content_shell. 50 // content_shell.
51 NOTREACHED(); 51 NOTREACHED();
52 return NULL; 52 return NULL;
53 } 53 }
54 54
55 virtual void CreateTab(content::WebContents* web_contents, 55 virtual void CreateTab(content::WebContents* web_contents,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // recycle some of the RegisterProfilePrefs() code in Chrome. 89 // recycle some of the RegisterProfilePrefs() code in Chrome.
90 // TODO(jamescook): Convert this to PrefRegistrySimple. 90 // TODO(jamescook): Convert this to PrefRegistrySimple.
91 user_prefs::PrefRegistrySyncable* pref_registry = 91 user_prefs::PrefRegistrySyncable* pref_registry =
92 new user_prefs::PrefRegistrySyncable; 92 new user_prefs::PrefRegistrySyncable;
93 // Prefs should be registered before the PrefService is created. 93 // Prefs should be registered before the PrefService is created.
94 RegisterPrefs(pref_registry); 94 RegisterPrefs(pref_registry);
95 prefs_ = factory.Create(pref_registry).Pass(); 95 prefs_ = factory.Create(pref_registry).Pass();
96 user_prefs::UserPrefs::Set(browser_context_, prefs_.get()); 96 user_prefs::UserPrefs::Set(browser_context_, prefs_.get());
97 } 97 }
98 98
99 ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() {} 99 ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() {
100 }
100 101
101 bool ShellExtensionsBrowserClient::IsShuttingDown() { 102 bool ShellExtensionsBrowserClient::IsShuttingDown() {
102 return false; 103 return false;
103 } 104 }
104 105
105 bool ShellExtensionsBrowserClient::AreExtensionsDisabled( 106 bool ShellExtensionsBrowserClient::AreExtensionsDisabled(
106 const base::CommandLine& command_line, 107 const base::CommandLine& command_line,
107 BrowserContext* context) { 108 BrowserContext* context) {
108 return false; 109 return false;
109 } 110 }
(...skipping 28 matching lines...) Expand all
138 return false; 139 return false;
139 } 140 }
140 141
141 bool ShellExtensionsBrowserClient::IsExtensionIncognitoEnabled( 142 bool ShellExtensionsBrowserClient::IsExtensionIncognitoEnabled(
142 const std::string& extension_id, 143 const std::string& extension_id,
143 content::BrowserContext* context) const { 144 content::BrowserContext* context) const {
144 return false; 145 return false;
145 } 146 }
146 147
147 bool ShellExtensionsBrowserClient::CanExtensionCrossIncognito( 148 bool ShellExtensionsBrowserClient::CanExtensionCrossIncognito(
148 const extensions::Extension* extension, 149 const Extension* extension,
149 content::BrowserContext* context) const { 150 content::BrowserContext* context) const {
150 return false; 151 return false;
151 } 152 }
152 153
153 bool ShellExtensionsBrowserClient::IsWebViewRequest( 154 bool ShellExtensionsBrowserClient::IsWebViewRequest(
154 net::URLRequest* request) const { 155 net::URLRequest* request) const {
155 return false; 156 return false;
156 } 157 }
157 158
158 net::URLRequestJob* 159 net::URLRequestJob*
(...skipping 15 matching lines...) Expand all
174 return false; 175 return false;
175 } 176 }
176 177
177 PrefService* ShellExtensionsBrowserClient::GetPrefServiceForContext( 178 PrefService* ShellExtensionsBrowserClient::GetPrefServiceForContext(
178 BrowserContext* context) { 179 BrowserContext* context) {
179 return prefs_.get(); 180 return prefs_.get();
180 } 181 }
181 182
182 void ShellExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( 183 void ShellExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
183 content::BrowserContext* context, 184 content::BrowserContext* context,
184 std::vector<ExtensionPrefsObserver*>* observers) const {} 185 std::vector<ExtensionPrefsObserver*>* observers) const {
186 }
185 187
186 ProcessManagerDelegate* 188 ProcessManagerDelegate*
187 ShellExtensionsBrowserClient::GetProcessManagerDelegate() const { 189 ShellExtensionsBrowserClient::GetProcessManagerDelegate() const {
188 return NULL; 190 return NULL;
189 } 191 }
190 192
191 scoped_ptr<ExtensionHostDelegate> 193 scoped_ptr<ExtensionHostDelegate>
192 ShellExtensionsBrowserClient::CreateExtensionHostDelegate() { 194 ShellExtensionsBrowserClient::CreateExtensionHostDelegate() {
193 return scoped_ptr<ExtensionHostDelegate>(new ShellExtensionHostDelegate); 195 return scoped_ptr<ExtensionHostDelegate>(new ShellExtensionHostDelegate);
194 } 196 }
195 197
196 bool ShellExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) { 198 bool ShellExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
197 // TODO(jamescook): We might want to tell extensions when app_shell updates. 199 // TODO(jamescook): We might want to tell extensions when app_shell updates.
198 return false; 200 return false;
199 } 201 }
200 202
201 scoped_ptr<AppSorting> ShellExtensionsBrowserClient::CreateAppSorting() { 203 scoped_ptr<AppSorting> ShellExtensionsBrowserClient::CreateAppSorting() {
202 return scoped_ptr<AppSorting>(new apps::ShellAppSorting); 204 return scoped_ptr<AppSorting>(new ShellAppSorting);
203 } 205 }
204 206
205 bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() { 207 bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() {
206 return false; 208 return false;
207 } 209 }
208 210
209 ApiActivityMonitor* ShellExtensionsBrowserClient::GetApiActivityMonitor( 211 ApiActivityMonitor* ShellExtensionsBrowserClient::GetApiActivityMonitor(
210 BrowserContext* context) { 212 BrowserContext* context) {
211 // app_shell doesn't monitor API function calls or events. 213 // app_shell doesn't monitor API function calls or events.
212 return NULL; 214 return NULL;
213 } 215 }
214 216
215 ExtensionSystemProvider* 217 ExtensionSystemProvider*
216 ShellExtensionsBrowserClient::GetExtensionSystemFactory() { 218 ShellExtensionsBrowserClient::GetExtensionSystemFactory() {
217 return ShellExtensionSystemFactory::GetInstance(); 219 return ShellExtensionSystemFactory::GetInstance();
218 } 220 }
219 221
220 void ShellExtensionsBrowserClient::RegisterExtensionFunctions( 222 void ShellExtensionsBrowserClient::RegisterExtensionFunctions(
221 ExtensionFunctionRegistry* registry) const { 223 ExtensionFunctionRegistry* registry) const {
222 // Register core extension-system APIs. 224 // Register core extension-system APIs.
223 extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); 225 core_api::GeneratedFunctionRegistry::RegisterAll(registry);
224 226
225 // Register chrome.shell APIs. 227 // Register chrome.shell APIs.
226 apps::shell_api::GeneratedFunctionRegistry::RegisterAll(registry); 228 shell_api::GeneratedFunctionRegistry::RegisterAll(registry);
227 } 229 }
228 230
229 scoped_ptr<RuntimeAPIDelegate> 231 scoped_ptr<RuntimeAPIDelegate>
230 ShellExtensionsBrowserClient::CreateRuntimeAPIDelegate( 232 ShellExtensionsBrowserClient::CreateRuntimeAPIDelegate(
231 content::BrowserContext* context) const { 233 content::BrowserContext* context) const {
232 return scoped_ptr<RuntimeAPIDelegate>(new apps::ShellRuntimeAPIDelegate()); 234 return scoped_ptr<RuntimeAPIDelegate>(new ShellRuntimeAPIDelegate());
233 } 235 }
234 236
235 ComponentExtensionResourceManager* 237 ComponentExtensionResourceManager*
236 ShellExtensionsBrowserClient::GetComponentExtensionResourceManager() { 238 ShellExtensionsBrowserClient::GetComponentExtensionResourceManager() {
237 return NULL; 239 return NULL;
238 } 240 }
239 241
240 } // namespace extensions 242 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698