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 15 matching lines...) Expand all Loading... | |
26 // The WorkerFetchContext is a FetchContext for workers (dedicated, shared and | 26 // The WorkerFetchContext is a FetchContext for workers (dedicated, shared and |
27 // service workers). This class is used only when off-main-thread-fetch is | 27 // service workers). This class is used only when off-main-thread-fetch is |
28 // enabled, and is still under development. | 28 // enabled, and is still under development. |
29 // TODO(horo): Implement all methods of FetchContext. crbug.com/443374 | 29 // TODO(horo): Implement all methods of FetchContext. crbug.com/443374 |
30 class WorkerFetchContext final : public BaseFetchContext { | 30 class WorkerFetchContext final : public BaseFetchContext { |
31 public: | 31 public: |
32 static WorkerFetchContext* Create(WorkerGlobalScope&); | 32 static WorkerFetchContext* Create(WorkerGlobalScope&); |
33 virtual ~WorkerFetchContext(); | 33 virtual ~WorkerFetchContext(); |
34 | 34 |
35 ResourceFetcher* GetResourceFetcher(); | 35 ResourceFetcher* GetResourceFetcher(); |
36 KURL FirstPartyForCookies() const; | |
36 | 37 |
37 // BaseFetchContext implementation: | 38 // BaseFetchContext implementation: |
38 ContentSettingsClient* GetContentSettingsClient() const override; | 39 ContentSettingsClient* GetContentSettingsClient() const override; |
39 Settings* GetSettings() const override; | 40 Settings* GetSettings() const override; |
40 SubresourceFilter* GetSubresourceFilter() const override; | 41 SubresourceFilter* GetSubresourceFilter() const override; |
41 SecurityContext* GetParentSecurityContext() const override; | 42 SecurityContext* GetParentSecurityContext() const override; |
42 bool ShouldBlockRequestByInspector(const ResourceRequest&) const override; | 43 bool ShouldBlockRequestByInspector(const ResourceRequest&) const override; |
43 void DispatchDidBlockRequest(const ResourceRequest&, | 44 void DispatchDidBlockRequest(const ResourceRequest&, |
44 const FetchInitiatorInfo&, | 45 const FetchInitiatorInfo&, |
45 ResourceRequestBlockedReason) const override; | 46 ResourceRequestBlockedReason) const override; |
46 void ReportLocalLoadFailed(const KURL&) const override; | 47 void ReportLocalLoadFailed(const KURL&) const override; |
47 bool ShouldBypassMainWorldCSP() const override; | 48 bool ShouldBypassMainWorldCSP() const override; |
48 bool IsSVGImageChromeClient() const override; | 49 bool IsSVGImageChromeClient() const override; |
49 void CountUsage(UseCounter::Feature) const override; | 50 void CountUsage(UseCounter::Feature) const override; |
50 void CountDeprecation(UseCounter::Feature) const override; | 51 void CountDeprecation(UseCounter::Feature) const override; |
51 bool ShouldBlockFetchByMixedContentCheck( | 52 bool ShouldBlockFetchByMixedContentCheck( |
52 const ResourceRequest&, | 53 const ResourceRequest&, |
53 const KURL&, | 54 const KURL&, |
54 SecurityViolationReportingPolicy) const override; | 55 SecurityViolationReportingPolicy) const override; |
55 | 56 |
56 // FetchContext implementation: | 57 // FetchContext implementation: |
57 // TODO(horo): Implement more methods. | 58 // TODO(horo): Implement more methods. |
58 std::unique_ptr<WebURLLoader> CreateURLLoader() override; | 59 std::unique_ptr<WebURLLoader> CreateURLLoader() override; |
59 void PrepareRequest(ResourceRequest&, RedirectType) override; | 60 void PrepareRequest(ResourceRequest&, RedirectType) override; |
60 bool IsControlledByServiceWorker() const override; | 61 bool IsControlledByServiceWorker() const override; |
61 RefPtr<WebTaskRunner> LoadingTaskRunner() const override; | 62 RefPtr<WebTaskRunner> LoadingTaskRunner() const override; |
62 | 63 |
63 void AddAdditionalRequestHeaders(ResourceRequest&, | 64 void AddAdditionalRequestHeaders(ResourceRequest&, |
64 FetchResourceType) override; | 65 FetchResourceType) override; |
66 void PopulateResourceRequest(const KURL&, | |
67 Resource::Type, | |
68 const ClientHintsPreferences&, | |
69 const FetchParameters::ResourceWidth&, | |
70 const ResourceLoaderOptions&, | |
71 SecurityViolationReportingPolicy, | |
72 ResourceRequest&) override; | |
falken
2017/05/17 08:55:31
I think out params as references violate modern (n
falken
2017/05/17 09:00:05
Ah, nevermind this is overridding existing code.
| |
73 void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override; | |
65 | 74 |
66 DECLARE_VIRTUAL_TRACE(); | 75 DECLARE_VIRTUAL_TRACE(); |
67 | 76 |
68 private: | 77 private: |
69 WorkerFetchContext(WorkerGlobalScope&, | 78 WorkerFetchContext(WorkerGlobalScope&, |
70 std::unique_ptr<WebWorkerFetchContext>); | 79 std::unique_ptr<WebWorkerFetchContext>); |
71 | 80 |
72 Member<WorkerGlobalScope> worker_global_scope_; | 81 Member<WorkerGlobalScope> worker_global_scope_; |
73 std::unique_ptr<WebWorkerFetchContext> web_context_; | 82 std::unique_ptr<WebWorkerFetchContext> web_context_; |
74 Member<ResourceFetcher> resource_fetcher_; | 83 Member<ResourceFetcher> resource_fetcher_; |
75 RefPtr<WebTaskRunner> loading_task_runner_; | 84 RefPtr<WebTaskRunner> loading_task_runner_; |
76 }; | 85 }; |
77 | 86 |
78 } // namespace blink | 87 } // namespace blink |
79 | 88 |
80 #endif // WorkerFetchContext_h | 89 #endif // WorkerFetchContext_h |
OLD | NEW |