| 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_WORKER_FETCH_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ |
| 6 #define CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ |
| 7 | 7 |
| 8 #include "content/common/service_worker/service_worker_types.h" | 8 #include "content/common/service_worker/service_worker_types.h" |
| 9 #include "content/common/worker_url_loader_factory_provider.mojom.h" | 9 #include "content/common/worker_url_loader_factory_provider.mojom.h" |
| 10 #include "ipc/ipc_message.h" | |
| 11 #include "mojo/public/cpp/bindings/associated_binding.h" | 10 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 12 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" | 11 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" |
| 13 | 12 |
| 14 namespace base { | 13 namespace base { |
| 15 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
| 16 } // namespace base | 15 } // namespace base |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 | 18 |
| 20 class ResourceDispatcher; | 19 class ResourceDispatcher; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 bool IsControlledByServiceWorker() const override; | 32 bool IsControlledByServiceWorker() const override; |
| 34 void SetDataSaverEnabled(bool) override; | 33 void SetDataSaverEnabled(bool) override; |
| 35 bool IsDataSaverEnabled() const override; | 34 bool IsDataSaverEnabled() const override; |
| 36 | 35 |
| 37 // mojom::ServiceWorkerWorkerClient implementation: | 36 // mojom::ServiceWorkerWorkerClient implementation: |
| 38 void SetControllerServiceWorker(int64_t controller_version_id) override; | 37 void SetControllerServiceWorker(int64_t controller_version_id) override; |
| 39 | 38 |
| 40 // Sets the service worker status of the parent frame. | 39 // Sets the service worker status of the parent frame. |
| 41 void set_service_worker_provider_id(int id); | 40 void set_service_worker_provider_id(int id); |
| 42 void set_is_controlled_by_service_worker(bool flag); | 41 void set_is_controlled_by_service_worker(bool flag); |
| 43 void set_parent_frame_id(int id); | |
| 44 | 42 |
| 45 private: | 43 private: |
| 46 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_; | 44 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_; |
| 47 int service_worker_provider_id_ = kInvalidServiceWorkerProviderId; | 45 int service_worker_provider_id_ = kInvalidServiceWorkerProviderId; |
| 48 bool is_controlled_by_service_worker_ = false; | 46 bool is_controlled_by_service_worker_ = false; |
| 49 | 47 |
| 50 // Initialized on the worker thread when InitializeOnWorkerThread() is called. | 48 // Initialized on the worker thread when InitializeOnWorkerThread() is called. |
| 51 std::unique_ptr<ResourceDispatcher> resource_dispatcher_; | 49 std::unique_ptr<ResourceDispatcher> resource_dispatcher_; |
| 52 std::unique_ptr<mojo::AssociatedBinding<mojom::ServiceWorkerWorkerClient>> | 50 std::unique_ptr<mojo::AssociatedBinding<mojom::ServiceWorkerWorkerClient>> |
| 53 binding_; | 51 binding_; |
| 54 mojom::WorkerURLLoaderFactoryProviderPtr provider_; | 52 mojom::WorkerURLLoaderFactoryProviderPtr provider_; |
| 55 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_; | 53 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_; |
| 56 | 54 |
| 57 // Updated when mojom::ServiceWorkerWorkerClient::SetControllerServiceWorker() | 55 // Updated when mojom::ServiceWorkerWorkerClient::SetControllerServiceWorker() |
| 58 // is called from the browser process via mojo IPC. | 56 // is called from the browser process via mojo IPC. |
| 59 int controller_version_id_ = kInvalidServiceWorkerVersionId; | 57 int controller_version_id_ = kInvalidServiceWorkerVersionId; |
| 60 | 58 |
| 61 bool is_data_saver_enabled_ = false; | 59 bool is_data_saver_enabled_ = false; |
| 62 int parent_frame_id_ = MSG_ROUTING_NONE; | |
| 63 }; | 60 }; |
| 64 | 61 |
| 65 } // namespace content | 62 } // namespace content |
| 66 | 63 |
| 67 #endif // CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ | 64 #endif // CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ |
| OLD | NEW |