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

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

Issue 600008: Add option to suppress HTTP Referer header. (Closed)
Patch Set: add comment Created 10 years, 10 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
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (HandleExternalProtocol(request_id, child_id, route_id, 372 if (HandleExternalProtocol(request_id, child_id, route_id,
373 request_data.url, request_data.resource_type, 373 request_data.url, request_data.resource_type,
374 handler)) { 374 handler)) {
375 return; 375 return;
376 } 376 }
377 377
378 // Construct the request. 378 // Construct the request.
379 URLRequest* request = new URLRequest(request_data.url, this); 379 URLRequest* request = new URLRequest(request_data.url, this);
380 request->set_method(request_data.method); 380 request->set_method(request_data.method);
381 request->set_first_party_for_cookies(request_data.first_party_for_cookies); 381 request->set_first_party_for_cookies(request_data.first_party_for_cookies);
382 request->set_referrer(request_data.referrer.spec()); 382 request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch(
383 switches::kNoReferrers) ? std::string() : request_data.referrer.spec());
383 request->SetExtraRequestHeaders(request_data.headers); 384 request->SetExtraRequestHeaders(request_data.headers);
384 385
385 int load_flags = request_data.load_flags; 386 int load_flags = request_data.load_flags;
386 // EV certificate verification could be expensive. We don't want to spend 387 // EV certificate verification could be expensive. We don't want to spend
387 // time performing EV certificate verification on all resources because 388 // time performing EV certificate verification on all resources because
388 // EV status is irrelevant to sub-frames and sub-resources. 389 // EV status is irrelevant to sub-frames and sub-resources.
389 if (request_data.resource_type == ResourceType::MAIN_FRAME) 390 if (request_data.resource_type == ResourceType::MAIN_FRAME)
390 load_flags |= net::LOAD_VERIFY_EV_CERT; 391 load_flags |= net::LOAD_VERIFY_EV_CERT;
391 request->set_load_flags(load_flags); 392 request->set_load_flags(load_flags);
392 request->set_context(context); 393 request->set_context(context);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 receiver_); 609 receiver_);
609 } 610 }
610 611
611 if (!URLRequest::IsHandledURL(url)) { 612 if (!URLRequest::IsHandledURL(url)) {
612 LOG(INFO) << "Download request for unsupported protocol: " << 613 LOG(INFO) << "Download request for unsupported protocol: " <<
613 url.possibly_invalid_spec(); 614 url.possibly_invalid_spec();
614 return; 615 return;
615 } 616 }
616 617
617 request->set_method("GET"); 618 request->set_method("GET");
618 request->set_referrer(referrer.spec()); 619 request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch(
darin (slow to review) 2010/02/10 07:20:41 i think this duplication of code is unfortunate.
620 switches::kNoReferrers) ? std::string() : referrer.spec());
619 request->set_context(request_context); 621 request->set_context(request_context);
620 request->set_load_flags(request->load_flags() | 622 request->set_load_flags(request->load_flags() |
621 net::LOAD_IS_DOWNLOAD); 623 net::LOAD_IS_DOWNLOAD);
622 624
623 ResourceDispatcherHostRequestInfo* extra_info = 625 ResourceDispatcherHostRequestInfo* extra_info =
624 new ResourceDispatcherHostRequestInfo(handler, 626 new ResourceDispatcherHostRequestInfo(handler,
625 ChildProcessInfo::RENDER_PROCESS, 627 ChildProcessInfo::RENDER_PROCESS,
626 child_id, 628 child_id,
627 route_id, 629 route_id,
628 request_id_, 630 request_id_,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (!known_proto) { 666 if (!known_proto) {
665 // Since any URLs which have non-standard scheme have been filtered 667 // Since any URLs which have non-standard scheme have been filtered
666 // by save manager(see GURL::SchemeIsStandard). This situation 668 // by save manager(see GURL::SchemeIsStandard). This situation
667 // should not happen. 669 // should not happen.
668 NOTREACHED(); 670 NOTREACHED();
669 return; 671 return;
670 } 672 }
671 673
672 URLRequest* request = new URLRequest(url, this); 674 URLRequest* request = new URLRequest(url, this);
673 request->set_method("GET"); 675 request->set_method("GET");
674 request->set_referrer(referrer.spec()); 676 request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch(
677 switches::kNoReferrers) ? std::string() : referrer.spec());
675 // So far, for saving page, we need fetch content from cache, in the 678 // So far, for saving page, we need fetch content from cache, in the
676 // future, maybe we can use a configuration to configure this behavior. 679 // future, maybe we can use a configuration to configure this behavior.
677 request->set_load_flags(net::LOAD_PREFERRING_CACHE); 680 request->set_load_flags(net::LOAD_PREFERRING_CACHE);
678 request->set_context(request_context); 681 request->set_context(request_context);
679 682
680 // Since we're just saving some resources we need, disallow downloading. 683 // Since we're just saving some resources we need, disallow downloading.
681 ResourceDispatcherHostRequestInfo* extra_info = 684 ResourceDispatcherHostRequestInfo* extra_info =
682 new ResourceDispatcherHostRequestInfo(handler, 685 new ResourceDispatcherHostRequestInfo(handler,
683 ChildProcessInfo::RENDER_PROCESS, 686 ChildProcessInfo::RENDER_PROCESS,
684 child_id, 687 child_id,
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 case ViewHostMsg_UploadProgress_ACK::ID: 1701 case ViewHostMsg_UploadProgress_ACK::ID:
1699 case ViewHostMsg_SyncLoad::ID: 1702 case ViewHostMsg_SyncLoad::ID:
1700 return true; 1703 return true;
1701 1704
1702 default: 1705 default:
1703 break; 1706 break;
1704 } 1707 }
1705 1708
1706 return false; 1709 return false;
1707 } 1710 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698