OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 ChromeThread::PostTask( | 693 ChromeThread::PostTask( |
694 ChromeThread::UI, FROM_HERE, | 694 ChromeThread::UI, FROM_HERE, |
695 new RVHCloseNotificationTask(params.closing_process_id, | 695 new RVHCloseNotificationTask(params.closing_process_id, |
696 params.closing_route_id)); | 696 params.closing_route_id)); |
697 } | 697 } |
698 } | 698 } |
699 | 699 |
700 // We are explicitly forcing the download of 'url'. | 700 // We are explicitly forcing the download of 'url'. |
701 void ResourceDispatcherHost::BeginDownload(const GURL& url, | 701 void ResourceDispatcherHost::BeginDownload(const GURL& url, |
702 const GURL& referrer, | 702 const GURL& referrer, |
| 703 const FilePath& save_file_path, |
703 int child_id, | 704 int child_id, |
704 int route_id, | 705 int route_id, |
705 URLRequestContext* request_context) { | 706 URLRequestContext* request_context) { |
706 if (is_shutdown_) | 707 if (is_shutdown_) |
707 return; | 708 return; |
708 | 709 |
709 // Check if the renderer is permitted to request the requested URL. | 710 // Check if the renderer is permitted to request the requested URL. |
710 if (!ChildProcessSecurityPolicy::GetInstance()-> | 711 if (!ChildProcessSecurityPolicy::GetInstance()-> |
711 CanRequestURL(child_id, url)) { | 712 CanRequestURL(child_id, url)) { |
712 LOG(INFO) << "Denied unauthorized download request for " << | 713 LOG(INFO) << "Denied unauthorized download request for " << |
713 url.possibly_invalid_spec(); | 714 url.possibly_invalid_spec(); |
714 return; | 715 return; |
715 } | 716 } |
716 | 717 |
717 // Ensure the Chrome plugins are loaded, as they may intercept network | 718 // Ensure the Chrome plugins are loaded, as they may intercept network |
718 // requests. Does nothing if they are already loaded. | 719 // requests. Does nothing if they are already loaded. |
719 PluginService::GetInstance()->LoadChromePlugins(this); | 720 PluginService::GetInstance()->LoadChromePlugins(this); |
720 URLRequest* request = new URLRequest(url, this); | 721 URLRequest* request = new URLRequest(url, this); |
721 | 722 |
722 request_id_--; | 723 request_id_--; |
723 | 724 |
724 scoped_refptr<ResourceHandler> handler = | 725 scoped_refptr<ResourceHandler> handler = |
725 new DownloadResourceHandler(this, | 726 new DownloadResourceHandler(this, |
726 child_id, | 727 child_id, |
727 route_id, | 728 route_id, |
728 request_id_, | 729 request_id_, |
729 url, | 730 url, |
730 download_file_manager_.get(), | 731 download_file_manager_.get(), |
731 request, | 732 request, |
732 true); | 733 true, |
| 734 save_file_path); |
733 | 735 |
734 | 736 |
735 if (safe_browsing_->enabled() && safe_browsing_->CanCheckUrl(url)) { | 737 if (safe_browsing_->enabled() && safe_browsing_->CanCheckUrl(url)) { |
736 handler = new SafeBrowsingResourceHandler(handler, | 738 handler = new SafeBrowsingResourceHandler(handler, |
737 child_id, | 739 child_id, |
738 route_id, | 740 route_id, |
739 url, | 741 url, |
740 ResourceType::MAIN_FRAME, | 742 ResourceType::MAIN_FRAME, |
741 safe_browsing_, | 743 safe_browsing_, |
742 this, | 744 this, |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 case ViewHostMsg_UploadProgress_ACK::ID: | 1824 case ViewHostMsg_UploadProgress_ACK::ID: |
1823 case ViewHostMsg_SyncLoad::ID: | 1825 case ViewHostMsg_SyncLoad::ID: |
1824 return true; | 1826 return true; |
1825 | 1827 |
1826 default: | 1828 default: |
1827 break; | 1829 break; |
1828 } | 1830 } |
1829 | 1831 |
1830 return false; | 1832 return false; |
1831 } | 1833 } |
OLD | NEW |