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

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

Issue 7624031: Treat files downloaded from the address bar as "always safe" (including extensions per discussion... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 new ResourceDispatcherHostRequestInfo( 518 new ResourceDispatcherHostRequestInfo(
519 handler, 519 handler,
520 process_type, 520 process_type,
521 child_id, 521 child_id,
522 route_id, 522 route_id,
523 request_data.origin_pid, 523 request_data.origin_pid,
524 request_id, 524 request_id,
525 request_data.is_main_frame, 525 request_data.is_main_frame,
526 request_data.frame_id, 526 request_data.frame_id,
527 request_data.resource_type, 527 request_data.resource_type,
528 request_data.transition_type,
528 upload_size, 529 upload_size,
529 false, // is download 530 false, // is download
530 ResourceType::IsFrame(request_data.resource_type), // allow_download 531 ResourceType::IsFrame(request_data.resource_type), // allow_download
531 request_data.has_user_gesture, 532 request_data.has_user_gesture,
532 &resource_context); 533 &resource_context);
533 SetRequestInfo(request, extra_info); // Request takes ownership. 534 SetRequestInfo(request, extra_info); // Request takes ownership.
534 535
535 if (request->url().SchemeIs(chrome::kBlobScheme)) { 536 if (request->url().SchemeIs(chrome::kBlobScheme)) {
536 // Hang on to a reference to ensure the blob is not released prior 537 // Hang on to a reference to ensure the blob is not released prior
537 // to the job being started. 538 // to the job being started.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 642
642 void ResourceDispatcherHost::OnFollowRedirect( 643 void ResourceDispatcherHost::OnFollowRedirect(
643 int request_id, 644 int request_id,
644 bool has_new_first_party_for_cookies, 645 bool has_new_first_party_for_cookies,
645 const GURL& new_first_party_for_cookies) { 646 const GURL& new_first_party_for_cookies) {
646 FollowDeferredRedirect(filter_->child_id(), request_id, 647 FollowDeferredRedirect(filter_->child_id(), request_id,
647 has_new_first_party_for_cookies, 648 has_new_first_party_for_cookies,
648 new_first_party_for_cookies); 649 new_first_party_for_cookies);
649 } 650 }
650 651
651 ResourceDispatcherHostRequestInfo* 652 ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::CreateRequestInfo(
652 ResourceDispatcherHost::CreateRequestInfoForBrowserRequest(
653 ResourceHandler* handler, 653 ResourceHandler* handler,
654 int child_id, 654 int child_id,
655 int route_id, 655 int route_id,
656 bool download, 656 bool download,
657 const content::ResourceContext& context) { 657 const content::ResourceContext& context) {
658 return new ResourceDispatcherHostRequestInfo(handler, 658 return new ResourceDispatcherHostRequestInfo(handler,
659 ChildProcessInfo::RENDER_PROCESS, 659 ChildProcessInfo::RENDER_PROCESS,
660 child_id, 660 child_id,
661 route_id, 661 route_id,
662 0, 662 0,
663 request_id_, 663 request_id_,
664 false, // is_main_frame 664 false, // is_main_frame
665 -1, // frame_id 665 -1, // frame_id
666 ResourceType::SUB_RESOURCE, 666 ResourceType::SUB_RESOURCE,
667 PageTransition::LINK,
667 0, // upload_size 668 0, // upload_size
668 download, // is_download 669 download, // is_download
669 download, // allow_download 670 download, // allow_download
670 false, // has_user_gesture 671 false, // has_user_gesture
671 &context); 672 &context);
672 } 673 }
673 674
674 void ResourceDispatcherHost::OnSwapOutACK( 675 void ResourceDispatcherHost::OnSwapOutACK(
675 const ViewMsg_SwapOut_Params& params) { 676 const ViewMsg_SwapOut_Params& params) {
676 // Closes for cross-site transitions are handled such that the cross-site 677 // Closes for cross-site transitions are handled such that the cross-site
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return; 757 return;
757 } 758 }
758 759
759 request->set_method("GET"); 760 request->set_method("GET");
760 request->set_referrer(MaybeStripReferrer(referrer).spec()); 761 request->set_referrer(MaybeStripReferrer(referrer).spec());
761 request->set_context(context.request_context()); 762 request->set_context(context.request_context());
762 request->set_load_flags(request->load_flags() | 763 request->set_load_flags(request->load_flags() |
763 net::LOAD_IS_DOWNLOAD); 764 net::LOAD_IS_DOWNLOAD);
764 765
765 ResourceDispatcherHostRequestInfo* extra_info = 766 ResourceDispatcherHostRequestInfo* extra_info =
766 CreateRequestInfoForBrowserRequest( 767 CreateRequestInfo(handler, child_id, route_id, true, context);
767 handler, child_id, route_id, true, context);
768 SetRequestInfo(request, extra_info); // Request takes ownership. 768 SetRequestInfo(request, extra_info); // Request takes ownership.
769 769
770 BeginRequestInternal(request); 770 BeginRequestInternal(request);
771 } 771 }
772 772
773 // This function is only used for saving feature. 773 // This function is only used for saving feature.
774 void ResourceDispatcherHost::BeginSaveFile( 774 void ResourceDispatcherHost::BeginSaveFile(
775 const GURL& url, 775 const GURL& url,
776 const GURL& referrer, 776 const GURL& referrer,
777 int child_id, 777 int child_id,
(...skipping 23 matching lines...) Expand all
801 net::URLRequest* request = new net::URLRequest(url, this); 801 net::URLRequest* request = new net::URLRequest(url, this);
802 request->set_method("GET"); 802 request->set_method("GET");
803 request->set_referrer(MaybeStripReferrer(referrer).spec()); 803 request->set_referrer(MaybeStripReferrer(referrer).spec());
804 // So far, for saving page, we need fetch content from cache, in the 804 // So far, for saving page, we need fetch content from cache, in the
805 // future, maybe we can use a configuration to configure this behavior. 805 // future, maybe we can use a configuration to configure this behavior.
806 request->set_load_flags(net::LOAD_PREFERRING_CACHE); 806 request->set_load_flags(net::LOAD_PREFERRING_CACHE);
807 request->set_context(context.request_context()); 807 request->set_context(context.request_context());
808 808
809 // Since we're just saving some resources we need, disallow downloading. 809 // Since we're just saving some resources we need, disallow downloading.
810 ResourceDispatcherHostRequestInfo* extra_info = 810 ResourceDispatcherHostRequestInfo* extra_info =
811 CreateRequestInfoForBrowserRequest( 811 CreateRequestInfo(handler, child_id, route_id, false, context);
812 handler, child_id, route_id, false, context);
813 SetRequestInfo(request, extra_info); // Request takes ownership. 812 SetRequestInfo(request, extra_info); // Request takes ownership.
814 813
815 BeginRequestInternal(request); 814 BeginRequestInternal(request);
816 } 815 }
817 816
818 void ResourceDispatcherHost::FollowDeferredRedirect( 817 void ResourceDispatcherHost::FollowDeferredRedirect(
819 int child_id, 818 int child_id,
820 int request_id, 819 int request_id,
821 bool has_new_first_party_for_cookies, 820 bool has_new_first_party_for_cookies,
822 const GURL& new_first_party_for_cookies) { 821 const GURL& new_first_party_for_cookies) {
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; 2112 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS;
2114 } 2113 }
2115 2114
2116 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { 2115 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() {
2117 return allow_cross_origin_auth_prompt_; 2116 return allow_cross_origin_auth_prompt_;
2118 } 2117 }
2119 2118
2120 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { 2119 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) {
2121 allow_cross_origin_auth_prompt_ = value; 2120 allow_cross_origin_auth_prompt_ = value;
2122 } 2121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698