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

Side by Side Diff: webkit/child/weburlloader_impl.cc

Issue 135973009: Don't try to guess the referrer policy, but use the one associated with the request (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | webkit/child/weburlrequest_extradata_impl.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) 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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "webkit/child/weburlloader_impl.h" 7 #include "webkit/child/weburlloader_impl.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 request_info.requestor_pid = request.requestorProcessID(); 384 request_info.requestor_pid = request.requestorProcessID();
385 request_info.request_type = 385 request_info.request_type =
386 ResourceType::FromTargetType(request.targetType()); 386 ResourceType::FromTargetType(request.targetType());
387 request_info.priority = 387 request_info.priority =
388 ConvertWebKitPriorityToNetPriority(request.priority()); 388 ConvertWebKitPriorityToNetPriority(request.priority());
389 request_info.appcache_host_id = request.appCacheHostID(); 389 request_info.appcache_host_id = request.appCacheHostID();
390 request_info.routing_id = request.requestorID(); 390 request_info.routing_id = request.requestorID();
391 request_info.download_to_file = request.downloadToFile(); 391 request_info.download_to_file = request.downloadToFile();
392 request_info.has_user_gesture = request.hasUserGesture(); 392 request_info.has_user_gesture = request.hasUserGesture();
393 request_info.extra_data = request.extraData(); 393 request_info.extra_data = request.extraData();
394 if (request.extraData()) { 394 referrer_policy_ = request.referrerPolicy();
395 referrer_policy_ = static_cast<WebURLRequestExtraDataImpl*>( 395 request_info.referrer_policy = request.referrerPolicy();
396 request.extraData())->referrer_policy();
397 request_info.referrer_policy = referrer_policy_;
398 }
399 bridge_.reset(platform->CreateResourceLoader(request_info)); 396 bridge_.reset(platform->CreateResourceLoader(request_info));
400 397
401 if (!request.httpBody().isNull()) { 398 if (!request.httpBody().isNull()) {
402 // GET and HEAD requests shouldn't have http bodies. 399 // GET and HEAD requests shouldn't have http bodies.
403 DCHECK(method != "GET" && method != "HEAD"); 400 DCHECK(method != "GET" && method != "HEAD");
404 const WebHTTPBody& httpBody = request.httpBody(); 401 const WebHTTPBody& httpBody = request.httpBody();
405 size_t i = 0; 402 size_t i = 0;
406 WebHTTPBody::Element element; 403 WebHTTPBody::Element element;
407 scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody; 404 scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody;
408 while (httpBody.elementAt(i++, element)) { 405 while (httpBody.elementAt(i++, element)) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 WebURLRequest new_request(new_url); 480 WebURLRequest new_request(new_url);
484 new_request.setFirstPartyForCookies(request_.firstPartyForCookies()); 481 new_request.setFirstPartyForCookies(request_.firstPartyForCookies());
485 new_request.setDownloadToFile(request_.downloadToFile()); 482 new_request.setDownloadToFile(request_.downloadToFile());
486 483
487 WebString referrer_string = WebString::fromUTF8("Referer"); 484 WebString referrer_string = WebString::fromUTF8("Referer");
488 WebString referrer = WebSecurityPolicy::generateReferrerHeader( 485 WebString referrer = WebSecurityPolicy::generateReferrerHeader(
489 referrer_policy_, 486 referrer_policy_,
490 new_url, 487 new_url,
491 request_.httpHeaderField(referrer_string)); 488 request_.httpHeaderField(referrer_string));
492 if (!referrer.isEmpty()) 489 if (!referrer.isEmpty())
493 new_request.setHTTPHeaderField(referrer_string, referrer); 490 new_request.setHTTPReferrer(referrer, referrer_policy_);
494 491
495 std::string new_method = net::URLRequest::ComputeMethodForRedirect( 492 std::string new_method = net::URLRequest::ComputeMethodForRedirect(
496 request_.httpMethod().utf8(), response.httpStatusCode()); 493 request_.httpMethod().utf8(), response.httpStatusCode());
497 new_request.setHTTPMethod(WebString::fromUTF8(new_method)); 494 new_request.setHTTPMethod(WebString::fromUTF8(new_method));
498 495
499 client_->willSendRequest(loader_, new_request, response); 496 client_->willSendRequest(loader_, new_request, response);
500 request_ = new_request; 497 request_ = new_request;
501 *has_new_first_party_for_cookies = true; 498 *has_new_first_party_for_cookies = true;
502 *new_first_party_for_cookies = request_.firstPartyForCookies(); 499 *new_first_party_for_cookies = request_.firstPartyForCookies();
503 500
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 850
854 void WebURLLoaderImpl::setDefersLoading(bool value) { 851 void WebURLLoaderImpl::setDefersLoading(bool value) {
855 context_->SetDefersLoading(value); 852 context_->SetDefersLoading(value);
856 } 853 }
857 854
858 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { 855 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
859 context_->DidChangePriority(new_priority); 856 context_->DidChangePriority(new_priority);
860 } 857 }
861 858
862 } // namespace webkit_glue 859 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | webkit/child/weburlrequest_extradata_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698