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

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

Issue 573843002: Allows webview to access extension resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to add the namespace on chrome_url_request_util.cc Created 6 years, 3 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
« no previous file with comments | « extensions/shell/browser/shell_browser_main_parts.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/url_request_util.h"
20 #include "extensions/shell/browser/shell_extension_host_delegate.h" 21 #include "extensions/shell/browser/shell_extension_host_delegate.h"
21 #include "extensions/shell/browser/shell_extension_system_factory.h" 22 #include "extensions/shell/browser/shell_extension_system_factory.h"
22 #include "extensions/shell/browser/shell_runtime_api_delegate.h" 23 #include "extensions/shell/browser/shell_runtime_api_delegate.h"
23 24
24 using content::BrowserContext; 25 using content::BrowserContext;
25 using content::BrowserThread; 26 using content::BrowserThread;
26 27
27 namespace extensions { 28 namespace extensions {
28 namespace { 29 namespace {
29 30
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const std::string& content_security_policy, 121 const std::string& content_security_policy,
121 bool send_cors_header) { 122 bool send_cors_header) {
122 return NULL; 123 return NULL;
123 } 124 }
124 125
125 bool ShellExtensionsBrowserClient::AllowCrossRendererResourceLoad( 126 bool ShellExtensionsBrowserClient::AllowCrossRendererResourceLoad(
126 net::URLRequest* request, 127 net::URLRequest* request,
127 bool is_incognito, 128 bool is_incognito,
128 const Extension* extension, 129 const Extension* extension,
129 InfoMap* extension_info_map) { 130 InfoMap* extension_info_map) {
130 // Note: This may need to change if app_shell supports webview. 131 bool allowed = false;
132 if (url_request_util::AllowCrossRendererResourceLoad(
133 request, is_incognito, extension, extension_info_map, &allowed)) {
134 return allowed;
135 }
136
137 // Couldn't determine if resource is allowed. Block the load.
131 return false; 138 return false;
132 } 139 }
133 140
134 PrefService* ShellExtensionsBrowserClient::GetPrefServiceForContext( 141 PrefService* ShellExtensionsBrowserClient::GetPrefServiceForContext(
135 BrowserContext* context) { 142 BrowserContext* context) {
136 return prefs_.get(); 143 return prefs_.get();
137 } 144 }
138 145
139 void ShellExtensionsBrowserClient::GetEarlyExtensionPrefsObservers( 146 void ShellExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
140 content::BrowserContext* context, 147 content::BrowserContext* context,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 218
212 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 219 scoped_ptr<Event> event(new Event(event_name, args.Pass()));
213 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); 220 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
214 } 221 }
215 222
216 net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { 223 net::NetLog* ShellExtensionsBrowserClient::GetNetLog() {
217 return NULL; 224 return NULL;
218 } 225 }
219 226
220 } // namespace extensions 227 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_browser_main_parts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698