| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" | 7 #include "content/child/web_url_loader_impl.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // TODO(brettw) this should take parameter encoding into account when | 453 // TODO(brettw) this should take parameter encoding into account when |
| 454 // creating the GURLs. | 454 // creating the GURLs. |
| 455 | 455 |
| 456 // TODO(horo): Check credentials flag is unset when credentials mode is omit. | 456 // TODO(horo): Check credentials flag is unset when credentials mode is omit. |
| 457 // Check credentials flag is set when credentials mode is include. | 457 // Check credentials flag is set when credentials mode is include. |
| 458 | 458 |
| 459 RequestInfo request_info; | 459 RequestInfo request_info; |
| 460 request_info.method = method; | 460 request_info.method = method; |
| 461 request_info.url = url; | 461 request_info.url = url; |
| 462 request_info.first_party_for_cookies = request.firstPartyForCookies(); | 462 request_info.first_party_for_cookies = request.firstPartyForCookies(); |
| 463 request_info.referrer = referrer_url; | 463 referrer_policy_ = request.referrerPolicy(); |
| 464 request_info.referrer = Referrer(referrer_url, referrer_policy_); |
| 464 request_info.headers = GetWebURLRequestHeaders(request); | 465 request_info.headers = GetWebURLRequestHeaders(request); |
| 465 request_info.load_flags = GetLoadFlagsForWebURLRequest(request); | 466 request_info.load_flags = GetLoadFlagsForWebURLRequest(request); |
| 466 request_info.enable_load_timing = true; | 467 request_info.enable_load_timing = true; |
| 467 request_info.enable_upload_progress = request.reportUploadProgress(); | 468 request_info.enable_upload_progress = request.reportUploadProgress(); |
| 468 // requestor_pid only needs to be non-zero if the request originates outside | 469 // requestor_pid only needs to be non-zero if the request originates outside |
| 469 // the render process, so we can use requestorProcessID even for requests | 470 // the render process, so we can use requestorProcessID even for requests |
| 470 // from in-process plugins. | 471 // from in-process plugins. |
| 471 request_info.requestor_pid = request.requestorProcessID(); | 472 request_info.requestor_pid = request.requestorProcessID(); |
| 472 request_info.request_type = WebURLRequestToResourceType(request); | 473 request_info.request_type = WebURLRequestToResourceType(request); |
| 473 request_info.priority = | 474 request_info.priority = |
| 474 ConvertWebKitPriorityToNetPriority(request.priority()); | 475 ConvertWebKitPriorityToNetPriority(request.priority()); |
| 475 request_info.appcache_host_id = request.appCacheHostID(); | 476 request_info.appcache_host_id = request.appCacheHostID(); |
| 476 request_info.routing_id = request.requestorID(); | 477 request_info.routing_id = request.requestorID(); |
| 477 request_info.download_to_file = request.downloadToFile(); | 478 request_info.download_to_file = request.downloadToFile(); |
| 478 request_info.has_user_gesture = request.hasUserGesture(); | 479 request_info.has_user_gesture = request.hasUserGesture(); |
| 479 request_info.skip_service_worker = request.skipServiceWorker(); | 480 request_info.skip_service_worker = request.skipServiceWorker(); |
| 480 request_info.fetch_request_mode = GetFetchRequestMode(request); | 481 request_info.fetch_request_mode = GetFetchRequestMode(request); |
| 481 request_info.fetch_credentials_mode = GetFetchCredentialsMode(request); | 482 request_info.fetch_credentials_mode = GetFetchCredentialsMode(request); |
| 482 request_info.fetch_request_context_type = GetRequestContextType(request); | 483 request_info.fetch_request_context_type = GetRequestContextType(request); |
| 483 request_info.fetch_frame_type = GetRequestContextFrameType(request); | 484 request_info.fetch_frame_type = GetRequestContextFrameType(request); |
| 484 request_info.extra_data = request.extraData(); | 485 request_info.extra_data = request.extraData(); |
| 485 referrer_policy_ = request.referrerPolicy(); | |
| 486 request_info.referrer_policy = request.referrerPolicy(); | |
| 487 bridge_.reset(resource_dispatcher_->CreateBridge(request_info)); | 486 bridge_.reset(resource_dispatcher_->CreateBridge(request_info)); |
| 488 | 487 |
| 489 if (!request.httpBody().isNull()) { | 488 if (!request.httpBody().isNull()) { |
| 490 // GET and HEAD requests shouldn't have http bodies. | 489 // GET and HEAD requests shouldn't have http bodies. |
| 491 DCHECK(method != "GET" && method != "HEAD"); | 490 DCHECK(method != "GET" && method != "HEAD"); |
| 492 const WebHTTPBody& httpBody = request.httpBody(); | 491 const WebHTTPBody& httpBody = request.httpBody(); |
| 493 size_t i = 0; | 492 size_t i = 0; |
| 494 WebHTTPBody::Element element; | 493 WebHTTPBody::Element element; |
| 495 scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody; | 494 scoped_refptr<ResourceRequestBody> request_body = new ResourceRequestBody; |
| 496 while (httpBody.elementAt(i++, element)) { | 495 while (httpBody.elementAt(i++, element)) { |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 int intra_priority_value) { | 1153 int intra_priority_value) { |
| 1155 context_->DidChangePriority(new_priority, intra_priority_value); | 1154 context_->DidChangePriority(new_priority, intra_priority_value); |
| 1156 } | 1155 } |
| 1157 | 1156 |
| 1158 bool WebURLLoaderImpl::attachThreadedDataReceiver( | 1157 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
| 1159 blink::WebThreadedDataReceiver* threaded_data_receiver) { | 1158 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
| 1160 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | 1159 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
| 1161 } | 1160 } |
| 1162 | 1161 |
| 1163 } // namespace content | 1162 } // namespace content |
| OLD | NEW |