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 | 62 int64_t ServiceWorkerID() const override; |
64 void AddAdditionalRequestHeaders(ResourceRequest&, | 63 void AddAdditionalRequestHeaders(ResourceRequest&, |
65 FetchResourceType) override; | 64 FetchResourceType) override; |
| 65 void DispatchWillSendRequest(unsigned long, |
| 66 ResourceRequest&, |
| 67 const ResourceResponse&, |
| 68 const FetchInitiatorInfo&) override; |
66 void DispatchDidReceiveResponse(unsigned long identifier, | 69 void DispatchDidReceiveResponse(unsigned long identifier, |
67 const ResourceResponse&, | 70 const ResourceResponse&, |
68 WebURLRequest::FrameType, | 71 WebURLRequest::FrameType, |
69 WebURLRequest::RequestContext, | 72 WebURLRequest::RequestContext, |
70 Resource*, | 73 Resource*, |
71 ResourceResponseType) override; | 74 ResourceResponseType) override; |
| 75 void DispatchDidReceiveData(unsigned long identifier, |
| 76 const char* data, |
| 77 int dataLength) override; |
| 78 void DispatchDidReceiveEncodedData(unsigned long identifier, |
| 79 int encodedDataLength) override; |
| 80 void DispatchDidFinishLoading(unsigned long identifier, |
| 81 double finishTime, |
| 82 int64_t encodedDataLength, |
| 83 int64_t decodedBodyLength) override; |
| 84 void DispatchDidFail(unsigned long identifier, |
| 85 const ResourceError&, |
| 86 int64_t encodedDataLength, |
| 87 bool isInternalRequest) override; |
72 void AddResourceTiming(const ResourceTimingInfo&) override; | 88 void AddResourceTiming(const ResourceTimingInfo&) override; |
73 void PopulateResourceRequest(const KURL&, | 89 void PopulateResourceRequest(const KURL&, |
74 Resource::Type, | 90 Resource::Type, |
75 const ClientHintsPreferences&, | 91 const ClientHintsPreferences&, |
76 const FetchParameters::ResourceWidth&, | 92 const FetchParameters::ResourceWidth&, |
77 const ResourceLoaderOptions&, | 93 const ResourceLoaderOptions&, |
78 SecurityViolationReportingPolicy, | 94 SecurityViolationReportingPolicy, |
79 ResourceRequest&) override; | 95 ResourceRequest&) override; |
80 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; | 96 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; |
81 | 97 |
82 DECLARE_VIRTUAL_TRACE(); | 98 DECLARE_VIRTUAL_TRACE(); |
83 | 99 |
84 private: | 100 private: |
85 WorkerFetchContext(WorkerGlobalScope&, | 101 WorkerFetchContext(WorkerGlobalScope&, |
86 std::unique_ptr<WebWorkerFetchContext>); | 102 std::unique_ptr<WebWorkerFetchContext>); |
87 | 103 |
88 Member<WorkerGlobalScope> worker_global_scope_; | 104 Member<WorkerGlobalScope> worker_global_scope_; |
89 std::unique_ptr<WebWorkerFetchContext> web_context_; | 105 std::unique_ptr<WebWorkerFetchContext> web_context_; |
90 Member<ResourceFetcher> resource_fetcher_; | 106 Member<ResourceFetcher> resource_fetcher_; |
91 RefPtr<WebTaskRunner> loading_task_runner_; | 107 RefPtr<WebTaskRunner> loading_task_runner_; |
92 }; | 108 }; |
93 | 109 |
94 } // namespace blink | 110 } // namespace blink |
95 | 111 |
96 #endif // WorkerFetchContext_h | 112 #endif // WorkerFetchContext_h |
OLD | NEW |