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 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 | 37 |
| 38 namespace WebKit { |
| 39 class WebServiceWorkerProvider; |
| 40 } |
| 41 |
38 namespace WebCore { | 42 namespace WebCore { |
39 | 43 |
40 class ExceptionState; | 44 class ExceptionState; |
41 class Navigator; | 45 class Navigator; |
42 | 46 |
43 class NavigatorServiceWorker : public Supplement<Navigator> { | 47 class NavigatorServiceWorker : public Supplement<Navigator> { |
44 public: | 48 public: |
45 virtual ~NavigatorServiceWorker(); | 49 virtual ~NavigatorServiceWorker(); |
46 static NavigatorServiceWorker* from(Navigator*); | 50 static NavigatorServiceWorker* from(Navigator*); |
47 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } | 51 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } |
48 | 52 |
49 static ScriptPromise registerServiceWorker(ScriptExecutionContext*, Navigato
r*, const String& pattern, const String& src, ExceptionState&); | 53 static ScriptPromise registerServiceWorker(ScriptExecutionContext*, Navigato
r*, const String& pattern, const String& src, ExceptionState&); |
50 static ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, Naviga
tor*, const String& pattern, ExceptionState&); | 54 static ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, Naviga
tor*, const String& pattern, ExceptionState&); |
51 | 55 |
52 private: | 56 private: |
53 ScriptPromise registerServiceWorker(ScriptExecutionContext*, const String& p
attern, const String& src, ExceptionState&); | 57 ScriptPromise registerServiceWorker(ScriptExecutionContext*, const String& p
attern, const String& src, ExceptionState&); |
54 ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, const String&
pattern, ExceptionState&); | 58 ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, const String&
pattern, ExceptionState&); |
55 | 59 |
56 explicit NavigatorServiceWorker(Navigator*); | 60 explicit NavigatorServiceWorker(Navigator*); |
57 | 61 |
| 62 WebKit::WebServiceWorkerProvider* serviceWorkerProvider(); |
| 63 |
58 static const char* supplementName(); | 64 static const char* supplementName(); |
59 | 65 |
60 Navigator* m_navigator; | 66 Navigator* m_navigator; |
| 67 OwnPtr<WebKit::WebServiceWorkerProvider> m_provider; |
61 }; | 68 }; |
62 | 69 |
63 } // namespace WebCore | 70 } // namespace WebCore |
64 | 71 |
65 #endif // NavigatorServiceWorker_h | 72 #endif // NavigatorServiceWorker_h |
OLD | NEW |