| 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" |
| 37 #include "public/platform/WebServiceWorkerProviderClient.h" | 38 #include "public/platform/WebServiceWorkerProviderClient.h" |
| 38 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
| 39 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 40 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 class WebServiceWorkerProvider; | 44 class WebServiceWorkerProvider; |
| 44 class WebServiceWorker; | 45 class WebServiceWorker; |
| 45 } | 46 } |
| 46 | 47 |
| 47 namespace WebCore { | 48 namespace WebCore { |
| 48 | 49 |
| 49 class Dictionary; | 50 class Dictionary; |
| 50 class ExecutionContext; | 51 class ExecutionContext; |
| 51 class ServiceWorker; | 52 class ServiceWorker; |
| 52 | 53 |
| 53 class ServiceWorkerContainer FINAL : | 54 class ServiceWorkerContainer FINAL : |
| 54 public RefCounted<ServiceWorkerContainer>, | 55 public RefCounted<ServiceWorkerContainer>, |
| 55 public ScriptWrappable, | 56 public ScriptWrappable, |
| 56 public ContextLifecycleObserver, | 57 public ContextLifecycleObserver, |
| 58 public DOMWindowLifecycleObserver, |
| 57 public blink::WebServiceWorkerProviderClient { | 59 public blink::WebServiceWorkerProviderClient { |
| 58 public: | 60 public: |
| 59 static PassRefPtr<ServiceWorkerContainer> create(ExecutionContext*); | 61 static PassRefPtr<ServiceWorkerContainer> create(ExecutionContext*); |
| 60 ~ServiceWorkerContainer(); | 62 ~ServiceWorkerContainer(); |
| 61 | 63 |
| 62 void detachClient(); | 64 void detachClient(); |
| 63 | 65 |
| 64 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const Dictionary&); | 66 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const Dictionary&); |
| 65 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& scope
= String()); | 67 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& scope
= String()); |
| 66 | 68 |
| 67 // WebServiceWorkerProviderClient overrides. | 69 // WebServiceWorkerProviderClient overrides. |
| 68 virtual void setCurrentServiceWorker(blink::WebServiceWorker*) OVERRIDE; | 70 virtual void setCurrentServiceWorker(blink::WebServiceWorker*) OVERRIDE; |
| 71 virtual void dispatchMessageEvent(const blink::WebString& message, const bli
nk::WebMessagePortChannelArray&) OVERRIDE; |
| 69 | 72 |
| 70 private: | 73 private: |
| 71 explicit ServiceWorkerContainer(ExecutionContext*); | 74 explicit ServiceWorkerContainer(ExecutionContext*); |
| 72 | 75 |
| 73 blink::WebServiceWorkerProvider* m_provider; | 76 blink::WebServiceWorkerProvider* m_provider; |
| 74 RefPtr<ServiceWorker> m_current; | 77 RefPtr<ServiceWorker> m_current; |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace WebCore | 80 } // namespace WebCore |
| 78 | 81 |
| 79 #endif // ServiceWorkerContainer_h | 82 #endif // ServiceWorkerContainer_h |
| OLD | NEW |