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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 params.closing_route_id, | 555 params.closing_route_id, |
556 &RenderViewHost::ClosePageIgnoringUnloadEvents); | 556 &RenderViewHost::ClosePageIgnoringUnloadEvents); |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 // We are explicitly forcing the download of 'url'. | 560 // We are explicitly forcing the download of 'url'. |
561 void ResourceDispatcherHost::BeginDownload( | 561 void ResourceDispatcherHost::BeginDownload( |
562 const GURL& url, | 562 const GURL& url, |
563 const GURL& referrer, | 563 const GURL& referrer, |
564 const DownloadSaveInfo& save_info, | 564 const DownloadSaveInfo& save_info, |
| 565 bool prompt_for_save_location, |
565 int child_id, | 566 int child_id, |
566 int route_id, | 567 int route_id, |
567 URLRequestContext* request_context) { | 568 URLRequestContext* request_context) { |
568 if (is_shutdown_) | 569 if (is_shutdown_) |
569 return; | 570 return; |
570 | 571 |
571 // Check if the renderer is permitted to request the requested URL. | 572 // Check if the renderer is permitted to request the requested URL. |
572 if (!ChildProcessSecurityPolicy::GetInstance()-> | 573 if (!ChildProcessSecurityPolicy::GetInstance()-> |
573 CanRequestURL(child_id, url)) { | 574 CanRequestURL(child_id, url)) { |
574 LOG(INFO) << "Denied unauthorized download request for " << | 575 LOG(INFO) << "Denied unauthorized download request for " << |
575 url.possibly_invalid_spec(); | 576 url.possibly_invalid_spec(); |
576 return; | 577 return; |
577 } | 578 } |
578 | 579 |
579 // Ensure the Chrome plugins are loaded, as they may intercept network | 580 // Ensure the Chrome plugins are loaded, as they may intercept network |
580 // requests. Does nothing if they are already loaded. | 581 // requests. Does nothing if they are already loaded. |
581 PluginService::GetInstance()->LoadChromePlugins(this); | 582 PluginService::GetInstance()->LoadChromePlugins(this); |
582 URLRequest* request = new URLRequest(url, this); | 583 URLRequest* request = new URLRequest(url, this); |
583 | 584 |
584 request_id_--; | 585 request_id_--; |
585 | 586 |
586 scoped_refptr<ResourceHandler> handler = | 587 scoped_refptr<ResourceHandler> handler = |
587 new DownloadResourceHandler(this, | 588 new DownloadResourceHandler(this, |
588 child_id, | 589 child_id, |
589 route_id, | 590 route_id, |
590 request_id_, | 591 request_id_, |
591 url, | 592 url, |
592 download_file_manager_.get(), | 593 download_file_manager_.get(), |
593 request, | 594 request, |
594 true, | 595 prompt_for_save_location, |
595 save_info); | 596 save_info); |
596 | 597 |
597 | 598 |
598 if (safe_browsing_->enabled()) { | 599 if (safe_browsing_->enabled()) { |
599 handler = new SafeBrowsingResourceHandler(handler, | 600 handler = new SafeBrowsingResourceHandler(handler, |
600 child_id, | 601 child_id, |
601 route_id, | 602 route_id, |
602 ResourceType::MAIN_FRAME, | 603 ResourceType::MAIN_FRAME, |
603 safe_browsing_, | 604 safe_browsing_, |
604 this, | 605 this, |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 // them. | 1814 // them. |
1814 case ResourceType::IMAGE: | 1815 case ResourceType::IMAGE: |
1815 return net::LOWEST; | 1816 return net::LOWEST; |
1816 | 1817 |
1817 default: | 1818 default: |
1818 // When new resource types are added, their priority must be considered. | 1819 // When new resource types are added, their priority must be considered. |
1819 NOTREACHED(); | 1820 NOTREACHED(); |
1820 return net::LOW; | 1821 return net::LOW; |
1821 } | 1822 } |
1822 } | 1823 } |
OLD | NEW |