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 <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 // browser. | 442 // browser. |
443 if (stream_override_.get()) { | 443 if (stream_override_.get()) { |
444 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 444 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
445 switches::kEnableBrowserSideNavigation)); | 445 switches::kEnableBrowserSideNavigation)); |
446 DCHECK(!sync_load_response); | 446 DCHECK(!sync_load_response); |
447 DCHECK_NE(WebURLRequest::FrameTypeNone, request.frameType()); | 447 DCHECK_NE(WebURLRequest::FrameTypeNone, request.frameType()); |
448 DCHECK_EQ("GET", request.httpMethod().latin1()); | 448 DCHECK_EQ("GET", request.httpMethod().latin1()); |
449 url = stream_override_->stream_url; | 449 url = stream_override_->stream_url; |
450 } | 450 } |
451 | 451 |
452 // PlzNavigate: the only navigation requests going through the WebURLLoader | |
453 // are the ones created by CommitNavigation. | |
454 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
455 switches::kEnableBrowserSideNavigation) || | |
456 stream_override_.get() || | |
457 request.frameType() == WebURLRequest::FrameTypeNone); | |
458 | |
459 if (CanHandleDataURLRequestLocally()) { | 452 if (CanHandleDataURLRequestLocally()) { |
460 if (sync_load_response) { | 453 if (sync_load_response) { |
461 // This is a sync load. Do the work now. | 454 // This is a sync load. Do the work now. |
462 sync_load_response->url = url; | 455 sync_load_response->url = url; |
463 sync_load_response->error_code = | 456 sync_load_response->error_code = |
464 GetInfoFromDataURL(sync_load_response->url, sync_load_response, | 457 GetInfoFromDataURL(sync_load_response->url, sync_load_response, |
465 &sync_load_response->data); | 458 &sync_load_response->data); |
466 } else { | 459 } else { |
467 task_runner_->PostTask(FROM_HERE, | 460 task_runner_->PostTask(FROM_HERE, |
468 base::Bind(&Context::HandleDataURL, this)); | 461 base::Bind(&Context::HandleDataURL, this)); |
469 } | 462 } |
470 return; | 463 return; |
471 } | 464 } |
472 | 465 |
| 466 // PlzNavigate: outside of tests, the only navigation requests going through |
| 467 // the WebURLLoader are the ones created by CommitNavigation. Several browser |
| 468 // tests load HTML directly through a data url which will be handled by the |
| 469 // block above. |
| 470 DCHECK_IMPLIES(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 471 switches::kEnableBrowserSideNavigation), |
| 472 stream_override_.get() || |
| 473 request.frameType() == WebURLRequest::FrameTypeNone); |
| 474 |
473 GURL referrer_url( | 475 GURL referrer_url( |
474 request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); | 476 request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); |
475 const std::string& method = request.httpMethod().latin1(); | 477 const std::string& method = request.httpMethod().latin1(); |
476 | 478 |
477 // TODO(brettw) this should take parameter encoding into account when | 479 // TODO(brettw) this should take parameter encoding into account when |
478 // creating the GURLs. | 480 // creating the GURLs. |
479 | 481 |
480 // TODO(horo): Check credentials flag is unset when credentials mode is omit. | 482 // TODO(horo): Check credentials flag is unset when credentials mode is omit. |
481 // Check credentials flag is set when credentials mode is include. | 483 // Check credentials flag is set when credentials mode is include. |
482 | 484 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 int intra_priority_value) { | 1140 int intra_priority_value) { |
1139 context_->DidChangePriority(new_priority, intra_priority_value); | 1141 context_->DidChangePriority(new_priority, intra_priority_value); |
1140 } | 1142 } |
1141 | 1143 |
1142 bool WebURLLoaderImpl::attachThreadedDataReceiver( | 1144 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
1143 blink::WebThreadedDataReceiver* threaded_data_receiver) { | 1145 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
1144 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | 1146 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
1145 } | 1147 } |
1146 | 1148 |
1147 } // namespace content | 1149 } // namespace content |
OLD | NEW |