Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/download_manager_impl.h" | 5 #include "content/browser/download/download_manager_impl.h" | 
| 6 | 6 | 
| 7 #include <iterator> | 7 #include <iterator> | 
| 8 #include <utility> | 8 #include <utility> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 | 557 | 
| 558 // Check if the renderer is permitted to request the requested URL. | 558 // Check if the renderer is permitted to request the requested URL. | 
| 559 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 559 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 
| 560 render_process_id, url)) { | 560 render_process_id, url)) { | 
| 561 DVLOG(1) << "Denied unauthorized download request for " | 561 DVLOG(1) << "Denied unauthorized download request for " | 
| 562 << url.possibly_invalid_spec(); | 562 << url.possibly_invalid_spec(); | 
| 563 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST; | 563 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST; | 
| 564 } | 564 } | 
| 565 | 565 | 
| 566 const net::URLRequestContext* request_context = url_request->context(); | 566 const net::URLRequestContext* request_context = url_request->context(); | 
| 567 if (!request_context->job_factory()->IsHandledURL(url)) { | 567 if (!request_context->job_factory()->IsHandledProtocol(url.scheme())) { | 
| 
 
mmenke
2017/03/31 04:30:04
Blocking invalid URLs here seems reasonable (The a
 
asanka
2017/03/31 20:38:30
Acknowledged. It's also fine to let the request go
 
 | |
| 568 DVLOG(1) << "Download request for unsupported protocol: " | 568 DVLOG(1) << "Download request for unsupported protocol: " | 
| 569 << url.possibly_invalid_spec(); | 569 << url.possibly_invalid_spec(); | 
| 570 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST; | 570 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST; | 
| 571 } | 571 } | 
| 572 | 572 | 
| 573 // From this point forward, the |DownloadResourceHandler| is responsible for | 573 // From this point forward, the |DownloadResourceHandler| is responsible for | 
| 574 // |started_callback|. | 574 // |started_callback|. | 
| 575 // TODO(ananta) | 575 // TODO(ananta) | 
| 576 // Find a better way to create the DownloadResourceHandler instance. | 576 // Find a better way to create the DownloadResourceHandler instance. | 
| 577 std::unique_ptr<ResourceHandler> handler( | 577 std::unique_ptr<ResourceHandler> handler( | 
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 if (delegate_) | 749 if (delegate_) | 
| 750 delegate_->OpenDownload(download); | 750 delegate_->OpenDownload(download); | 
| 751 } | 751 } | 
| 752 | 752 | 
| 753 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 753 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 
| 754 if (delegate_) | 754 if (delegate_) | 
| 755 delegate_->ShowDownloadInShell(download); | 755 delegate_->ShowDownloadInShell(download); | 
| 756 } | 756 } | 
| 757 | 757 | 
| 758 } // namespace content | 758 } // namespace content | 
| OLD | NEW |