Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 2825056: Recommit r52848 - Option-click to download should not display "Save As" UI. (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
602 int child_id, 603 int child_id,
603 int route_id, 604 int route_id,
604 URLRequestContext* request_context) { 605 URLRequestContext* request_context) {
605 if (is_shutdown_) 606 if (is_shutdown_)
606 return; 607 return;
607 608
608 // Check if the renderer is permitted to request the requested URL. 609 // Check if the renderer is permitted to request the requested URL.
609 if (!ChildProcessSecurityPolicy::GetInstance()-> 610 if (!ChildProcessSecurityPolicy::GetInstance()->
610 CanRequestURL(child_id, url)) { 611 CanRequestURL(child_id, url)) {
611 LOG(INFO) << "Denied unauthorized download request for " << 612 LOG(INFO) << "Denied unauthorized download request for " <<
612 url.possibly_invalid_spec(); 613 url.possibly_invalid_spec();
613 return; 614 return;
614 } 615 }
615 616
616 // Ensure the Chrome plugins are loaded, as they may intercept network 617 // Ensure the Chrome plugins are loaded, as they may intercept network
617 // requests. Does nothing if they are already loaded. 618 // requests. Does nothing if they are already loaded.
618 PluginService::GetInstance()->LoadChromePlugins(this); 619 PluginService::GetInstance()->LoadChromePlugins(this);
619 URLRequest* request = new URLRequest(url, this); 620 URLRequest* request = new URLRequest(url, this);
620 621
621 request_id_--; 622 request_id_--;
622 623
623 scoped_refptr<ResourceHandler> handler = 624 scoped_refptr<ResourceHandler> handler =
624 new DownloadResourceHandler(this, 625 new DownloadResourceHandler(this,
625 child_id, 626 child_id,
626 route_id, 627 route_id,
627 request_id_, 628 request_id_,
628 url, 629 url,
629 download_file_manager_.get(), 630 download_file_manager_.get(),
630 request, 631 request,
631 true, 632 prompt_for_save_location,
632 save_info); 633 save_info);
633 634
634 if (safe_browsing_->enabled()) { 635 if (safe_browsing_->enabled()) {
635 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, 636 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id,
636 ResourceType::MAIN_FRAME); 637 ResourceType::MAIN_FRAME);
637 } 638 }
638 639
639 if (!URLRequest::IsHandledURL(url)) { 640 if (!URLRequest::IsHandledURL(url)) {
640 LOG(INFO) << "Download request for unsupported protocol: " << 641 LOG(INFO) << "Download request for unsupported protocol: " <<
641 url.possibly_invalid_spec(); 642 url.possibly_invalid_spec();
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 // them. 1822 // them.
1822 case ResourceType::IMAGE: 1823 case ResourceType::IMAGE:
1823 return net::LOWEST; 1824 return net::LOWEST;
1824 1825
1825 default: 1826 default:
1826 // When new resource types are added, their priority must be considered. 1827 // When new resource types are added, their priority must be considered.
1827 NOTREACHED(); 1828 NOTREACHED();
1828 return net::LOW; 1829 return net::LOW;
1829 } 1830 }
1830 } 1831 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.h ('k') | chrome/browser/renderer_host/resource_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698