Chromium Code Reviews| 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/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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. | 422 // TODO(mpcomplete): better error code. |
| 423 if (!AllowExtensionResourceLoad( | 423 if (!AllowExtensionResourceLoad( |
| 424 request, is_incognito_, extension, extension_info_map_)) { | 424 request, is_incognito_, extension, extension_info_map_)) { |
| 425 return new net::URLRequestErrorJob( | 425 return new net::URLRequestErrorJob(request, network_delegate, |
| 426 request, network_delegate, net::ERR_ADDRESS_UNREACHABLE); | 426 net::ERR_BLOCKED_BY_CLIENT); |
|
nasko
2016/06/03 21:37:03
I've changed this to be consistent with the return
| |
| 427 } | 427 } |
| 428 | 428 |
| 429 // If this is a disabled extension only allow the icon to load. | 429 // If this is a disabled extension only allow the icon to load. |
| 430 base::FilePath directory_path; | 430 base::FilePath directory_path; |
| 431 if (extension) | 431 if (extension) |
| 432 directory_path = extension->path(); | 432 directory_path = extension->path(); |
| 433 if (directory_path.value().empty()) { | 433 if (directory_path.value().empty()) { |
| 434 const Extension* disabled_extension = | 434 const Extension* disabled_extension = |
| 435 extension_info_map_->disabled_extensions().GetByID(extension_id); | 435 extension_info_map_->disabled_extensions().GetByID(extension_id); |
| 436 if (URLIsForExtensionIcon(request->url(), disabled_extension)) | 436 if (URLIsForExtensionIcon(request->url(), disabled_extension)) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 } | 577 } |
| 578 | 578 |
| 579 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> | 579 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 580 CreateExtensionProtocolHandler(bool is_incognito, | 580 CreateExtensionProtocolHandler(bool is_incognito, |
| 581 extensions::InfoMap* extension_info_map) { | 581 extensions::InfoMap* extension_info_map) { |
| 582 return base::WrapUnique( | 582 return base::WrapUnique( |
| 583 new ExtensionProtocolHandler(is_incognito, extension_info_map)); | 583 new ExtensionProtocolHandler(is_incognito, extension_info_map)); |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace extensions | 586 } // namespace extensions |
| OLD | NEW |