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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host_impl.cc

Issue 10381122: Add flag to specify if explicitly requested download is from web. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR and integrated into DownloadUrlParams. Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
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 // 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 "content/browser/renderer_host/resource_dispatcher_host_impl.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 ResourceRequestInfoImpl* info = 458 ResourceRequestInfoImpl* info =
459 ResourceRequestInfoImpl::ForRequest(requests->front()); 459 ResourceRequestInfoImpl::ForRequest(requests->front());
460 // http://crbug.com/90971 460 // http://crbug.com/90971
461 CHECK_NE(info->GetContext(), context); 461 CHECK_NE(info->GetContext(), context);
462 } 462 }
463 } 463 }
464 } 464 }
465 465
466 net::Error ResourceDispatcherHostImpl::BeginDownload( 466 net::Error ResourceDispatcherHostImpl::BeginDownload(
467 scoped_ptr<net::URLRequest> request, 467 scoped_ptr<net::URLRequest> request,
468 bool is_content_initiated,
468 ResourceContext* context, 469 ResourceContext* context,
469 int child_id, 470 int child_id,
470 int route_id, 471 int route_id,
471 bool prefer_cache, 472 bool prefer_cache,
472 const DownloadSaveInfo& save_info, 473 const DownloadSaveInfo& save_info,
473 const DownloadStartedCallback& started_callback) { 474 const DownloadStartedCallback& started_callback) {
474 if (is_shutdown_) 475 if (is_shutdown_)
475 return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES); 476 return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES);
476 477
477 const GURL& url = request->original_url(); 478 const GURL& url = request->original_url();
(...skipping 28 matching lines...) Expand all
506 << url.possibly_invalid_spec(); 507 << url.possibly_invalid_spec();
507 return CallbackAndReturn(started_callback, net::ERR_ACCESS_DENIED); 508 return CallbackAndReturn(started_callback, net::ERR_ACCESS_DENIED);
508 } 509 }
509 510
510 request_id_--; 511 request_id_--;
511 512
512 // From this point forward, the |DownloadResourceHandler| is responsible for 513 // From this point forward, the |DownloadResourceHandler| is responsible for
513 // |started_callback|. 514 // |started_callback|.
514 scoped_refptr<ResourceHandler> handler( 515 scoped_refptr<ResourceHandler> handler(
515 CreateResourceHandlerForDownload(request.get(), context, child_id, 516 CreateResourceHandlerForDownload(request.get(), context, child_id,
516 route_id, request_id_, save_info, 517 route_id, request_id_,
518 is_content_initiated, save_info,
517 started_callback)); 519 started_callback));
518 520
519 if (!request_context->job_factory()->IsHandledURL(url)) { 521 if (!request_context->job_factory()->IsHandledURL(url)) {
520 VLOG(1) << "Download request for unsupported protocol: " 522 VLOG(1) << "Download request for unsupported protocol: "
521 << url.possibly_invalid_spec(); 523 << url.possibly_invalid_spec();
522 return net::ERR_ACCESS_DENIED; 524 return net::ERR_ACCESS_DENIED;
523 } 525 }
524 526
525 ResourceRequestInfoImpl* extra_info = 527 ResourceRequestInfoImpl* extra_info =
526 CreateRequestInfo(handler, child_id, route_id, true, context); 528 CreateRequestInfo(handler, child_id, route_id, true, context);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 base::Unretained(this))); 570 base::Unretained(this)));
569 } 571 }
570 572
571 scoped_refptr<ResourceHandler> 573 scoped_refptr<ResourceHandler>
572 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( 574 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload(
573 net::URLRequest* request, 575 net::URLRequest* request,
574 ResourceContext* context, 576 ResourceContext* context,
575 int child_id, 577 int child_id,
576 int route_id, 578 int route_id,
577 int request_id, 579 int request_id,
580 bool is_content_initiated,
578 const DownloadSaveInfo& save_info, 581 const DownloadSaveInfo& save_info,
579 const DownloadResourceHandler::OnStartedCallback& started_cb) { 582 const DownloadResourceHandler::OnStartedCallback& started_cb) {
580 scoped_refptr<ResourceHandler> handler( 583 scoped_refptr<ResourceHandler> handler(
581 new DownloadResourceHandler(child_id, route_id, request_id, 584 new DownloadResourceHandler(child_id, route_id, request_id,
582 request->url(), download_file_manager_.get(), 585 request->url(), download_file_manager_.get(),
583 request, started_cb, save_info)); 586 request, started_cb, save_info));
584 if (delegate_) { 587 if (delegate_) {
585 ScopedVector<ResourceThrottle> throttles; 588 ScopedVector<ResourceThrottle> throttles;
586 delegate_->DownloadStarting(request, context, child_id, route_id, 589 delegate_->DownloadStarting(request, context, child_id, route_id,
587 request_id, !request->is_pending(), &throttles); 590 request_id, is_content_initiated, &throttles);
588 if (!throttles.empty()) { 591 if (!throttles.empty()) {
589 handler = new ThrottlingResourceHandler(this, handler, child_id, 592 handler = new ThrottlingResourceHandler(this, handler, child_id,
590 request_id, throttles.Pass()); 593 request_id, throttles.Pass());
591 } 594 }
592 } 595 }
593 return handler; 596 return handler;
594 } 597 }
595 598
596 // static 599 // static
597 bool ResourceDispatcherHostImpl::RenderViewForRequest( 600 bool ResourceDispatcherHostImpl::RenderViewForRequest(
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 return allow_cross_origin_auth_prompt_; 2327 return allow_cross_origin_auth_prompt_;
2325 } 2328 }
2326 2329
2327 bool ResourceDispatcherHostImpl::IsTransferredNavigation( 2330 bool ResourceDispatcherHostImpl::IsTransferredNavigation(
2328 const GlobalRequestID& transferred_request_id) const { 2331 const GlobalRequestID& transferred_request_id) const {
2329 return transferred_navigations_.find(transferred_request_id) != 2332 return transferred_navigations_.find(transferred_request_id) !=
2330 transferred_navigations_.end(); 2333 transferred_navigations_.end();
2331 } 2334 }
2332 2335
2333 } // namespace content 2336 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_impl.h ('k') | content/public/browser/download_url_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698