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

Side by Side Diff: extensions/browser/extension_protocols.cc

Issue 2042483002: Fix web_accesible_resources enforcement for Site Isolation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stale comment. Created 4 years, 6 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/browser/extension_navigation_throttle.cc ('k') | extensions/extensions.gypi » ('j') | 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/browser/extension_protocols.h" 5 #include "extensions/browser/extension_protocols.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 // Creates URLRequestJobs for extension:// URLs. 413 // Creates URLRequestJobs for extension:// URLs.
414 net::URLRequestJob* 414 net::URLRequestJob*
415 ExtensionProtocolHandler::MaybeCreateJob( 415 ExtensionProtocolHandler::MaybeCreateJob(
416 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { 416 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
417 // chrome-extension://extension-id/resource/path.js 417 // chrome-extension://extension-id/resource/path.js
418 std::string extension_id = request->url().host(); 418 std::string extension_id = request->url().host();
419 const Extension* extension = 419 const Extension* extension =
420 extension_info_map_->extensions().GetByID(extension_id); 420 extension_info_map_->extensions().GetByID(extension_id);
421 421
422 // TODO(mpcomplete): better error code.
423 if (!AllowExtensionResourceLoad( 422 if (!AllowExtensionResourceLoad(
424 request, is_incognito_, extension, extension_info_map_)) { 423 request, is_incognito_, extension, extension_info_map_)) {
425 return new net::URLRequestErrorJob( 424 return new net::URLRequestErrorJob(request, network_delegate,
426 request, network_delegate, net::ERR_ADDRESS_UNREACHABLE); 425 net::ERR_BLOCKED_BY_CLIENT);
427 } 426 }
428 427
429 // If this is a disabled extension only allow the icon to load. 428 // If this is a disabled extension only allow the icon to load.
430 base::FilePath directory_path; 429 base::FilePath directory_path;
431 if (extension) 430 if (extension)
432 directory_path = extension->path(); 431 directory_path = extension->path();
433 if (directory_path.value().empty()) { 432 if (directory_path.value().empty()) {
434 const Extension* disabled_extension = 433 const Extension* disabled_extension =
435 extension_info_map_->disabled_extensions().GetByID(extension_id); 434 extension_info_map_->disabled_extensions().GetByID(extension_id);
436 if (URLIsForExtensionIcon(request->url(), disabled_extension)) 435 if (URLIsForExtensionIcon(request->url(), disabled_extension))
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 576 }
578 577
579 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> 578 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
580 CreateExtensionProtocolHandler(bool is_incognito, 579 CreateExtensionProtocolHandler(bool is_incognito,
581 extensions::InfoMap* extension_info_map) { 580 extensions::InfoMap* extension_info_map) {
582 return base::WrapUnique( 581 return base::WrapUnique(
583 new ExtensionProtocolHandler(is_incognito, extension_info_map)); 582 new ExtensionProtocolHandler(is_incognito, extension_info_map));
584 } 583 }
585 584
586 } // namespace extensions 585 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_navigation_throttle.cc ('k') | extensions/extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698