OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ |
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/common/service_worker/service_worker.mojom.h" | 17 #include "content/common/service_worker/service_worker.mojom.h" |
| 18 #include "content/common/service_worker/service_worker_provider.mojom.h" |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 class WebLocalFrame; | 21 class WebLocalFrame; |
21 class WebServiceWorkerNetworkProvider; | 22 class WebServiceWorkerNetworkProvider; |
22 } // namespace blink | 23 } // namespace blink |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 struct RequestNavigationParams; | 27 struct RequestNavigationParams; |
27 class ServiceWorkerProviderContext; | 28 class ServiceWorkerProviderContext; |
(...skipping 22 matching lines...) Expand all Loading... |
50 // CreateForNavigation. | 51 // CreateForNavigation. |
51 static ServiceWorkerNetworkProvider* FromWebServiceWorkerNetworkProvider( | 52 static ServiceWorkerNetworkProvider* FromWebServiceWorkerNetworkProvider( |
52 blink::WebServiceWorkerNetworkProvider*); | 53 blink::WebServiceWorkerNetworkProvider*); |
53 | 54 |
54 // PlzNavigate | 55 // PlzNavigate |
55 // The |browser_provider_id| is initialized by the browser for navigations. | 56 // The |browser_provider_id| is initialized by the browser for navigations. |
56 ServiceWorkerNetworkProvider(int route_id, | 57 ServiceWorkerNetworkProvider(int route_id, |
57 ServiceWorkerProviderType type, | 58 ServiceWorkerProviderType type, |
58 int browser_provider_id, | 59 int browser_provider_id, |
59 bool is_parent_frame_secure); | 60 bool is_parent_frame_secure); |
| 61 // This is for service worker clients. |
60 ServiceWorkerNetworkProvider(int route_id, | 62 ServiceWorkerNetworkProvider(int route_id, |
61 ServiceWorkerProviderType type, | 63 ServiceWorkerProviderType type, |
62 bool is_parent_frame_secure); | 64 bool is_parent_frame_secure); |
| 65 // This is for controllers. |
| 66 explicit ServiceWorkerNetworkProvider( |
| 67 mojom::ServiceWorkerProviderInfoForStartWorkerPtr info); |
63 | 68 |
64 ServiceWorkerNetworkProvider(); | 69 ServiceWorkerNetworkProvider(); |
65 ~ServiceWorkerNetworkProvider(); | 70 ~ServiceWorkerNetworkProvider(); |
66 | 71 |
67 int provider_id() const { return provider_id_; } | 72 int provider_id() const { return provider_id_; } |
68 ServiceWorkerProviderContext* context() const { return context_.get(); } | 73 ServiceWorkerProviderContext* context() const { return context_.get(); } |
69 | 74 |
70 // This method is called for a provider that's associated with a | |
71 // running service worker script. The version_id indicates which | |
72 // ServiceWorkerVersion should be used. | |
73 void SetServiceWorkerVersionId(int64_t version_id, int embedded_worker_id); | |
74 | |
75 bool IsControlledByServiceWorker() const; | 75 bool IsControlledByServiceWorker() const; |
76 | 76 |
77 private: | 77 private: |
78 const int provider_id_; | 78 const int provider_id_; |
79 scoped_refptr<ServiceWorkerProviderContext> context_; | 79 scoped_refptr<ServiceWorkerProviderContext> context_; |
80 mojom::ServiceWorkerDispatcherHostAssociatedPtr dispatcher_host_; | 80 mojom::ServiceWorkerDispatcherHostAssociatedPtr dispatcher_host_; |
81 mojom::ServiceWorkerProviderHostAssociatedPtr provider_host_; | 81 mojom::ServiceWorkerProviderHostAssociatedPtr provider_host_; |
82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider); | 82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace content | 85 } // namespace content |
86 | 86 |
87 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ | 87 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ |
OLD | NEW |