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 #include "content/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 request_id_, | 429 request_id_, |
430 ConvertWebKitPriorityToNetPriority(new_priority), | 430 ConvertWebKitPriorityToNetPriority(new_priority), |
431 intra_priority_value); | 431 intra_priority_value); |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, | 435 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
436 SyncLoadResponse* sync_load_response) { | 436 SyncLoadResponse* sync_load_response) { |
437 DCHECK(request_id_ == -1); | 437 DCHECK(request_id_ == -1); |
438 request_ = request; // Save the request. | 438 request_ = request; // Save the request. |
439 if (request.getExtraData()) { | |
440 RequestExtraData* extra_data = | |
441 static_cast<RequestExtraData*>(request.getExtraData()); | |
442 stream_override_ = extra_data->TakeStreamOverrideOwnership(); | |
443 } | |
444 | |
445 GURL url = request.url(); | 439 GURL url = request.url(); |
446 | 440 |
447 if (CanHandleDataURLRequestLocally()) { | 441 if (CanHandleDataURLRequestLocally()) { |
448 if (sync_load_response) { | 442 if (sync_load_response) { |
449 // This is a sync load. Do the work now. | 443 // This is a sync load. Do the work now. |
450 sync_load_response->url = url; | 444 sync_load_response->url = url; |
451 sync_load_response->error_code = | 445 sync_load_response->error_code = |
452 GetInfoFromDataURL(sync_load_response->url, sync_load_response, | 446 GetInfoFromDataURL(sync_load_response->url, sync_load_response, |
453 &sync_load_response->data); | 447 &sync_load_response->data); |
454 } else { | 448 } else { |
455 // TODO(alexclarke): Find a way to let blink and chromium FROM_HERE | 449 // TODO(alexclarke): Find a way to let blink and chromium FROM_HERE |
456 // coexist. | 450 // coexist. |
457 web_task_runner_->postTask( | 451 web_task_runner_->postTask( |
458 ::blink::WebTraceLocation(__FUNCTION__, __FILE__), | 452 ::blink::WebTraceLocation(__FUNCTION__, __FILE__), |
459 new HandleDataURLTask(this)); | 453 new HandleDataURLTask(this)); |
460 } | 454 } |
461 return; | 455 return; |
462 } | 456 } |
463 | 457 |
| 458 if (request.getExtraData()) { |
| 459 RequestExtraData* extra_data = |
| 460 static_cast<RequestExtraData*>(request.getExtraData()); |
| 461 stream_override_ = extra_data->TakeStreamOverrideOwnership(); |
| 462 } |
| 463 |
| 464 |
464 // PlzNavigate: outside of tests, the only navigation requests going through | 465 // PlzNavigate: outside of tests, the only navigation requests going through |
465 // the WebURLLoader are the ones created by CommitNavigation. Several browser | 466 // the WebURLLoader are the ones created by CommitNavigation. Several browser |
466 // tests load HTML directly through a data url which will be handled by the | 467 // tests load HTML directly through a data url which will be handled by the |
467 // block above. | 468 // block above. |
468 DCHECK(!IsBrowserSideNavigationEnabled() || stream_override_.get() || | 469 DCHECK(!IsBrowserSideNavigationEnabled() || stream_override_.get() || |
469 request.getFrameType() == WebURLRequest::FrameTypeNone); | 470 request.getFrameType() == WebURLRequest::FrameTypeNone); |
470 | 471 |
471 GURL referrer_url( | 472 GURL referrer_url( |
472 request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); | 473 request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); |
473 const std::string& method = request.httpMethod().latin1(); | 474 const std::string& method = request.httpMethod().latin1(); |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 response->clearHTTPHeaderField(webStringName); | 1198 response->clearHTTPHeaderField(webStringName); |
1198 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1199 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
1199 response->addHTTPHeaderField(webStringName, | 1200 response->addHTTPHeaderField(webStringName, |
1200 WebString::fromLatin1(value)); | 1201 WebString::fromLatin1(value)); |
1201 } | 1202 } |
1202 } | 1203 } |
1203 return true; | 1204 return true; |
1204 } | 1205 } |
1205 | 1206 |
1206 } // namespace content | 1207 } // namespace content |
OLD | NEW |