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 NavigatorServiceWorker_h | 31 #ifndef NavigatorServiceWorker_h |
32 #define NavigatorServiceWorker_h | 32 #define NavigatorServiceWorker_h |
33 | 33 |
34 #include "bindings/v8/ScriptPromise.h" | 34 #include "bindings/v8/ScriptPromise.h" |
35 #include "core/page/Navigator.h" | 35 #include "core/page/Navigator.h" |
36 #include "platform/Supplementable.h" | 36 #include "platform/Supplementable.h" |
| 37 #include "public/platform/WebServiceWorkerProviderClient.h" |
| 38 |
| 39 namespace WebKit { |
| 40 class WebServiceWorkerProvider; |
| 41 class WebString; |
| 42 } |
37 | 43 |
38 namespace WebCore { | 44 namespace WebCore { |
39 | 45 |
40 class ExceptionState; | 46 class ExceptionState; |
41 class Navigator; | 47 class Navigator; |
42 | 48 |
43 class NavigatorServiceWorker : public Supplement<Navigator> { | 49 class NavigatorServiceWorker : public Supplement<Navigator>, public WebKit::WebS
erviceWorkerProviderClient { |
44 public: | 50 public: |
45 virtual ~NavigatorServiceWorker(); | 51 virtual ~NavigatorServiceWorker(); |
46 static NavigatorServiceWorker* from(Navigator*); | 52 static NavigatorServiceWorker* from(Navigator*); |
47 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } | 53 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } |
48 | 54 |
49 static ScriptPromise registerServiceWorker(ScriptExecutionContext*, Navigato
r*, const String& pattern, const String& src, ExceptionState&); | 55 static ScriptPromise registerServiceWorker(ScriptExecutionContext*, Navigato
r*, const String& pattern, const String& src, ExceptionState&); |
50 static ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, Naviga
tor*, const String& pattern, ExceptionState&); | 56 static ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, Naviga
tor*, const String& pattern, ExceptionState&); |
51 | 57 |
| 58 // WebServiceWorkerProviderClient implementation |
| 59 virtual void didFailToStart(const WebKit::WebString& message) OVERRIDE; |
| 60 |
52 private: | 61 private: |
53 ScriptPromise registerServiceWorker(ScriptExecutionContext*, const String& p
attern, const String& src, ExceptionState&); | 62 ScriptPromise registerServiceWorker(ScriptExecutionContext*, const String& p
attern, const String& src, ExceptionState&); |
54 ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, const String&
pattern, ExceptionState&); | 63 ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, const String&
pattern, ExceptionState&); |
55 | 64 |
56 explicit NavigatorServiceWorker(Navigator*); | 65 explicit NavigatorServiceWorker(Navigator*); |
57 | 66 |
| 67 WebKit::WebServiceWorkerProvider* serviceWorkerProvider(); |
| 68 |
58 static const char* supplementName(); | 69 static const char* supplementName(); |
59 | 70 |
60 Navigator* m_navigator; | 71 Navigator* m_navigator; |
| 72 OwnPtr<WebKit::WebServiceWorkerProvider> m_provider; |
61 }; | 73 }; |
62 | 74 |
63 } // namespace WebCore | 75 } // namespace WebCore |
64 | 76 |
65 #endif // NavigatorServiceWorker_h | 77 #endif // NavigatorServiceWorker_h |
OLD | NEW |