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

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

Issue 2900563002: Network service: Safe browsing check for sub-resources from renderer. (Closed)
Patch Set: . Created 3 years, 6 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 #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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // browser. This should not happen. 620 // browser. This should not happen.
621 // TODO(arthursonzogni): Remove this when the root cause for 621 // TODO(arthursonzogni): Remove this when the root cause for
622 // https://crbug.com/705508 is found. 622 // https://crbug.com/705508 is found.
623 if (IsBrowserSideNavigationEnabled() && 623 if (IsBrowserSideNavigationEnabled() &&
624 IsResourceTypeFrame(resource_request->resource_type) && 624 IsResourceTypeFrame(resource_request->resource_type) &&
625 !resource_request->resource_body_stream_url.SchemeIs(url::kBlobScheme) && 625 !resource_request->resource_body_stream_url.SchemeIs(url::kBlobScheme) &&
626 !consumer_handle.is_valid()) { 626 !consumer_handle.is_valid()) {
627 base::debug::DumpWithoutCrashing(); 627 base::debug::DumpWithoutCrashing();
628 } 628 }
629 629
630 const RequestExtraData empty_extra_data; 630 RequestExtraData empty_extra_data;
631 const RequestExtraData* extra_data; 631 RequestExtraData* extra_data;
632 if (request.GetExtraData()) 632 if (request.GetExtraData())
633 extra_data = static_cast<RequestExtraData*>(request.GetExtraData()); 633 extra_data = static_cast<RequestExtraData*>(request.GetExtraData());
634 else 634 else
635 extra_data = &empty_extra_data; 635 extra_data = &empty_extra_data;
636 extra_data->CopyToResourceRequest(resource_request.get()); 636 extra_data->CopyToResourceRequest(resource_request.get());
637 if (extra_data->url_loader_factory_override()) 637 if (extra_data->url_loader_factory_override())
638 url_loader_factory_ = extra_data->url_loader_factory_override(); 638 url_loader_factory_ = extra_data->url_loader_factory_override();
639 639
640 if (sync_load_response) { 640 if (sync_load_response) {
641 DCHECK(defers_loading_ == NOT_DEFERRING); 641 DCHECK(defers_loading_ == NOT_DEFERRING);
642 resource_dispatcher_->StartSync( 642 resource_dispatcher_->StartSync(
643 std::move(resource_request), request.RequestorID(), sync_load_response, 643 std::move(resource_request), request.RequestorID(), sync_load_response,
644 request.GetLoadingIPCType(), url_loader_factory_); 644 request.GetLoadingIPCType(), url_loader_factory_,
645 extra_data->TakeURLLoaderThrottles());
645 return; 646 return;
646 } 647 }
647 648
648 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Start", this, 649 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Start", this,
649 TRACE_EVENT_FLAG_FLOW_OUT); 650 TRACE_EVENT_FLAG_FLOW_OUT);
650 request_id_ = resource_dispatcher_->StartAsync( 651 request_id_ = resource_dispatcher_->StartAsync(
651 std::move(resource_request), request.RequestorID(), task_runner_, 652 std::move(resource_request), request.RequestorID(), task_runner_,
652 extra_data->frame_origin(), 653 extra_data->frame_origin(),
653 base::MakeUnique<WebURLLoaderImpl::RequestPeerImpl>(this), 654 base::MakeUnique<WebURLLoaderImpl::RequestPeerImpl>(this),
654 request.GetLoadingIPCType(), url_loader_factory_, 655 request.GetLoadingIPCType(), url_loader_factory_,
655 std::move(consumer_handle)); 656 extra_data->TakeURLLoaderThrottles(), std::move(consumer_handle));
656 657
657 if (defers_loading_ != NOT_DEFERRING) 658 if (defers_loading_ != NOT_DEFERRING)
658 resource_dispatcher_->SetDefersLoading(request_id_, true); 659 resource_dispatcher_->SetDefersLoading(request_id_, true);
659 } 660 }
660 661
661 void WebURLLoaderImpl::Context::SetTaskRunner( 662 void WebURLLoaderImpl::Context::SetTaskRunner(
662 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 663 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
663 task_runner_ = task_runner; 664 task_runner_ = task_runner;
664 } 665 }
665 666
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 int intra_priority_value) { 1287 int intra_priority_value) {
1287 context_->DidChangePriority(new_priority, intra_priority_value); 1288 context_->DidChangePriority(new_priority, intra_priority_value);
1288 } 1289 }
1289 1290
1290 void WebURLLoaderImpl::SetLoadingTaskRunner( 1291 void WebURLLoaderImpl::SetLoadingTaskRunner(
1291 base::SingleThreadTaskRunner* loading_task_runner) { 1292 base::SingleThreadTaskRunner* loading_task_runner) {
1292 context_->SetTaskRunner(loading_task_runner); 1293 context_->SetTaskRunner(loading_task_runner);
1293 } 1294 }
1294 1295
1295 } // namespace content 1296 } // namespace content
OLDNEW
« no previous file with comments | « content/child/url_response_body_consumer_unittest.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