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 ServiceWorkerContainerClient_h | 5 #ifndef ServiceWorkerContainerClient_h |
6 #define ServiceWorkerContainerClient_h | 6 #define ServiceWorkerContainerClient_h |
7 | 7 |
8 #include "core/page/Page.h" | 8 #include "core/dom/DocumentSupplementable.h" |
9 #include "core/workers/WorkerClients.h" | 9 #include "core/workers/WorkerClients.h" |
10 #include "wtf/Forward.h" | 10 #include "wtf/Forward.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 class WebServiceWorkerProvider; | 13 class WebServiceWorkerProvider; |
14 } | 14 } |
15 | 15 |
16 namespace WebCore { | 16 namespace WebCore { |
17 | 17 |
18 class ExecutionContext; | 18 class ExecutionContext; |
19 | 19 |
20 // This mainly exists to provide access to WebServiceWorkerProvider. | 20 // This mainly exists to provide access to WebServiceWorkerProvider. |
21 // Owned by Page (or WorkerClients). | 21 // Owned by Document (or WorkerClients). |
22 class ServiceWorkerContainerClient FINAL : | 22 class ServiceWorkerContainerClient FINAL : |
23 public Supplement<Page>, | 23 public DocumentSupplement, |
24 public Supplement<WorkerClients> { | 24 public Supplement<WorkerClients> { |
25 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); | 25 WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); |
26 public: | 26 public: |
27 static PassOwnPtr<ServiceWorkerContainerClient> create(PassOwnPtr<blink::Web
ServiceWorkerProvider>); | 27 static PassOwnPtr<ServiceWorkerContainerClient> create(PassOwnPtr<blink::Web
ServiceWorkerProvider>); |
28 virtual ~ServiceWorkerContainerClient(); | 28 virtual ~ServiceWorkerContainerClient(); |
29 | 29 |
30 blink::WebServiceWorkerProvider* provider() { return m_provider.get(); } | 30 blink::WebServiceWorkerProvider* provider() { return m_provider.get(); } |
31 | 31 |
32 static const char* supplementName(); | 32 static const char* supplementName(); |
33 static ServiceWorkerContainerClient* from(ExecutionContext*); | 33 static ServiceWorkerContainerClient* from(ExecutionContext*); |
34 | 34 |
35 protected: | 35 protected: |
36 explicit ServiceWorkerContainerClient(PassOwnPtr<blink::WebServiceWorkerProv
ider>); | 36 explicit ServiceWorkerContainerClient(PassOwnPtr<blink::WebServiceWorkerProv
ider>); |
37 | 37 |
38 OwnPtr<blink::WebServiceWorkerProvider> m_provider; | 38 OwnPtr<blink::WebServiceWorkerProvider> m_provider; |
39 }; | 39 }; |
40 | 40 |
41 void provideServiceWorkerContainerClientToWorker(WorkerClients*, PassOwnPtr<blin
k::WebServiceWorkerProvider>); | 41 void provideServiceWorkerContainerClientToWorker(WorkerClients*, PassOwnPtr<blin
k::WebServiceWorkerProvider>); |
42 | 42 |
43 } // namespace WebCore | 43 } // namespace WebCore |
44 | 44 |
45 #endif // ServiceWorkerContainerClient_h | 45 #endif // ServiceWorkerContainerClient_h |
OLD | NEW |