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 CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ |
7 | 7 |
8 #include "content/common/worker_url_loader_factory_provider.mojom.h" | 8 #include "content/common/worker_url_loader_factory_provider.mojom.h" |
9 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" | 9 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class SingleThreadTaskRunner; | 12 class SingleThreadTaskRunner; |
13 } // namespace base | 13 } // namespace base |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class ResourceDispatcher; | 16 class ResourceDispatcher; |
17 | 17 |
18 class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext { | 18 class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext { |
19 public: | 19 public: |
20 ServiceWorkerFetchContextImpl( | 20 ServiceWorkerFetchContextImpl( |
21 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info, | 21 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info, |
22 int service_worker_provider_id); | 22 int service_worker_provider_id); |
23 ~ServiceWorkerFetchContextImpl() override; | 23 ~ServiceWorkerFetchContextImpl() override; |
24 | 24 |
25 // blink::WebWorkerFetchContext implementation: | 25 // blink::WebWorkerFetchContext implementation: |
26 void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override; | 26 void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override; |
27 std::unique_ptr<blink::WebURLLoader> CreateURLLoader() override; | 27 std::unique_ptr<blink::WebURLLoader> CreateURLLoader() override; |
28 void WillSendRequest(blink::WebURLRequest&) override; | 28 void WillSendRequest(blink::WebURLRequest&) override; |
29 bool IsControlledByServiceWorker() const override; | 29 bool IsControlledByServiceWorker() const override; |
| 30 void SetDataSaverEnabled(bool flag) override; |
30 | 31 |
31 private: | 32 private: |
32 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_; | 33 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_; |
33 const int service_worker_provider_id_; | 34 const int service_worker_provider_id_; |
| 35 bool data_saver_enabled_ = false; |
34 | 36 |
35 // Initialized on the worker thread when InitializeOnWorkerThread() is called. | 37 // Initialized on the worker thread when InitializeOnWorkerThread() is called. |
36 std::unique_ptr<ResourceDispatcher> resource_dispatcher_; | 38 std::unique_ptr<ResourceDispatcher> resource_dispatcher_; |
37 mojom::WorkerURLLoaderFactoryProviderPtr provider_; | 39 mojom::WorkerURLLoaderFactoryProviderPtr provider_; |
38 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_; | 40 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_; |
39 }; | 41 }; |
40 | 42 |
41 } // namespace content | 43 } // namespace content |
42 | 44 |
43 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ | 45 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ |
OLD | NEW |