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