| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const KURL&) const override; | 57 const KURL&) const override; |
| 58 ReferrerPolicy GetReferrerPolicy() const override; | 58 ReferrerPolicy GetReferrerPolicy() const override; |
| 59 String GetOutgoingReferrer() const override; | 59 String GetOutgoingReferrer() const override; |
| 60 const KURL& Url() const override; | 60 const KURL& Url() const override; |
| 61 const SecurityOrigin* GetParentSecurityOrigin() const override; | 61 const SecurityOrigin* GetParentSecurityOrigin() const override; |
| 62 Optional<WebAddressSpace> GetAddressSpace() const override; | 62 Optional<WebAddressSpace> GetAddressSpace() const override; |
| 63 const ContentSecurityPolicy* GetContentSecurityPolicy() const override; | 63 const ContentSecurityPolicy* GetContentSecurityPolicy() const override; |
| 64 void AddConsoleMessage(ConsoleMessage*) const override; | 64 void AddConsoleMessage(ConsoleMessage*) const override; |
| 65 | 65 |
| 66 // FetchContext implementation: | 66 // FetchContext implementation: |
| 67 // TODO(horo): Implement more methods. | |
| 68 SecurityOrigin* GetSecurityOrigin() const override; | 67 SecurityOrigin* GetSecurityOrigin() const override; |
| 69 std::unique_ptr<WebURLLoader> CreateURLLoader( | 68 std::unique_ptr<WebURLLoader> CreateURLLoader( |
| 70 const ResourceRequest&) override; | 69 const ResourceRequest&) override; |
| 71 void PrepareRequest(ResourceRequest&, RedirectType) override; | 70 void PrepareRequest(ResourceRequest&, RedirectType) override; |
| 72 bool IsControlledByServiceWorker() const override; | 71 bool IsControlledByServiceWorker() const override; |
| 73 | |
| 74 void AddAdditionalRequestHeaders(ResourceRequest&, | 72 void AddAdditionalRequestHeaders(ResourceRequest&, |
| 75 FetchResourceType) override; | 73 FetchResourceType) override; |
| 74 void DispatchWillSendRequest(unsigned long, |
| 75 ResourceRequest&, |
| 76 const ResourceResponse&, |
| 77 const FetchInitiatorInfo&) override; |
| 76 void DispatchDidReceiveResponse(unsigned long identifier, | 78 void DispatchDidReceiveResponse(unsigned long identifier, |
| 77 const ResourceResponse&, | 79 const ResourceResponse&, |
| 78 WebURLRequest::FrameType, | 80 WebURLRequest::FrameType, |
| 79 WebURLRequest::RequestContext, | 81 WebURLRequest::RequestContext, |
| 80 Resource*, | 82 Resource*, |
| 81 ResourceResponseType) override; | 83 ResourceResponseType) override; |
| 84 void DispatchDidReceiveData(unsigned long identifier, |
| 85 const char* data, |
| 86 int dataLength) override; |
| 87 void DispatchDidReceiveEncodedData(unsigned long identifier, |
| 88 int encodedDataLength) override; |
| 89 void DispatchDidFinishLoading(unsigned long identifier, |
| 90 double finishTime, |
| 91 int64_t encodedDataLength, |
| 92 int64_t decodedBodyLength) override; |
| 93 void DispatchDidFail(unsigned long identifier, |
| 94 const ResourceError&, |
| 95 int64_t encodedDataLength, |
| 96 bool isInternalRequest) override; |
| 82 void AddResourceTiming(const ResourceTimingInfo&) override; | 97 void AddResourceTiming(const ResourceTimingInfo&) override; |
| 83 void PopulateResourceRequest(const KURL&, | 98 void PopulateResourceRequest(const KURL&, |
| 84 Resource::Type, | 99 Resource::Type, |
| 85 const ClientHintsPreferences&, | 100 const ClientHintsPreferences&, |
| 86 const FetchParameters::ResourceWidth&, | 101 const FetchParameters::ResourceWidth&, |
| 87 const ResourceLoaderOptions&, | 102 const ResourceLoaderOptions&, |
| 88 SecurityViolationReportingPolicy, | 103 SecurityViolationReportingPolicy, |
| 89 ResourceRequest&) override; | 104 ResourceRequest&) override; |
| 90 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; | 105 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; |
| 91 | 106 |
| 92 DECLARE_VIRTUAL_TRACE(); | 107 DECLARE_VIRTUAL_TRACE(); |
| 93 | 108 |
| 94 private: | 109 private: |
| 95 WorkerFetchContext(WorkerOrWorkletGlobalScope&, | 110 WorkerFetchContext(WorkerOrWorkletGlobalScope&, |
| 96 std::unique_ptr<WebWorkerFetchContext>); | 111 std::unique_ptr<WebWorkerFetchContext>); |
| 97 | 112 |
| 98 Member<WorkerOrWorkletGlobalScope> global_scope_; | 113 Member<WorkerOrWorkletGlobalScope> global_scope_; |
| 99 std::unique_ptr<WebWorkerFetchContext> web_context_; | 114 std::unique_ptr<WebWorkerFetchContext> web_context_; |
| 100 Member<ResourceFetcher> resource_fetcher_; | 115 Member<ResourceFetcher> resource_fetcher_; |
| 101 RefPtr<WebTaskRunner> loading_task_runner_; | 116 RefPtr<WebTaskRunner> loading_task_runner_; |
| 102 }; | 117 }; |
| 103 | 118 |
| 104 } // namespace blink | 119 } // namespace blink |
| 105 | 120 |
| 106 #endif // WorkerFetchContext_h | 121 #endif // WorkerFetchContext_h |
| OLD | NEW |