OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 params.closing_route_id, | 592 params.closing_route_id, |
593 &RenderViewHost::ClosePageIgnoringUnloadEvents); | 593 &RenderViewHost::ClosePageIgnoringUnloadEvents); |
594 } | 594 } |
595 } | 595 } |
596 | 596 |
597 // We are explicitly forcing the download of 'url'. | 597 // We are explicitly forcing the download of 'url'. |
598 void ResourceDispatcherHost::BeginDownload( | 598 void ResourceDispatcherHost::BeginDownload( |
599 const GURL& url, | 599 const GURL& url, |
600 const GURL& referrer, | 600 const GURL& referrer, |
601 const DownloadSaveInfo& save_info, | 601 const DownloadSaveInfo& save_info, |
602 bool prompt_for_save_location, | |
603 int child_id, | 602 int child_id, |
604 int route_id, | 603 int route_id, |
605 URLRequestContext* request_context) { | 604 URLRequestContext* request_context) { |
606 if (is_shutdown_) | 605 if (is_shutdown_) |
607 return; | 606 return; |
608 | 607 |
609 // Check if the renderer is permitted to request the requested URL. | 608 // Check if the renderer is permitted to request the requested URL. |
610 if (!ChildProcessSecurityPolicy::GetInstance()-> | 609 if (!ChildProcessSecurityPolicy::GetInstance()-> |
611 CanRequestURL(child_id, url)) { | 610 CanRequestURL(child_id, url)) { |
612 LOG(INFO) << "Denied unauthorized download request for " << | 611 LOG(INFO) << "Denied unauthorized download request for " << |
613 url.possibly_invalid_spec(); | 612 url.possibly_invalid_spec(); |
614 return; | 613 return; |
615 } | 614 } |
616 | 615 |
617 // Ensure the Chrome plugins are loaded, as they may intercept network | 616 // Ensure the Chrome plugins are loaded, as they may intercept network |
618 // requests. Does nothing if they are already loaded. | 617 // requests. Does nothing if they are already loaded. |
619 PluginService::GetInstance()->LoadChromePlugins(this); | 618 PluginService::GetInstance()->LoadChromePlugins(this); |
620 URLRequest* request = new URLRequest(url, this); | 619 URLRequest* request = new URLRequest(url, this); |
621 | 620 |
622 request_id_--; | 621 request_id_--; |
623 | 622 |
624 scoped_refptr<ResourceHandler> handler = | 623 scoped_refptr<ResourceHandler> handler = |
625 new DownloadResourceHandler(this, | 624 new DownloadResourceHandler(this, |
626 child_id, | 625 child_id, |
627 route_id, | 626 route_id, |
628 request_id_, | 627 request_id_, |
629 url, | 628 url, |
630 download_file_manager_.get(), | 629 download_file_manager_.get(), |
631 request, | 630 request, |
632 prompt_for_save_location, | 631 true, |
633 save_info); | 632 save_info); |
634 | 633 |
635 if (safe_browsing_->enabled()) { | 634 if (safe_browsing_->enabled()) { |
636 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, | 635 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, |
637 ResourceType::MAIN_FRAME); | 636 ResourceType::MAIN_FRAME); |
638 } | 637 } |
639 | 638 |
640 if (!URLRequest::IsHandledURL(url)) { | 639 if (!URLRequest::IsHandledURL(url)) { |
641 LOG(INFO) << "Download request for unsupported protocol: " << | 640 LOG(INFO) << "Download request for unsupported protocol: " << |
642 url.possibly_invalid_spec(); | 641 url.possibly_invalid_spec(); |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 // them. | 1821 // them. |
1823 case ResourceType::IMAGE: | 1822 case ResourceType::IMAGE: |
1824 return net::LOWEST; | 1823 return net::LOWEST; |
1825 | 1824 |
1826 default: | 1825 default: |
1827 // When new resource types are added, their priority must be considered. | 1826 // When new resource types are added, their priority must be considered. |
1828 NOTREACHED(); | 1827 NOTREACHED(); |
1829 return net::LOW; | 1828 return net::LOW; |
1830 } | 1829 } |
1831 } | 1830 } |
OLD | NEW |