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 #ifndef CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_
6 #define CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h"
11 #include "content/public/common/resource_response.h"
12 #include "net/url_request/redirect_info.h"
13 #include "third_party/WebKit/public/platform/WebURLLoader.h"
18 class SingleThreadTaskRunner
;
24 class ResourceDispatcher
;
25 struct ResourceResponseInfo
;
27 // PlzNavigate: Used to override parameters of the navigation request.
28 struct StreamOverrideParameters
{
30 // TODO(clamy): The browser should be made aware on destruction of this struct
31 // that it can release its associated stream handle.
33 ResourceResponseHead response
;
36 class CONTENT_EXPORT WebURLLoaderImpl
37 : public NON_EXPORTED_BASE(blink::WebURLLoader
) {
39 explicit WebURLLoaderImpl(
40 ResourceDispatcher
* resource_dispatcher
,
41 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
);
42 ~WebURLLoaderImpl() override
;
44 static void PopulateURLResponse(const GURL
& url
,
45 const ResourceResponseInfo
& info
,
46 blink::WebURLResponse
* response
,
47 bool report_security_info
);
48 static void PopulateURLRequestForRedirect(
49 const blink::WebURLRequest
& request
,
50 const net::RedirectInfo
& redirect_info
,
51 blink::WebReferrerPolicy referrer_policy
,
52 bool skip_service_worker
,
53 blink::WebURLRequest
* new_request
);
55 // WebURLLoader methods:
56 void loadSynchronously(
57 const blink::WebURLRequest
& request
,
58 blink::WebURLResponse
& response
,
59 blink::WebURLError
& error
,
60 blink::WebData
& data
) override
;
61 void loadAsynchronously(
62 const blink::WebURLRequest
& request
,
63 blink::WebURLLoaderClient
* client
) override
;
64 void cancel() override
;
65 void setDefersLoading(bool value
) override
;
66 void didChangePriority(blink::WebURLRequest::Priority new_priority
,
67 int intra_priority_value
) override
;
68 bool attachThreadedDataReceiver(
69 blink::WebThreadedDataReceiver
* threaded_data_receiver
) override
;
73 scoped_refptr
<Context
> context_
;
75 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl
);
78 } // namespace content
80 #endif // CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_