| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 base::MessageLoop::current()->PostTask( | 325 base::MessageLoop::current()->PostTask( |
| 326 FROM_HERE, base::Bind(&Context::HandleDataURL, this)); | 326 FROM_HERE, base::Bind(&Context::HandleDataURL, this)); |
| 327 } | 327 } |
| 328 return; | 328 return; |
| 329 } | 329 } |
| 330 | 330 |
| 331 GURL referrer_url( | 331 GURL referrer_url( |
| 332 request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); | 332 request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); |
| 333 const std::string& method = request.httpMethod().latin1(); | 333 const std::string& method = request.httpMethod().latin1(); |
| 334 | 334 |
| 335 int load_flags = net::LOAD_NORMAL | net::LOAD_ENABLE_LOAD_TIMING; | 335 int load_flags = net::LOAD_NORMAL; |
| 336 switch (request.cachePolicy()) { | 336 switch (request.cachePolicy()) { |
| 337 case WebURLRequest::ReloadIgnoringCacheData: | 337 case WebURLRequest::ReloadIgnoringCacheData: |
| 338 // Required by LayoutTests/http/tests/misc/refresh-headers.php | 338 // Required by LayoutTests/http/tests/misc/refresh-headers.php |
| 339 load_flags |= net::LOAD_VALIDATE_CACHE; | 339 load_flags |= net::LOAD_VALIDATE_CACHE; |
| 340 break; | 340 break; |
| 341 case WebURLRequest::ReloadBypassingCache: | 341 case WebURLRequest::ReloadBypassingCache: |
| 342 load_flags |= net::LOAD_BYPASS_CACHE; | 342 load_flags |= net::LOAD_BYPASS_CACHE; |
| 343 break; | 343 break; |
| 344 case WebURLRequest::ReturnCacheDataElseLoad: | 344 case WebURLRequest::ReturnCacheDataElseLoad: |
| 345 load_flags |= net::LOAD_PREFERRING_CACHE; | 345 load_flags |= net::LOAD_PREFERRING_CACHE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // TODO(brettw) this should take parameter encoding into account when | 377 // TODO(brettw) this should take parameter encoding into account when |
| 378 // creating the GURLs. | 378 // creating the GURLs. |
| 379 | 379 |
| 380 RequestInfo request_info; | 380 RequestInfo request_info; |
| 381 request_info.method = method; | 381 request_info.method = method; |
| 382 request_info.url = url; | 382 request_info.url = url; |
| 383 request_info.first_party_for_cookies = request.firstPartyForCookies(); | 383 request_info.first_party_for_cookies = request.firstPartyForCookies(); |
| 384 request_info.referrer = referrer_url; | 384 request_info.referrer = referrer_url; |
| 385 request_info.headers = flattener.GetBuffer(); | 385 request_info.headers = flattener.GetBuffer(); |
| 386 request_info.load_flags = load_flags; | 386 request_info.load_flags = load_flags; |
| 387 request_info.enable_load_timing = true; |
| 387 // requestor_pid only needs to be non-zero if the request originates outside | 388 // requestor_pid only needs to be non-zero if the request originates outside |
| 388 // the render process, so we can use requestorProcessID even for requests | 389 // the render process, so we can use requestorProcessID even for requests |
| 389 // from in-process plugins. | 390 // from in-process plugins. |
| 390 request_info.requestor_pid = request.requestorProcessID(); | 391 request_info.requestor_pid = request.requestorProcessID(); |
| 391 request_info.request_type = WebURLRequestToResourceType(request); | 392 request_info.request_type = WebURLRequestToResourceType(request); |
| 392 request_info.priority = | 393 request_info.priority = |
| 393 ConvertWebKitPriorityToNetPriority(request.priority()); | 394 ConvertWebKitPriorityToNetPriority(request.priority()); |
| 394 request_info.appcache_host_id = request.appCacheHostID(); | 395 request_info.appcache_host_id = request.appCacheHostID(); |
| 395 request_info.routing_id = request.requestorID(); | 396 request_info.routing_id = request.requestorID(); |
| 396 request_info.download_to_file = request.downloadToFile(); | 397 request_info.download_to_file = request.downloadToFile(); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 int intra_priority_value) { | 894 int intra_priority_value) { |
| 894 context_->DidChangePriority(new_priority, intra_priority_value); | 895 context_->DidChangePriority(new_priority, intra_priority_value); |
| 895 } | 896 } |
| 896 | 897 |
| 897 bool WebURLLoaderImpl::attachThreadedDataReceiver( | 898 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
| 898 blink::WebThreadedDataReceiver* threaded_data_receiver) { | 899 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
| 899 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | 900 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
| 900 } | 901 } |
| 901 | 902 |
| 902 } // namespace content | 903 } // namespace content |
| OLD | NEW |