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

Side by Side Diff: chrome/browser/extensions/chrome_url_request_util.cc

Issue 574793003: Moving webview media permission request to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing 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
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 "chrome/browser/extensions/chrome_url_request_util.h" 5 #include "chrome/browser/extensions/chrome_url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 mutable base::WeakPtrFactory<URLRequestResourceBundleJob> weak_factory_; 125 mutable base::WeakPtrFactory<URLRequestResourceBundleJob> weak_factory_;
126 }; 126 };
127 127
128 } // namespace 128 } // namespace
129 129
130 namespace extensions { 130 namespace extensions {
131 namespace chrome_url_request_util { 131 namespace chrome_url_request_util {
132 132
133 bool AllowCrossRendererResourceLoad(net::URLRequest* request, 133 bool AllowCrossRendererResourceLoad(net::URLRequest* request,
134 bool is_incognito, 134 bool is_incognito,
135 const Extension* extension, 135 const Extension* extension,
136 InfoMap* extension_info_map, 136 InfoMap* extension_info_map,
137 bool* allowed) { 137 bool* allowed) {
138 if (url_request_util::AllowCrossRendererResourceLoad( 138 if (url_request_util::AllowCrossRendererResourceLoad(
139 request, is_incognito, extension, extension_info_map, allowed)) { 139 request, is_incognito, extension, extension_info_map, allowed)) {
140 return true; 140 return true;
141 } 141 }
142 142
143 // If there aren't any explicitly marked web accessible resources, the 143 // If there aren't any explicitly marked web accessible resources, the
144 // load should be allowed only if it is by DevTools. A close approximation is 144 // load should be allowed only if it is by DevTools. A close approximation is
145 // checking if the extension contains a DevTools page. 145 // checking if the extension contains a DevTools page.
146 if (!ManifestURL::GetDevToolsPage(extension).is_empty()) { 146 if (!ManifestURL::GetDevToolsPage(extension).is_empty()) {
147 *allowed = true; 147 *allowed = true;
(...skipping 16 matching lines...) Expand all
164 // directory_path is a descendant of resources_path. resources_path 164 // directory_path is a descendant of resources_path. resources_path
165 // corresponds to src/chrome/browser/resources in source tree. 165 // corresponds to src/chrome/browser/resources in source tree.
166 if (PathService::Get(chrome::DIR_RESOURCES, &resources_path) && 166 if (PathService::Get(chrome::DIR_RESOURCES, &resources_path) &&
167 // Since component extension resources are included in 167 // Since component extension resources are included in
168 // component_extension_resources.pak file in resources_path, calculate 168 // component_extension_resources.pak file in resources_path, calculate
169 // extension relative path against resources_path. 169 // extension relative path against resources_path.
170 resources_path.AppendRelativePath(directory_path, &relative_path)) { 170 resources_path.AppendRelativePath(directory_path, &relative_path)) {
171 base::FilePath request_path = 171 base::FilePath request_path =
172 extensions::file_util::ExtensionURLToRelativeFilePath(request->url()); 172 extensions::file_util::ExtensionURLToRelativeFilePath(request->url());
173 int resource_id = 0; 173 int resource_id = 0;
174 if (ExtensionsBrowserClient::Get()->GetComponentExtensionResourceManager()-> 174 if (ExtensionsBrowserClient::Get()
175 IsComponentExtensionResource( 175 ->GetComponentExtensionResourceManager()
176 directory_path, request_path, &resource_id)) { 176 ->IsComponentExtensionResource(
177 directory_path, request_path, &resource_id)) {
177 relative_path = relative_path.Append(request_path); 178 relative_path = relative_path.Append(request_path);
178 relative_path = relative_path.NormalizePathSeparators(); 179 relative_path = relative_path.NormalizePathSeparators();
179 return new URLRequestResourceBundleJob(request, 180 return new URLRequestResourceBundleJob(request,
180 network_delegate, 181 network_delegate,
181 relative_path, 182 relative_path,
182 resource_id, 183 resource_id,
183 content_security_policy, 184 content_security_policy,
184 send_cors_header); 185 send_cors_header);
185 } 186 }
186 } 187 }
187 return NULL; 188 return NULL;
188 } 189 }
189 190
190 } // namespace chrome_url_request_util 191 } // namespace chrome_url_request_util
191 } // namespace extensions 192 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698