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
3 // found in the LICENSE file.
5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
7 #include "content/child/web_url_loader_impl.h"
13 #include "base/bind.h"
14 #include "base/command_line.h"
15 #include "base/files/file_path.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/string_util.h"
19 #include "base/time/time.h"
20 #include "content/child/ftp_directory_listing_response_delegate.h"
21 #include "content/child/multipart_response_delegate.h"
22 #include "content/child/request_extra_data.h"
23 #include "content/child/request_info.h"
24 #include "content/child/resource_dispatcher.h"
25 #include "content/child/resource_loader_bridge.h"
26 #include "content/child/sync_load_response.h"
27 #include "content/child/web_data_consumer_handle_impl.h"
28 #include "content/child/web_url_request_util.h"
29 #include "content/child/weburlresponse_extradata_impl.h"
30 #include "content/common/resource_request_body.h"
31 #include "content/common/service_worker/service_worker_types.h"
32 #include "content/public/child/request_peer.h"
33 #include "content/public/common/content_switches.h"
34 #include "mojo/public/cpp/system/data_pipe.h"
35 #include "net/base/data_url.h"
36 #include "net/base/filename_util.h"
37 #include "net/base/mime_util.h"
38 #include "net/base/net_errors.h"
39 #include "net/http/http_response_headers.h"
40 #include "net/http/http_util.h"
41 #include "net/url_request/redirect_info.h"
42 #include "net/url_request/url_request_data_job.h"
43 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h"
44 #include "third_party/WebKit/public/platform/WebURL.h"
45 #include "third_party/WebKit/public/platform/WebURLError.h"
46 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h"
47 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
48 #include "third_party/WebKit/public/platform/WebURLRequest.h"
49 #include "third_party/WebKit/public/platform/WebURLResponse.h"
50 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
53 using base::TimeTicks
;
55 using blink::WebHTTPBody
;
56 using blink::WebHTTPHeaderVisitor
;
57 using blink::WebHTTPLoadInfo
;
58 using blink::WebReferrerPolicy
;
59 using blink::WebSecurityPolicy
;
60 using blink::WebString
;
62 using blink::WebURLError
;
63 using blink::WebURLLoadTiming
;
64 using blink::WebURLLoader
;
65 using blink::WebURLLoaderClient
;
66 using blink::WebURLRequest
;
67 using blink::WebURLResponse
;
71 // Utilities ------------------------------------------------------------------
75 const char kThrottledErrorDescription
[] =
76 "Request throttled. Visit http://dev.chromium.org/throttling for more "
78 const size_t kBodyStreamPipeCapacity
= 4 * 1024;
80 typedef ResourceDevToolsInfo::HeadersVector HeadersVector
;
82 // Converts timing data from |load_timing| to the format used by WebKit.
83 void PopulateURLLoadTiming(const net::LoadTimingInfo
& load_timing
,
84 WebURLLoadTiming
* url_timing
) {
85 DCHECK(!load_timing
.request_start
.is_null());
87 const TimeTicks kNullTicks
;
88 url_timing
->initialize();
89 url_timing
->setRequestTime(
90 (load_timing
.request_start
- kNullTicks
).InSecondsF());
91 url_timing
->setProxyStart(
92 (load_timing
.proxy_resolve_start
- kNullTicks
).InSecondsF());
93 url_timing
->setProxyEnd(
94 (load_timing
.proxy_resolve_end
- kNullTicks
).InSecondsF());
95 url_timing
->setDNSStart(
96 (load_timing
.connect_timing
.dns_start
- kNullTicks
).InSecondsF());
97 url_timing
->setDNSEnd(
98 (load_timing
.connect_timing
.dns_end
- kNullTicks
).InSecondsF());
99 url_timing
->setConnectStart(
100 (load_timing
.connect_timing
.connect_start
- kNullTicks
).InSecondsF());
101 url_timing
->setConnectEnd(
102 (load_timing
.connect_timing
.connect_end
- kNullTicks
).InSecondsF());
103 url_timing
->setSSLStart(
104 (load_timing
.connect_timing
.ssl_start
- kNullTicks
).InSecondsF());
105 url_timing
->setSSLEnd(
106 (load_timing
.connect_timing
.ssl_end
- kNullTicks
).InSecondsF());
107 url_timing
->setSendStart(
108 (load_timing
.send_start
- kNullTicks
).InSecondsF());
109 url_timing
->setSendEnd(
110 (load_timing
.send_end
- kNullTicks
).InSecondsF());
111 url_timing
->setReceiveHeadersEnd(
112 (load_timing
.receive_headers_end
- kNullTicks
).InSecondsF());
115 net::RequestPriority
ConvertWebKitPriorityToNetPriority(
116 const WebURLRequest::Priority
& priority
) {
118 case WebURLRequest::PriorityVeryHigh
:
121 case WebURLRequest::PriorityHigh
:
124 case WebURLRequest::PriorityMedium
:
127 case WebURLRequest::PriorityLow
:
130 case WebURLRequest::PriorityVeryLow
:
133 case WebURLRequest::PriorityUnresolved
:
140 // Extracts info from a data scheme URL into |info| and |data|. Returns net::OK
141 // if successful. Returns a net error code otherwise. Exported only for testing.
142 int GetInfoFromDataURL(const GURL
& url
,
143 ResourceResponseInfo
* info
,
145 // Assure same time for all time fields of data: URLs.
146 Time now
= Time::Now();
147 info
->load_timing
.request_start
= TimeTicks::Now();
148 info
->load_timing
.request_start_time
= now
;
149 info
->request_time
= now
;
150 info
->response_time
= now
;
152 std::string mime_type
;
154 scoped_refptr
<net::HttpResponseHeaders
> headers(
155 new net::HttpResponseHeaders(std::string()));
156 int result
= net::URLRequestDataJob::BuildResponse(
157 url
, &mime_type
, &charset
, data
, headers
.get());
158 if (result
!= net::OK
)
161 info
->headers
= headers
;
162 info
->mime_type
.swap(mime_type
);
163 info
->charset
.swap(charset
);
164 info
->security_info
.clear();
165 info
->content_length
= data
->length();
166 info
->encoded_data_length
= 0;
171 #define COMPILE_ASSERT_MATCHING_ENUMS(content_name, blink_name) \
173 static_cast<int>(content_name) == static_cast<int>(blink_name), \
176 COMPILE_ASSERT_MATCHING_ENUMS(FETCH_REQUEST_MODE_SAME_ORIGIN
,
177 WebURLRequest::FetchRequestModeSameOrigin
);
178 COMPILE_ASSERT_MATCHING_ENUMS(FETCH_REQUEST_MODE_NO_CORS
,
179 WebURLRequest::FetchRequestModeNoCORS
);
180 COMPILE_ASSERT_MATCHING_ENUMS(FETCH_REQUEST_MODE_CORS
,
181 WebURLRequest::FetchRequestModeCORS
);
182 COMPILE_ASSERT_MATCHING_ENUMS(
183 FETCH_REQUEST_MODE_CORS_WITH_FORCED_PREFLIGHT
,
184 WebURLRequest::FetchRequestModeCORSWithForcedPreflight
);
186 FetchRequestMode
GetFetchRequestMode(const WebURLRequest
& request
) {
187 return static_cast<FetchRequestMode
>(request
.fetchRequestMode());
190 COMPILE_ASSERT_MATCHING_ENUMS(FETCH_CREDENTIALS_MODE_OMIT
,
191 WebURLRequest::FetchCredentialsModeOmit
);
192 COMPILE_ASSERT_MATCHING_ENUMS(FETCH_CREDENTIALS_MODE_SAME_ORIGIN
,
193 WebURLRequest::FetchCredentialsModeSameOrigin
);
194 COMPILE_ASSERT_MATCHING_ENUMS(FETCH_CREDENTIALS_MODE_INCLUDE
,
195 WebURLRequest::FetchCredentialsModeInclude
);
197 FetchCredentialsMode
GetFetchCredentialsMode(const WebURLRequest
& request
) {
198 return static_cast<FetchCredentialsMode
>(request
.fetchCredentialsMode());
201 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_FRAME_TYPE_AUXILIARY
,
202 WebURLRequest::FrameTypeAuxiliary
);
203 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_FRAME_TYPE_NESTED
,
204 WebURLRequest::FrameTypeNested
);
205 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_FRAME_TYPE_NONE
,
206 WebURLRequest::FrameTypeNone
);
207 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL
,
208 WebURLRequest::FrameTypeTopLevel
);
210 RequestContextFrameType
GetRequestContextFrameType(
211 const WebURLRequest
& request
) {
212 return static_cast<RequestContextFrameType
>(request
.frameType());
215 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_UNSPECIFIED
,
216 WebURLRequest::RequestContextUnspecified
);
217 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_AUDIO
,
218 WebURLRequest::RequestContextAudio
);
219 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_BEACON
,
220 WebURLRequest::RequestContextBeacon
);
221 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_CSP_REPORT
,
222 WebURLRequest::RequestContextCSPReport
);
223 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_DOWNLOAD
,
224 WebURLRequest::RequestContextDownload
);
225 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_EMBED
,
226 WebURLRequest::RequestContextEmbed
);
227 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_EVENT_SOURCE
,
228 WebURLRequest::RequestContextEventSource
);
229 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_FAVICON
,
230 WebURLRequest::RequestContextFavicon
);
231 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_FETCH
,
232 WebURLRequest::RequestContextFetch
);
233 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_FONT
,
234 WebURLRequest::RequestContextFont
);
235 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_FORM
,
236 WebURLRequest::RequestContextForm
);
237 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_FRAME
,
238 WebURLRequest::RequestContextFrame
);
239 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_HYPERLINK
,
240 WebURLRequest::RequestContextHyperlink
);
241 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_IFRAME
,
242 WebURLRequest::RequestContextIframe
);
243 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_IMAGE
,
244 WebURLRequest::RequestContextImage
);
245 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_IMAGE_SET
,
246 WebURLRequest::RequestContextImageSet
);
247 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_IMPORT
,
248 WebURLRequest::RequestContextImport
);
249 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_INTERNAL
,
250 WebURLRequest::RequestContextInternal
);
251 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_LOCATION
,
252 WebURLRequest::RequestContextLocation
);
253 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_MANIFEST
,
254 WebURLRequest::RequestContextManifest
);
255 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_OBJECT
,
256 WebURLRequest::RequestContextObject
);
257 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_PING
,
258 WebURLRequest::RequestContextPing
);
259 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_PLUGIN
,
260 WebURLRequest::RequestContextPlugin
);
261 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_PREFETCH
,
262 WebURLRequest::RequestContextPrefetch
);
263 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_SCRIPT
,
264 WebURLRequest::RequestContextScript
);
265 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_SERVICE_WORKER
,
266 WebURLRequest::RequestContextServiceWorker
);
267 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_SHARED_WORKER
,
268 WebURLRequest::RequestContextSharedWorker
);
269 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_SUBRESOURCE
,
270 WebURLRequest::RequestContextSubresource
);
271 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_STYLE
,
272 WebURLRequest::RequestContextStyle
);
273 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_TRACK
,
274 WebURLRequest::RequestContextTrack
);
275 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_VIDEO
,
276 WebURLRequest::RequestContextVideo
);
277 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_WORKER
,
278 WebURLRequest::RequestContextWorker
);
279 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST
,
280 WebURLRequest::RequestContextXMLHttpRequest
);
281 COMPILE_ASSERT_MATCHING_ENUMS(REQUEST_CONTEXT_TYPE_XSLT
,
282 WebURLRequest::RequestContextXSLT
);
284 RequestContextType
GetRequestContextType(const WebURLRequest
& request
) {
285 return static_cast<RequestContextType
>(request
.requestContext());
290 // WebURLLoaderImpl::Context --------------------------------------------------
292 // This inner class exists since the WebURLLoader may be deleted while inside a
293 // call to WebURLLoaderClient. Refcounting is to keep the context from being
294 // deleted if it may have work to do after calling into the client.
295 class WebURLLoaderImpl::Context
: public base::RefCounted
<Context
>,
298 Context(WebURLLoaderImpl
* loader
,
299 ResourceDispatcher
* resource_dispatcher
,
300 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
);
302 WebURLLoaderClient
* client() const { return client_
; }
303 void set_client(WebURLLoaderClient
* client
) { client_
= client
; }
306 void SetDefersLoading(bool value
);
307 void DidChangePriority(WebURLRequest::Priority new_priority
,
308 int intra_priority_value
);
309 bool AttachThreadedDataReceiver(
310 blink::WebThreadedDataReceiver
* threaded_data_receiver
);
311 void Start(const WebURLRequest
& request
,
312 SyncLoadResponse
* sync_load_response
);
314 // RequestPeer methods:
315 void OnUploadProgress(uint64 position
, uint64 size
) override
;
316 bool OnReceivedRedirect(const net::RedirectInfo
& redirect_info
,
317 const ResourceResponseInfo
& info
) override
;
318 void OnReceivedResponse(const ResourceResponseInfo
& info
) override
;
319 void OnDownloadedData(int len
, int encoded_data_length
) override
;
320 void OnReceivedData(const char* data
,
322 int encoded_data_length
) override
;
323 void OnReceivedCachedMetadata(const char* data
, int len
) override
;
324 void OnCompletedRequest(int error_code
,
325 bool was_ignored_by_handler
,
326 bool stale_copy_in_cache
,
327 const std::string
& security_info
,
328 const base::TimeTicks
& completion_time
,
329 int64 total_transfer_size
) override
;
332 friend class base::RefCounted
<Context
>;
333 ~Context() override
{}
335 // We can optimize the handling of data URLs in most cases.
336 bool CanHandleDataURLRequestLocally() const;
337 void HandleDataURL();
338 MojoResult
WriteDataOnBodyStream(const char* data
, size_t size
);
339 void OnHandleGotWritable(MojoResult
);
341 WebURLLoaderImpl
* loader_
;
342 WebURLRequest request_
;
343 WebURLLoaderClient
* client_
;
344 ResourceDispatcher
* resource_dispatcher_
;
345 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner_
;
346 WebReferrerPolicy referrer_policy_
;
347 scoped_ptr
<ResourceLoaderBridge
> bridge_
;
348 scoped_ptr
<FtpDirectoryListingResponseDelegate
> ftp_listing_delegate_
;
349 scoped_ptr
<MultipartResponseDelegate
> multipart_delegate_
;
350 scoped_ptr
<ResourceLoaderBridge
> completed_bridge_
;
351 scoped_ptr
<StreamOverrideParameters
> stream_override_
;
352 mojo::ScopedDataPipeProducerHandle body_stream_writer_
;
353 mojo::common::HandleWatcher body_stream_writer_watcher_
;
354 // TODO(yhirano): Delete this buffer after implementing the back-pressure
356 std::deque
<char> body_stream_buffer_
;
357 bool got_all_stream_body_data_
;
358 enum DeferState
{NOT_DEFERRING
, SHOULD_DEFER
, DEFERRED_DATA
};
359 DeferState defers_loading_
;
362 WebURLLoaderImpl::Context::Context(
363 WebURLLoaderImpl
* loader
,
364 ResourceDispatcher
* resource_dispatcher
,
365 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
)
368 resource_dispatcher_(resource_dispatcher
),
369 task_runner_(task_runner
),
370 referrer_policy_(blink::WebReferrerPolicyDefault
),
371 got_all_stream_body_data_(false),
372 defers_loading_(NOT_DEFERRING
) {
375 void WebURLLoaderImpl::Context::Cancel() {
381 // Ensure that we do not notify the multipart delegate anymore as it has
382 // its own pointer to the client.
383 if (multipart_delegate_
)
384 multipart_delegate_
->Cancel();
385 // Ditto for the ftp delegate.
386 if (ftp_listing_delegate_
)
387 ftp_listing_delegate_
->Cancel();
389 // Do not make any further calls to the client.
394 void WebURLLoaderImpl::Context::SetDefersLoading(bool value
) {
396 bridge_
->SetDefersLoading(value
);
397 if (value
&& defers_loading_
== NOT_DEFERRING
) {
398 defers_loading_
= SHOULD_DEFER
;
399 } else if (!value
&& defers_loading_
!= NOT_DEFERRING
) {
400 if (defers_loading_
== DEFERRED_DATA
) {
401 task_runner_
->PostTask(FROM_HERE
,
402 base::Bind(&Context::HandleDataURL
, this));
404 defers_loading_
= NOT_DEFERRING
;
408 void WebURLLoaderImpl::Context::DidChangePriority(
409 WebURLRequest::Priority new_priority
, int intra_priority_value
) {
411 bridge_
->DidChangePriority(
412 ConvertWebKitPriorityToNetPriority(new_priority
), intra_priority_value
);
415 bool WebURLLoaderImpl::Context::AttachThreadedDataReceiver(
416 blink::WebThreadedDataReceiver
* threaded_data_receiver
) {
418 return bridge_
->AttachThreadedDataReceiver(threaded_data_receiver
);
423 void WebURLLoaderImpl::Context::Start(const WebURLRequest
& request
,
424 SyncLoadResponse
* sync_load_response
) {
425 DCHECK(!bridge_
.get());
427 request_
= request
; // Save the request.
428 if (request
.extraData()) {
429 RequestExtraData
* extra_data
=
430 static_cast<RequestExtraData
*>(request
.extraData());
431 stream_override_
= extra_data
->TakeStreamOverrideOwnership();
434 GURL url
= request
.url();
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
439 if (stream_override_
.get()) {
440 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
441 switches::kEnableBrowserSideNavigation
));
442 DCHECK(!sync_load_response
);
443 DCHECK_NE(WebURLRequest::FrameTypeNone
, request
.frameType());
444 DCHECK_EQ("GET", request
.httpMethod().latin1());
445 url
= stream_override_
->stream_url
;
448 // PlzNavigate: the only navigation requests going through the WebURLLoader
449 // are the ones created by CommitNavigation.
450 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
451 switches::kEnableBrowserSideNavigation
) ||
452 stream_override_
.get() ||
453 request
.frameType() == WebURLRequest::FrameTypeNone
);
455 if (CanHandleDataURLRequestLocally()) {
456 if (sync_load_response
) {
457 // This is a sync load. Do the work now.
458 sync_load_response
->url
= url
;
459 sync_load_response
->error_code
=
460 GetInfoFromDataURL(sync_load_response
->url
, sync_load_response
,
461 &sync_load_response
->data
);
463 task_runner_
->PostTask(FROM_HERE
,
464 base::Bind(&Context::HandleDataURL
, this));
470 request
.httpHeaderField(WebString::fromUTF8("Referer")).latin1());
471 const std::string
& method
= request
.httpMethod().latin1();
473 // TODO(brettw) this should take parameter encoding into account when
474 // creating the GURLs.
476 // TODO(horo): Check credentials flag is unset when credentials mode is omit.
477 // Check credentials flag is set when credentials mode is include.
479 RequestInfo request_info
;
480 request_info
.method
= method
;
481 request_info
.url
= url
;
482 request_info
.first_party_for_cookies
= request
.firstPartyForCookies();
483 referrer_policy_
= request
.referrerPolicy();
484 request_info
.referrer
= Referrer(referrer_url
, referrer_policy_
);
485 request_info
.headers
= GetWebURLRequestHeaders(request
);
486 request_info
.load_flags
= GetLoadFlagsForWebURLRequest(request
);
487 request_info
.enable_load_timing
= true;
488 request_info
.enable_upload_progress
= request
.reportUploadProgress();
489 // requestor_pid only needs to be non-zero if the request originates outside
490 // the render process, so we can use requestorProcessID even for requests
491 // from in-process plugins.
492 request_info
.requestor_pid
= request
.requestorProcessID();
493 request_info
.request_type
= WebURLRequestToResourceType(request
);
494 request_info
.priority
=
495 ConvertWebKitPriorityToNetPriority(request
.priority());
496 request_info
.appcache_host_id
= request
.appCacheHostID();
497 request_info
.routing_id
= request
.requestorID();
498 request_info
.download_to_file
= request
.downloadToFile();
499 request_info
.has_user_gesture
= request
.hasUserGesture();
500 request_info
.skip_service_worker
= request
.skipServiceWorker();
501 request_info
.should_reset_appcache
= request
.shouldResetAppCache();
502 request_info
.fetch_request_mode
= GetFetchRequestMode(request
);
503 request_info
.fetch_credentials_mode
= GetFetchCredentialsMode(request
);
504 request_info
.fetch_request_context_type
= GetRequestContextType(request
);
505 request_info
.fetch_frame_type
= GetRequestContextFrameType(request
);
506 request_info
.extra_data
= request
.extraData();
507 bridge_
.reset(resource_dispatcher_
->CreateBridge(request_info
));
508 bridge_
->SetRequestBody(GetRequestBodyForWebURLRequest(request
).get());
510 if (sync_load_response
) {
511 bridge_
->SyncLoad(sync_load_response
);
515 // TODO(mmenke): This case probably never happens, anyways. Probably should
516 // not handle this case at all. If it's worth handling, this code currently
517 // results in the request just hanging, which should be fixed.
518 if (!bridge_
->Start(this))
522 void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position
, uint64 size
) {
524 client_
->didSendData(loader_
, position
, size
);
527 bool WebURLLoaderImpl::Context::OnReceivedRedirect(
528 const net::RedirectInfo
& redirect_info
,
529 const ResourceResponseInfo
& info
) {
533 WebURLResponse response
;
534 response
.initialize();
535 PopulateURLResponse(request_
.url(), info
, &response
);
537 // TODO(darin): We lack sufficient information to construct the actual
538 // request that resulted from the redirect.
539 WebURLRequest
new_request(redirect_info
.new_url
);
540 new_request
.setFirstPartyForCookies(
541 redirect_info
.new_first_party_for_cookies
);
542 new_request
.setDownloadToFile(request_
.downloadToFile());
543 new_request
.setRequestContext(request_
.requestContext());
544 new_request
.setFrameType(request_
.frameType());
545 new_request
.setSkipServiceWorker(request_
.skipServiceWorker());
546 new_request
.setShouldResetAppCache(request_
.shouldResetAppCache());
547 new_request
.setFetchRequestMode(request_
.fetchRequestMode());
548 new_request
.setFetchCredentialsMode(request_
.fetchCredentialsMode());
550 new_request
.setHTTPReferrer(WebString::fromUTF8(redirect_info
.new_referrer
),
553 std::string old_method
= request_
.httpMethod().utf8();
554 new_request
.setHTTPMethod(WebString::fromUTF8(redirect_info
.new_method
));
555 if (redirect_info
.new_method
== old_method
)
556 new_request
.setHTTPBody(request_
.httpBody());
558 // Protect from deletion during call to willSendRequest.
559 scoped_refptr
<Context
> protect(this);
561 client_
->willSendRequest(loader_
, new_request
, response
);
562 request_
= new_request
;
564 // Only follow the redirect if WebKit left the URL unmodified.
565 if (redirect_info
.new_url
== GURL(new_request
.url())) {
566 // First-party cookie logic moved from DocumentLoader in Blink to
567 // net::URLRequest in the browser. Assert that Blink didn't try to change it
568 // to something else.
569 DCHECK_EQ(redirect_info
.new_first_party_for_cookies
.spec(),
570 request_
.firstPartyForCookies().string().utf8());
574 // We assume that WebKit only changes the URL to suppress a redirect, and we
575 // assume that it does so by setting it to be invalid.
576 DCHECK(!new_request
.url().isValid());
580 void WebURLLoaderImpl::Context::OnReceivedResponse(
581 const ResourceResponseInfo
& initial_info
) {
585 ResourceResponseInfo info
= initial_info
;
587 // PlzNavigate: during navigations, the ResourceResponse has already been
588 // received on the browser side, and has been passed down to the renderer.
589 if (stream_override_
.get()) {
590 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
591 switches::kEnableBrowserSideNavigation
));
592 info
= stream_override_
->response
;
595 WebURLResponse response
;
596 response
.initialize();
597 PopulateURLResponse(request_
.url(), info
, &response
);
599 bool show_raw_listing
= (GURL(request_
.url()).query() == "raw");
601 if (info
.mime_type
== "text/vnd.chromium.ftp-dir") {
602 if (show_raw_listing
) {
603 // Set the MIME type to plain text to prevent any active content.
604 response
.setMIMEType("text/plain");
606 // We're going to produce a parsed listing in HTML.
607 response
.setMIMEType("text/html");
611 // Prevent |this| from being destroyed if the client destroys the loader,
612 // ether in didReceiveResponse, or when the multipart/ftp delegate calls into
614 scoped_refptr
<Context
> protect(this);
616 if (request_
.useStreamOnResponse()) {
617 MojoCreateDataPipeOptions options
;
618 options
.struct_size
= sizeof(MojoCreateDataPipeOptions
);
619 options
.flags
= MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE
;
620 options
.element_num_bytes
= 1;
621 options
.capacity_num_bytes
= kBodyStreamPipeCapacity
;
623 mojo::ScopedDataPipeConsumerHandle consumer
;
624 MojoResult result
= mojo::CreateDataPipe(&options
,
625 &body_stream_writer_
,
627 if (result
!= MOJO_RESULT_OK
) {
628 // TODO(yhirano): Handle the error.
631 client_
->didReceiveResponse(
632 loader_
, response
, new WebDataConsumerHandleImpl(consumer
.Pass()));
634 client_
->didReceiveResponse(loader_
, response
);
637 // We may have been cancelled after didReceiveResponse, which would leave us
638 // without a client and therefore without much need to do further handling.
642 DCHECK(!ftp_listing_delegate_
.get());
643 DCHECK(!multipart_delegate_
.get());
644 if (info
.headers
.get() && info
.mime_type
== "multipart/x-mixed-replace") {
645 std::string content_type
;
646 info
.headers
->EnumerateHeader(NULL
, "content-type", &content_type
);
648 std::string mime_type
;
650 bool had_charset
= false;
651 std::string boundary
;
652 net::HttpUtil::ParseContentType(content_type
, &mime_type
, &charset
,
653 &had_charset
, &boundary
);
654 base::TrimString(boundary
, " \"", &boundary
);
656 // If there's no boundary, just handle the request normally. In the gecko
657 // code, nsMultiMixedConv::OnStartRequest throws an exception.
658 if (!boundary
.empty()) {
659 multipart_delegate_
.reset(
660 new MultipartResponseDelegate(client_
, loader_
, response
, boundary
));
662 } else if (info
.mime_type
== "text/vnd.chromium.ftp-dir" &&
664 ftp_listing_delegate_
.reset(
665 new FtpDirectoryListingResponseDelegate(client_
, loader_
, response
));
669 void WebURLLoaderImpl::Context::OnDownloadedData(int len
,
670 int encoded_data_length
) {
672 client_
->didDownloadData(loader_
, len
, encoded_data_length
);
675 void WebURLLoaderImpl::Context::OnReceivedData(const char* data
,
677 int encoded_data_length
) {
681 if (request_
.useStreamOnResponse()) {
682 // We don't support ftp_listening_delegate_ and multipart_delegate_ for now.
683 // TODO(yhirano): Support ftp listening and multipart.
684 MojoResult rv
= WriteDataOnBodyStream(data
, data_length
);
685 if (rv
!= MOJO_RESULT_OK
&& client_
) {
686 client_
->didFail(loader_
,
687 loader_
->CreateError(request_
.url(),
691 } else if (ftp_listing_delegate_
) {
692 // The FTP listing delegate will make the appropriate calls to
693 // client_->didReceiveData and client_->didReceiveResponse. Since the
694 // delegate may want to do work after sending data to the delegate, keep
695 // |this| and the delegate alive until it's finished handling the data.
696 scoped_refptr
<Context
> protect(this);
697 ftp_listing_delegate_
->OnReceivedData(data
, data_length
);
698 } else if (multipart_delegate_
) {
699 // The multipart delegate will make the appropriate calls to
700 // client_->didReceiveData and client_->didReceiveResponse. Since the
701 // delegate may want to do work after sending data to the delegate, keep
702 // |this| and the delegate alive until it's finished handling the data.
703 scoped_refptr
<Context
> protect(this);
704 multipart_delegate_
->OnReceivedData(data
, data_length
, encoded_data_length
);
706 client_
->didReceiveData(loader_
, data
, data_length
, encoded_data_length
);
710 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata(
711 const char* data
, int len
) {
713 client_
->didReceiveCachedMetadata(loader_
, data
, len
);
716 void WebURLLoaderImpl::Context::OnCompletedRequest(
718 bool was_ignored_by_handler
,
719 bool stale_copy_in_cache
,
720 const std::string
& security_info
,
721 const base::TimeTicks
& completion_time
,
722 int64 total_transfer_size
) {
723 // The WebURLLoaderImpl may be deleted in any of the calls to the client or
724 // the delegates below (As they also may call in to the client). Keep |this|
725 // alive in that case, to avoid a crash. If that happens, the request will be
726 // cancelled and |client_| will be set to NULL.
727 scoped_refptr
<Context
> protect(this);
729 if (ftp_listing_delegate_
) {
730 ftp_listing_delegate_
->OnCompletedRequest();
731 ftp_listing_delegate_
.reset(NULL
);
732 } else if (multipart_delegate_
) {
733 multipart_delegate_
->OnCompletedRequest();
734 multipart_delegate_
.reset(NULL
);
737 // Prevent any further IPC to the browser now that we're complete, but
738 // don't delete it to keep any downloaded temp files alive.
739 DCHECK(!completed_bridge_
.get());
740 completed_bridge_
.swap(bridge_
);
743 if (error_code
!= net::OK
) {
744 client_
->didFail(loader_
, CreateError(request_
.url(),
748 if (request_
.useStreamOnResponse()) {
749 got_all_stream_body_data_
= true;
750 if (body_stream_buffer_
.empty()) {
751 // Close the handle to notify the end of data.
752 body_stream_writer_
.reset();
753 client_
->didFinishLoading(
754 loader_
, (completion_time
- TimeTicks()).InSecondsF(),
755 total_transfer_size
);
758 client_
->didFinishLoading(
759 loader_
, (completion_time
- TimeTicks()).InSecondsF(),
760 total_transfer_size
);
766 bool WebURLLoaderImpl::Context::CanHandleDataURLRequestLocally() const {
767 GURL url
= request_
.url();
768 if (!url
.SchemeIs(url::kDataScheme
))
771 // The fast paths for data URL, Start() and HandleDataURL(), don't support
772 // the downloadToFile option.
773 if (request_
.downloadToFile())
776 // Optimize for the case where we can handle a data URL locally. We must
777 // skip this for data URLs targetted at frames since those could trigger a
780 // NOTE: We special case MIME types we can render both for performance
781 // reasons as well as to support unit tests, which do not have an underlying
782 // ResourceLoaderBridge implementation.
784 #if defined(OS_ANDROID)
785 // For compatibility reasons on Android we need to expose top-level data://
787 if (request_
.frameType() == WebURLRequest::FrameTypeTopLevel
)
791 if (request_
.frameType() != WebURLRequest::FrameTypeTopLevel
&&
792 request_
.frameType() != WebURLRequest::FrameTypeNested
)
795 std::string mime_type
, unused_charset
;
796 if (net::DataURL::Parse(request_
.url(), &mime_type
, &unused_charset
, NULL
) &&
797 net::IsSupportedMimeType(mime_type
))
803 void WebURLLoaderImpl::Context::HandleDataURL() {
804 DCHECK_NE(defers_loading_
, DEFERRED_DATA
);
805 if (defers_loading_
== SHOULD_DEFER
) {
806 defers_loading_
= DEFERRED_DATA
;
810 ResourceResponseInfo info
;
813 int error_code
= GetInfoFromDataURL(request_
.url(), &info
, &data
);
815 if (error_code
== net::OK
) {
816 OnReceivedResponse(info
);
818 OnReceivedData(data
.data(), data
.size(), 0);
821 OnCompletedRequest(error_code
, false, false, info
.security_info
,
822 base::TimeTicks::Now(), 0);
825 MojoResult
WebURLLoaderImpl::Context::WriteDataOnBodyStream(const char* data
,
827 if (body_stream_buffer_
.empty() && size
== 0) {
829 return MOJO_RESULT_OK
;
832 if (!body_stream_writer_
.is_valid()) {
833 // The handle is already cleared.
834 return MOJO_RESULT_OK
;
837 char* buffer
= nullptr;
838 uint32_t num_bytes_writable
= 0;
839 MojoResult rv
= mojo::BeginWriteDataRaw(body_stream_writer_
.get(),
840 reinterpret_cast<void**>(&buffer
),
842 MOJO_WRITE_DATA_FLAG_NONE
);
843 if (rv
== MOJO_RESULT_SHOULD_WAIT
) {
844 body_stream_buffer_
.insert(body_stream_buffer_
.end(), data
, data
+ size
);
845 body_stream_writer_watcher_
.Start(
846 body_stream_writer_
.get(),
847 MOJO_HANDLE_SIGNAL_WRITABLE
,
848 MOJO_DEADLINE_INDEFINITE
,
849 base::Bind(&WebURLLoaderImpl::Context::OnHandleGotWritable
,
850 base::Unretained(this)));
851 return MOJO_RESULT_OK
;
854 if (rv
!= MOJO_RESULT_OK
)
857 uint32_t num_bytes_to_write
= 0;
858 if (num_bytes_writable
< body_stream_buffer_
.size()) {
859 auto begin
= body_stream_buffer_
.begin();
860 auto end
= body_stream_buffer_
.begin() + num_bytes_writable
;
862 std::copy(begin
, end
, buffer
);
863 num_bytes_to_write
= num_bytes_writable
;
864 body_stream_buffer_
.erase(begin
, end
);
865 body_stream_buffer_
.insert(body_stream_buffer_
.end(), data
, data
+ size
);
867 std::copy(body_stream_buffer_
.begin(), body_stream_buffer_
.end(), buffer
);
868 num_bytes_writable
-= body_stream_buffer_
.size();
869 num_bytes_to_write
+= body_stream_buffer_
.size();
870 buffer
+= body_stream_buffer_
.size();
871 body_stream_buffer_
.clear();
873 size_t num_newbytes_to_write
=
874 std::min(size
, static_cast<size_t>(num_bytes_writable
));
875 std::copy(data
, data
+ num_newbytes_to_write
, buffer
);
876 num_bytes_to_write
+= num_newbytes_to_write
;
877 body_stream_buffer_
.insert(body_stream_buffer_
.end(),
878 data
+ num_newbytes_to_write
,
882 rv
= mojo::EndWriteDataRaw(body_stream_writer_
.get(), num_bytes_to_write
);
883 if (rv
== MOJO_RESULT_OK
&& !body_stream_buffer_
.empty()) {
884 body_stream_writer_watcher_
.Start(
885 body_stream_writer_
.get(),
886 MOJO_HANDLE_SIGNAL_WRITABLE
,
887 MOJO_DEADLINE_INDEFINITE
,
888 base::Bind(&WebURLLoaderImpl::Context::OnHandleGotWritable
,
889 base::Unretained(this)));
894 void WebURLLoaderImpl::Context::OnHandleGotWritable(MojoResult result
) {
895 if (result
!= MOJO_RESULT_OK
) {
897 client_
->didFail(loader_
,
898 loader_
->CreateError(request_
.url(),
901 // |this| can be deleted here.
906 if (body_stream_buffer_
.empty())
909 MojoResult rv
= WriteDataOnBodyStream(nullptr, 0);
910 if (rv
== MOJO_RESULT_OK
) {
911 if (got_all_stream_body_data_
&& body_stream_buffer_
.empty()) {
912 // Close the handle to notify the end of data.
913 body_stream_writer_
.reset();
915 // TODO(yhirano): Pass appropriate arguments.
916 client_
->didFinishLoading(loader_
, 0, 0);
917 // |this| can be deleted here.
922 client_
->didFail(loader_
, loader_
->CreateError(request_
.url(),
925 // |this| can be deleted here.
930 // WebURLLoaderImpl -----------------------------------------------------------
932 WebURLLoaderImpl::WebURLLoaderImpl(
933 ResourceDispatcher
* resource_dispatcher
,
934 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
)
935 : context_(new Context(this, resource_dispatcher
, task_runner
)) {
938 WebURLLoaderImpl::~WebURLLoaderImpl() {
942 WebURLError
WebURLLoaderImpl::CreateError(const WebURL
& unreachable_url
,
943 bool stale_copy_in_cache
,
946 error
.domain
= WebString::fromUTF8(net::kErrorDomain
);
947 error
.reason
= reason
;
948 error
.unreachableURL
= unreachable_url
;
949 error
.staleCopyInCache
= stale_copy_in_cache
;
950 if (reason
== net::ERR_ABORTED
) {
951 error
.isCancellation
= true;
952 } else if (reason
== net::ERR_TEMPORARILY_THROTTLED
) {
953 error
.localizedDescription
= WebString::fromUTF8(
954 kThrottledErrorDescription
);
956 error
.localizedDescription
= WebString::fromUTF8(
957 net::ErrorToString(reason
));
962 void WebURLLoaderImpl::PopulateURLResponse(const GURL
& url
,
963 const ResourceResponseInfo
& info
,
964 WebURLResponse
* response
) {
965 response
->setURL(url
);
966 response
->setResponseTime(info
.response_time
.ToDoubleT());
967 response
->setMIMEType(WebString::fromUTF8(info
.mime_type
));
968 response
->setTextEncodingName(WebString::fromUTF8(info
.charset
));
969 response
->setExpectedContentLength(info
.content_length
);
970 response
->setSecurityInfo(info
.security_info
);
971 response
->setAppCacheID(info
.appcache_id
);
972 response
->setAppCacheManifestURL(info
.appcache_manifest_url
);
973 response
->setWasCached(!info
.load_timing
.request_start_time
.is_null() &&
974 info
.response_time
< info
.load_timing
.request_start_time
);
975 response
->setRemoteIPAddress(
976 WebString::fromUTF8(info
.socket_address
.host()));
977 response
->setRemotePort(info
.socket_address
.port());
978 response
->setConnectionID(info
.load_timing
.socket_log_id
);
979 response
->setConnectionReused(info
.load_timing
.socket_reused
);
980 response
->setDownloadFilePath(info
.download_file_path
.AsUTF16Unsafe());
981 response
->setWasFetchedViaSPDY(info
.was_fetched_via_spdy
);
982 response
->setWasFetchedViaServiceWorker(info
.was_fetched_via_service_worker
);
983 response
->setWasFallbackRequiredByServiceWorker(
984 info
.was_fallback_required_by_service_worker
);
985 response
->setServiceWorkerResponseType(info
.response_type_via_service_worker
);
986 response
->setOriginalURLViaServiceWorker(
987 info
.original_url_via_service_worker
);
989 WebURLResponseExtraDataImpl
* extra_data
=
990 new WebURLResponseExtraDataImpl(info
.npn_negotiated_protocol
);
991 response
->setExtraData(extra_data
);
992 extra_data
->set_was_fetched_via_spdy(info
.was_fetched_via_spdy
);
993 extra_data
->set_was_npn_negotiated(info
.was_npn_negotiated
);
994 extra_data
->set_was_alternate_protocol_available(
995 info
.was_alternate_protocol_available
);
996 extra_data
->set_connection_info(info
.connection_info
);
997 extra_data
->set_was_fetched_via_proxy(info
.was_fetched_via_proxy
);
998 extra_data
->set_proxy_server(info
.proxy_server
);
1000 // If there's no received headers end time, don't set load timing. This is
1001 // the case for non-HTTP requests, requests that don't go over the wire, and
1002 // certain error cases.
1003 if (!info
.load_timing
.receive_headers_end
.is_null()) {
1004 WebURLLoadTiming timing
;
1005 PopulateURLLoadTiming(info
.load_timing
, &timing
);
1006 const TimeTicks kNullTicks
;
1007 timing
.setServiceWorkerFetchStart(
1008 (info
.service_worker_fetch_start
- kNullTicks
).InSecondsF());
1009 timing
.setServiceWorkerFetchReady(
1010 (info
.service_worker_fetch_ready
- kNullTicks
).InSecondsF());
1011 timing
.setServiceWorkerFetchEnd(
1012 (info
.service_worker_fetch_end
- kNullTicks
).InSecondsF());
1013 response
->setLoadTiming(timing
);
1016 if (info
.devtools_info
.get()) {
1017 WebHTTPLoadInfo load_info
;
1019 load_info
.setHTTPStatusCode(info
.devtools_info
->http_status_code
);
1020 load_info
.setHTTPStatusText(WebString::fromLatin1(
1021 info
.devtools_info
->http_status_text
));
1022 load_info
.setEncodedDataLength(info
.encoded_data_length
);
1024 load_info
.setRequestHeadersText(WebString::fromLatin1(
1025 info
.devtools_info
->request_headers_text
));
1026 load_info
.setResponseHeadersText(WebString::fromLatin1(
1027 info
.devtools_info
->response_headers_text
));
1028 const HeadersVector
& request_headers
= info
.devtools_info
->request_headers
;
1029 for (HeadersVector::const_iterator it
= request_headers
.begin();
1030 it
!= request_headers
.end(); ++it
) {
1031 load_info
.addRequestHeader(WebString::fromLatin1(it
->first
),
1032 WebString::fromLatin1(it
->second
));
1034 const HeadersVector
& response_headers
=
1035 info
.devtools_info
->response_headers
;
1036 for (HeadersVector::const_iterator it
= response_headers
.begin();
1037 it
!= response_headers
.end(); ++it
) {
1038 load_info
.addResponseHeader(WebString::fromLatin1(it
->first
),
1039 WebString::fromLatin1(it
->second
));
1041 response
->setHTTPLoadInfo(load_info
);
1044 const net::HttpResponseHeaders
* headers
= info
.headers
.get();
1048 WebURLResponse::HTTPVersion version
= WebURLResponse::Unknown
;
1049 if (headers
->GetHttpVersion() == net::HttpVersion(0, 9))
1050 version
= WebURLResponse::HTTP_0_9
;
1051 else if (headers
->GetHttpVersion() == net::HttpVersion(1, 0))
1052 version
= WebURLResponse::HTTP_1_0
;
1053 else if (headers
->GetHttpVersion() == net::HttpVersion(1, 1))
1054 version
= WebURLResponse::HTTP_1_1
;
1055 response
->setHTTPVersion(version
);
1056 response
->setHTTPStatusCode(headers
->response_code());
1057 response
->setHTTPStatusText(WebString::fromLatin1(headers
->GetStatusText()));
1059 // TODO(darin): We should leverage HttpResponseHeaders for this, and this
1060 // should be using the same code as ResourceDispatcherHost.
1061 // TODO(jungshik): Figure out the actual value of the referrer charset and
1062 // pass it to GetSuggestedFilename.
1064 headers
->EnumerateHeader(NULL
, "content-disposition", &value
);
1065 response
->setSuggestedFileName(
1066 net::GetSuggestedFilename(url
,
1068 std::string(), // referrer_charset
1069 std::string(), // suggested_name
1070 std::string(), // mime_type
1071 std::string())); // default_name
1074 if (headers
->GetLastModifiedValue(&time_val
))
1075 response
->setLastModifiedDate(time_val
.ToDoubleT());
1077 // Build up the header map.
1080 while (headers
->EnumerateHeaderLines(&iter
, &name
, &value
)) {
1081 response
->addHTTPHeaderField(WebString::fromLatin1(name
),
1082 WebString::fromLatin1(value
));
1086 void WebURLLoaderImpl::loadSynchronously(const WebURLRequest
& request
,
1087 WebURLResponse
& response
,
1090 SyncLoadResponse sync_load_response
;
1091 context_
->Start(request
, &sync_load_response
);
1093 const GURL
& final_url
= sync_load_response
.url
;
1095 // TODO(tc): For file loads, we may want to include a more descriptive
1096 // status code or status text.
1097 int error_code
= sync_load_response
.error_code
;
1098 if (error_code
!= net::OK
) {
1099 response
.setURL(final_url
);
1100 error
.domain
= WebString::fromUTF8(net::kErrorDomain
);
1101 error
.reason
= error_code
;
1102 error
.unreachableURL
= final_url
;
1106 PopulateURLResponse(final_url
, sync_load_response
, &response
);
1108 data
.assign(sync_load_response
.data
.data(),
1109 sync_load_response
.data
.size());
1112 void WebURLLoaderImpl::loadAsynchronously(const WebURLRequest
& request
,
1113 WebURLLoaderClient
* client
) {
1114 DCHECK(!context_
->client());
1116 context_
->set_client(client
);
1117 context_
->Start(request
, NULL
);
1120 void WebURLLoaderImpl::cancel() {
1124 void WebURLLoaderImpl::setDefersLoading(bool value
) {
1125 context_
->SetDefersLoading(value
);
1128 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority
,
1129 int intra_priority_value
) {
1130 context_
->DidChangePriority(new_priority
, intra_priority_value
);
1133 bool WebURLLoaderImpl::attachThreadedDataReceiver(
1134 blink::WebThreadedDataReceiver
* threaded_data_receiver
) {
1135 return context_
->AttachThreadedDataReceiver(threaded_data_receiver
);
1138 } // namespace content