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

Side by Side Diff: content/browser/loader/navigation_url_loader_network_service.cc

Issue 2906543002: Add support for reading blobs when using the network service. (Closed)
Patch Set: Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/browser/loader/navigation_url_loader_network_service.h" 5 #include "content/browser/loader/navigation_url_loader_network_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 mojom::URLLoaderFactory* factory; 100 mojom::URLLoaderFactory* factory;
101 if (url_loader_factory_ptr) { 101 if (url_loader_factory_ptr) {
102 factory = url_loader_factory_ptr.get(); 102 factory = url_loader_factory_ptr.get();
103 } else { 103 } else {
104 if (factory_from_ui.is_valid()) { 104 if (factory_from_ui.is_valid()) {
105 url_loader_factory_ptr.Bind(std::move(factory_from_ui)); 105 url_loader_factory_ptr.Bind(std::move(factory_from_ui));
106 factory = url_loader_factory_ptr.get(); 106 factory = url_loader_factory_ptr.get();
107 } else { 107 } else {
108 if (appcache_handle_core) { 108 if (appcache_handle_core) {
109 factory = url_loader_factory_getter->GetAppCacheFactory()->get(); 109 factory = url_loader_factory_getter->GetAppCacheFactory()->get();
110 } else if (resource_request->url.SchemeIs(url::kBlobScheme)) {
111 factory = url_loader_factory_getter->GetBlobFactory()->get();
110 } else { 112 } else {
111 factory = url_loader_factory_getter->GetNetworkFactory()->get(); 113 factory = url_loader_factory_getter->GetNetworkFactory()->get();
112 } 114 }
113 } 115 }
114 } 116 }
115 117
116 factory->CreateLoaderAndStart( 118 factory->CreateLoaderAndStart(
117 std::move(url_loader_request), 0 /* routing_id? */, 0 /* request_id? */, 119 std::move(url_loader_request), 0 /* routing_id? */, 0 /* request_id? */,
118 mojom::kURLLoadOptionSendSSLInfo, *resource_request, 120 mojom::kURLLoadOptionSendSSLInfo, *resource_request,
119 std::move(url_loader_client_to_pass)); 121 std::move(url_loader_client_to_pass));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 binding_.Bind(mojo::MakeRequest(&url_loader_client_ptr_to_pass)); 177 binding_.Bind(mojo::MakeRequest(&url_loader_client_ptr_to_pass));
176 178
177 // Check if a web UI scheme wants to handle this request. 179 // Check if a web UI scheme wants to handle this request.
178 mojom::URLLoaderFactoryPtrInfo factory_ptr_info; 180 mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
179 181
180 const auto& schemes = URLDataManagerBackend::GetWebUISchemes(); 182 const auto& schemes = URLDataManagerBackend::GetWebUISchemes();
181 if (std::find(schemes.begin(), schemes.end(), new_request->url.scheme()) != 183 if (std::find(schemes.begin(), schemes.end(), new_request->url.scheme()) !=
182 schemes.end()) { 184 schemes.end()) {
183 FrameTreeNode* frame_tree_node = 185 FrameTreeNode* frame_tree_node =
184 FrameTreeNode::GloballyFindByID(request_info_->frame_tree_node_id); 186 FrameTreeNode::GloballyFindByID(request_info_->frame_tree_node_id);
185 factory_ptr_info = GetWebUIURLLoader(frame_tree_node).PassInterface(); 187 factory_ptr_info = CreateWebUIURLLoader(frame_tree_node).PassInterface();
186 } 188 }
187 189
188 g_next_request_id--; 190 g_next_request_id--;
189 191
190 BrowserThread::PostTask( 192 BrowserThread::PostTask(
191 BrowserThread::IO, FROM_HERE, 193 BrowserThread::IO, FROM_HERE,
192 base::Bind(&PrepareNavigationStartOnIO, 194 base::Bind(&PrepareNavigationStartOnIO,
193 base::Passed(std::move(new_request)), resource_context, 195 base::Passed(std::move(new_request)), resource_context,
194 service_worker_navigation_handle 196 service_worker_navigation_handle
195 ? service_worker_navigation_handle->core() 197 ? service_worker_navigation_handle->core()
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", 277 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted",
276 this, "&NavigationURLLoaderNetworkService", this, 278 this, "&NavigationURLLoaderNetworkService", this,
277 "success", false); 279 "success", false);
278 280
279 delegate_->OnRequestFailed(completion_status.exists_in_cache, 281 delegate_->OnRequestFailed(completion_status.exists_in_cache,
280 completion_status.error_code); 282 completion_status.error_code);
281 } 283 }
282 } 284 }
283 285
284 } // namespace content 286 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698