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 17 matching lines...) Expand all Loading... |
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" | 37 #include "core/frame/DOMWindowLifecycleObserver.h" |
| 38 #include "modules/serviceworkers/ServiceWorker.h" |
38 #include "public/platform/WebServiceWorkerProviderClient.h" | 39 #include "public/platform/WebServiceWorkerProviderClient.h" |
39 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
40 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
41 #include "wtf/RefCounted.h" | 42 #include "wtf/RefCounted.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 class WebServiceWorkerProvider; | 45 class WebServiceWorkerProvider; |
45 class WebServiceWorker; | 46 class WebServiceWorker; |
46 } | 47 } |
47 | 48 |
(...skipping 11 matching lines...) Expand all Loading... |
59 public blink::WebServiceWorkerProviderClient { | 60 public blink::WebServiceWorkerProviderClient { |
60 public: | 61 public: |
61 static PassRefPtr<ServiceWorkerContainer> create(ExecutionContext*); | 62 static PassRefPtr<ServiceWorkerContainer> create(ExecutionContext*); |
62 ~ServiceWorkerContainer(); | 63 ~ServiceWorkerContainer(); |
63 | 64 |
64 void detachClient(); | 65 void detachClient(); |
65 | 66 |
66 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const Dictionary&); | 67 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const Dictionary&); |
67 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& scope
= String()); | 68 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& scope
= String()); |
68 | 69 |
| 70 PassRefPtr<ServiceWorker> current() { return m_current; } |
| 71 |
69 // WebServiceWorkerProviderClient overrides. | 72 // WebServiceWorkerProviderClient overrides. |
70 virtual void setCurrentServiceWorker(blink::WebServiceWorker*) OVERRIDE; | 73 virtual void setCurrentServiceWorker(blink::WebServiceWorker*) OVERRIDE; |
71 virtual void dispatchMessageEvent(const blink::WebString& message, const bli
nk::WebMessagePortChannelArray&) OVERRIDE; | 74 virtual void dispatchMessageEvent(const blink::WebString& message, const bli
nk::WebMessagePortChannelArray&) OVERRIDE; |
72 | 75 |
73 private: | 76 private: |
74 explicit ServiceWorkerContainer(ExecutionContext*); | 77 explicit ServiceWorkerContainer(ExecutionContext*); |
75 | 78 |
76 blink::WebServiceWorkerProvider* m_provider; | 79 blink::WebServiceWorkerProvider* m_provider; |
77 RefPtr<ServiceWorker> m_current; | 80 RefPtr<ServiceWorker> m_current; |
78 }; | 81 }; |
79 | 82 |
80 } // namespace WebCore | 83 } // namespace WebCore |
81 | 84 |
82 #endif // ServiceWorkerContainer_h | 85 #endif // ServiceWorkerContainer_h |
OLD | NEW |