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

Side by Side Diff: content/child/web_url_loader_impl.cc

Issue 803813003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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
OLDNEW
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 static_cast<RequestExtraData*>(request.extraData()); 430 static_cast<RequestExtraData*>(request.extraData());
431 stream_override_ = extra_data->TakeStreamOverrideOwnership(); 431 stream_override_ = extra_data->TakeStreamOverrideOwnership();
432 } 432 }
433 433
434 GURL url = request.url(); 434 GURL url = request.url();
435 435
436 // PlzNavigate: during navigation, the renderer should request a stream which 436 // PlzNavigate: during navigation, the renderer should request a stream which
437 // contains the body of the response. The request has already been made by the 437 // contains the body of the response. The request has already been made by the
438 // browser. 438 // browser.
439 if (stream_override_.get()) { 439 if (stream_override_.get()) {
440 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 440 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
441 switches::kEnableBrowserSideNavigation)); 441 switches::kEnableBrowserSideNavigation));
442 DCHECK(!sync_load_response); 442 DCHECK(!sync_load_response);
443 DCHECK_NE(WebURLRequest::FrameTypeNone, request.frameType()); 443 DCHECK_NE(WebURLRequest::FrameTypeNone, request.frameType());
444 DCHECK_EQ("GET", request.httpMethod().latin1()); 444 DCHECK_EQ("GET", request.httpMethod().latin1());
445 url = stream_override_->stream_url; 445 url = stream_override_->stream_url;
446 } 446 }
447 447
448 // PlzNavigate: the only navigation requests going through the WebURLLoader 448 // PlzNavigate: the only navigation requests going through the WebURLLoader
449 // are the ones created by CommitNavigation. 449 // are the ones created by CommitNavigation.
450 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( 450 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
451 switches::kEnableBrowserSideNavigation) || 451 switches::kEnableBrowserSideNavigation) ||
452 stream_override_.get() || 452 stream_override_.get() ||
453 request.frameType() == WebURLRequest::FrameTypeNone); 453 request.frameType() == WebURLRequest::FrameTypeNone);
454 454
455 if (CanHandleDataURLRequestLocally()) { 455 if (CanHandleDataURLRequestLocally()) {
456 if (sync_load_response) { 456 if (sync_load_response) {
457 // This is a sync load. Do the work now. 457 // This is a sync load. Do the work now.
458 sync_load_response->url = url; 458 sync_load_response->url = url;
459 sync_load_response->error_code = 459 sync_load_response->error_code =
460 GetInfoFromDataURL(sync_load_response->url, sync_load_response, 460 GetInfoFromDataURL(sync_load_response->url, sync_load_response,
461 &sync_load_response->data); 461 &sync_load_response->data);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 void WebURLLoaderImpl::Context::OnReceivedResponse( 580 void WebURLLoaderImpl::Context::OnReceivedResponse(
581 const ResourceResponseInfo& initial_info) { 581 const ResourceResponseInfo& initial_info) {
582 if (!client_) 582 if (!client_)
583 return; 583 return;
584 584
585 ResourceResponseInfo info = initial_info; 585 ResourceResponseInfo info = initial_info;
586 586
587 // PlzNavigate: during navigations, the ResourceResponse has already been 587 // PlzNavigate: during navigations, the ResourceResponse has already been
588 // received on the browser side, and has been passed down to the renderer. 588 // received on the browser side, and has been passed down to the renderer.
589 if (stream_override_.get()) { 589 if (stream_override_.get()) {
590 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 590 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
591 switches::kEnableBrowserSideNavigation)); 591 switches::kEnableBrowserSideNavigation));
592 info = stream_override_->response; 592 info = stream_override_->response;
593 } 593 }
594 594
595 WebURLResponse response; 595 WebURLResponse response;
596 response.initialize(); 596 response.initialize();
597 PopulateURLResponse(request_.url(), info, &response); 597 PopulateURLResponse(request_.url(), info, &response);
598 598
599 bool show_raw_listing = (GURL(request_.url()).query() == "raw"); 599 bool show_raw_listing = (GURL(request_.url()).query() == "raw");
600 600
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 int intra_priority_value) { 1129 int intra_priority_value) {
1130 context_->DidChangePriority(new_priority, intra_priority_value); 1130 context_->DidChangePriority(new_priority, intra_priority_value);
1131 } 1131 }
1132 1132
1133 bool WebURLLoaderImpl::attachThreadedDataReceiver( 1133 bool WebURLLoaderImpl::attachThreadedDataReceiver(
1134 blink::WebThreadedDataReceiver* threaded_data_receiver) { 1134 blink::WebThreadedDataReceiver* threaded_data_receiver) {
1135 return context_->AttachThreadedDataReceiver(threaded_data_receiver); 1135 return context_->AttachThreadedDataReceiver(threaded_data_receiver);
1136 } 1136 }
1137 1137
1138 } // namespace content 1138 } // namespace content
OLDNEW
« no previous file with comments | « content/child/site_isolation_policy_browsertest.cc ('k') | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698