Revert of Move Extension ScriptContext creation into ScriptContextSet. (patchset...
[chromium-blink-merge.git] / content / child / web_url_loader_impl.h
blob33c8ec7a75b6dce2cd89b1d093b41c50e6c815af
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 "third_party/WebKit/public/platform/WebURLLoader.h"
13 #include "url/gurl.h"
15 namespace base {
17 class SingleThreadTaskRunner;
19 } // namespace base
21 namespace content {
23 class ResourceDispatcher;
24 struct ResourceResponseInfo;
26 // PlzNavigate: Used to override parameters of the navigation request.
27 struct StreamOverrideParameters {
28 public:
29 // TODO(clamy): The browser should be made aware on destruction of this struct
30 // that it can release its associated stream handle.
31 GURL stream_url;
32 ResourceResponseHead response;
35 class CONTENT_EXPORT WebURLLoaderImpl
36 : public NON_EXPORTED_BASE(blink::WebURLLoader) {
37 public:
38 explicit WebURLLoaderImpl(
39 ResourceDispatcher* resource_dispatcher,
40 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
41 virtual ~WebURLLoaderImpl();
43 static blink::WebURLError CreateError(const blink::WebURL& unreachable_url,
44 bool stale_copy_in_cache,
45 int reason);
46 static void PopulateURLResponse(
47 const GURL& url,
48 const ResourceResponseInfo& info,
49 blink::WebURLResponse* response);
51 // WebURLLoader methods:
52 virtual void loadSynchronously(
53 const blink::WebURLRequest& request,
54 blink::WebURLResponse& response,
55 blink::WebURLError& error,
56 blink::WebData& data) override;
57 virtual void loadAsynchronously(
58 const blink::WebURLRequest& request,
59 blink::WebURLLoaderClient* client) override;
60 virtual void cancel() override;
61 virtual void setDefersLoading(bool value) override;
62 virtual void didChangePriority(blink::WebURLRequest::Priority new_priority,
63 int intra_priority_value) override;
64 virtual bool attachThreadedDataReceiver(
65 blink::WebThreadedDataReceiver* threaded_data_receiver) override;
67 private:
68 class Context;
69 scoped_refptr<Context> context_;
71 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderImpl);
74 } // namespace content
76 #endif // CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_