OLD | NEW |
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 #ifndef WorkerFetchContext_h | 5 #ifndef WorkerFetchContext_h |
6 #define WorkerFetchContext_h | 6 #define WorkerFetchContext_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/loader/BaseFetchContext.h" | 10 #include "core/loader/BaseFetchContext.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 bool ShouldBypassMainWorldCSP() const override; | 48 bool ShouldBypassMainWorldCSP() const override; |
49 bool IsSVGImageChromeClient() const override; | 49 bool IsSVGImageChromeClient() const override; |
50 void CountUsage(UseCounter::Feature) const override; | 50 void CountUsage(UseCounter::Feature) const override; |
51 void CountDeprecation(UseCounter::Feature) const override; | 51 void CountDeprecation(UseCounter::Feature) const override; |
52 bool ShouldBlockFetchByMixedContentCheck( | 52 bool ShouldBlockFetchByMixedContentCheck( |
53 const ResourceRequest&, | 53 const ResourceRequest&, |
54 const KURL&, | 54 const KURL&, |
55 SecurityViolationReportingPolicy) const override; | 55 SecurityViolationReportingPolicy) const override; |
56 | 56 |
57 // FetchContext implementation: | 57 // FetchContext implementation: |
58 // TODO(horo): Implement more methods. | |
59 std::unique_ptr<WebURLLoader> CreateURLLoader() override; | 58 std::unique_ptr<WebURLLoader> CreateURLLoader() override; |
60 void PrepareRequest(ResourceRequest&, RedirectType) override; | 59 void PrepareRequest(ResourceRequest&, RedirectType) override; |
61 bool IsControlledByServiceWorker() const override; | 60 bool IsControlledByServiceWorker() const override; |
62 RefPtr<WebTaskRunner> LoadingTaskRunner() const override; | 61 RefPtr<WebTaskRunner> LoadingTaskRunner() const override; |
63 | |
64 void AddAdditionalRequestHeaders(ResourceRequest&, | 62 void AddAdditionalRequestHeaders(ResourceRequest&, |
65 FetchResourceType) override; | 63 FetchResourceType) override; |
| 64 void DispatchWillSendRequest(unsigned long, |
| 65 ResourceRequest&, |
| 66 const ResourceResponse&, |
| 67 const FetchInitiatorInfo&) override; |
66 void DispatchDidReceiveResponse(unsigned long identifier, | 68 void DispatchDidReceiveResponse(unsigned long identifier, |
67 const ResourceResponse&, | 69 const ResourceResponse&, |
68 WebURLRequest::FrameType, | 70 WebURLRequest::FrameType, |
69 WebURLRequest::RequestContext, | 71 WebURLRequest::RequestContext, |
70 Resource*, | 72 Resource*, |
71 ResourceResponseType) override; | 73 ResourceResponseType) override; |
| 74 void DispatchDidReceiveData(unsigned long identifier, |
| 75 const char* data, |
| 76 int dataLength) override; |
| 77 void DispatchDidReceiveEncodedData(unsigned long identifier, |
| 78 int encodedDataLength) override; |
| 79 void DispatchDidFinishLoading(unsigned long identifier, |
| 80 double finishTime, |
| 81 int64_t encodedDataLength, |
| 82 int64_t decodedBodyLength) override; |
| 83 void DispatchDidFail(unsigned long identifier, |
| 84 const ResourceError&, |
| 85 int64_t encodedDataLength, |
| 86 bool isInternalRequest) override; |
72 void AddResourceTiming(const ResourceTimingInfo&) override; | 87 void AddResourceTiming(const ResourceTimingInfo&) override; |
73 void PopulateResourceRequest(const KURL&, | 88 void PopulateResourceRequest(const KURL&, |
74 Resource::Type, | 89 Resource::Type, |
75 const ClientHintsPreferences&, | 90 const ClientHintsPreferences&, |
76 const FetchParameters::ResourceWidth&, | 91 const FetchParameters::ResourceWidth&, |
77 const ResourceLoaderOptions&, | 92 const ResourceLoaderOptions&, |
78 SecurityViolationReportingPolicy, | 93 SecurityViolationReportingPolicy, |
79 ResourceRequest&) override; | 94 ResourceRequest&) override; |
80 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; | 95 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; |
81 | 96 |
82 DECLARE_VIRTUAL_TRACE(); | 97 DECLARE_VIRTUAL_TRACE(); |
83 | 98 |
84 private: | 99 private: |
85 WorkerFetchContext(WorkerGlobalScope&, | 100 WorkerFetchContext(WorkerGlobalScope&, |
86 std::unique_ptr<WebWorkerFetchContext>); | 101 std::unique_ptr<WebWorkerFetchContext>); |
87 | 102 |
88 Member<WorkerGlobalScope> worker_global_scope_; | 103 Member<WorkerGlobalScope> worker_global_scope_; |
89 std::unique_ptr<WebWorkerFetchContext> web_context_; | 104 std::unique_ptr<WebWorkerFetchContext> web_context_; |
90 Member<ResourceFetcher> resource_fetcher_; | 105 Member<ResourceFetcher> resource_fetcher_; |
91 RefPtr<WebTaskRunner> loading_task_runner_; | 106 RefPtr<WebTaskRunner> loading_task_runner_; |
92 }; | 107 }; |
93 | 108 |
94 } // namespace blink | 109 } // namespace blink |
95 | 110 |
96 #endif // WorkerFetchContext_h | 111 #endif // WorkerFetchContext_h |
OLD | NEW |