OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ServiceWorkerContainer_h | 31 #ifndef ServiceWorkerContainer_h |
32 #define ServiceWorkerContainer_h | 32 #define ServiceWorkerContainer_h |
33 | 33 |
34 #include "bindings/v8/ScriptPromise.h" | 34 #include "bindings/v8/ScriptPromise.h" |
35 #include "bindings/v8/ScriptWrappable.h" | 35 #include "bindings/v8/ScriptWrappable.h" |
36 #include "core/dom/ContextLifecycleObserver.h" | 36 #include "core/dom/ContextLifecycleObserver.h" |
37 #include "core/frame/DOMWindowLifecycleObserver.h" | |
38 #include "public/platform/WebServiceWorkerProviderClient.h" | 37 #include "public/platform/WebServiceWorkerProviderClient.h" |
39 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
40 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
41 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
42 | 41 |
43 namespace blink { | 42 namespace blink { |
44 class WebServiceWorkerProvider; | 43 class WebServiceWorkerProvider; |
45 class WebServiceWorker; | 44 class WebServiceWorker; |
46 } | 45 } |
47 | 46 |
48 namespace WebCore { | 47 namespace WebCore { |
49 | 48 |
50 class Dictionary; | 49 class Dictionary; |
51 class ExecutionContext; | 50 class ExecutionContext; |
52 class ServiceWorker; | 51 class ServiceWorker; |
53 | 52 |
54 class ServiceWorkerContainer FINAL : | 53 class ServiceWorkerContainer FINAL : |
55 public RefCounted<ServiceWorkerContainer>, | 54 public RefCounted<ServiceWorkerContainer>, |
56 public ScriptWrappable, | 55 public ScriptWrappable, |
57 public ContextLifecycleObserver, | 56 public ContextLifecycleObserver, |
58 public DOMWindowLifecycleObserver, | |
59 public blink::WebServiceWorkerProviderClient { | 57 public blink::WebServiceWorkerProviderClient { |
60 public: | 58 public: |
61 static PassRefPtr<ServiceWorkerContainer> create(ExecutionContext*); | 59 static PassRefPtr<ServiceWorkerContainer> create(ExecutionContext*); |
62 ~ServiceWorkerContainer(); | 60 ~ServiceWorkerContainer(); |
63 | 61 |
64 void detachClient(); | 62 void detachClient(); |
65 | 63 |
66 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const Dictionary&); | 64 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const Dictionary&); |
67 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& scope
= String()); | 65 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& scope
= String()); |
68 | 66 |
69 // WebServiceWorkerProviderClient overrides. | 67 // WebServiceWorkerProviderClient overrides. |
70 virtual void setCurrentServiceWorker(blink::WebServiceWorker*) OVERRIDE; | 68 virtual void setCurrentServiceWorker(blink::WebServiceWorker*) OVERRIDE; |
71 virtual void dispatchMessageEvent(const blink::WebString& message, const bli
nk::WebMessagePortChannelArray&) OVERRIDE; | |
72 | 69 |
73 private: | 70 private: |
74 explicit ServiceWorkerContainer(ExecutionContext*); | 71 explicit ServiceWorkerContainer(ExecutionContext*); |
75 | 72 |
76 blink::WebServiceWorkerProvider* m_provider; | 73 blink::WebServiceWorkerProvider* m_provider; |
77 RefPtr<ServiceWorker> m_current; | 74 RefPtr<ServiceWorker> m_current; |
78 }; | 75 }; |
79 | 76 |
80 } // namespace WebCore | 77 } // namespace WebCore |
81 | 78 |
82 #endif // ServiceWorkerContainer_h | 79 #endif // ServiceWorkerContainer_h |
OLD | NEW |