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/frame/Navigator.h" | 35 #include "core/frame/Navigator.h" |
36 #include "platform/Supplementable.h" | 36 #include "platform/Supplementable.h" |
37 | 37 |
| 38 namespace WebKit { |
| 39 class WebServiceWorkerProvider; |
| 40 class WebServiceWorkerProviderClient; |
| 41 } |
| 42 |
38 namespace WebCore { | 43 namespace WebCore { |
39 | 44 |
40 class ExceptionState; | 45 class ExceptionState; |
41 class Navigator; | 46 class Navigator; |
42 | 47 |
43 class NavigatorServiceWorker : public Supplement<Navigator> { | 48 class NavigatorServiceWorker : public Supplement<Navigator>, DOMWindowProperty { |
44 public: | 49 public: |
45 virtual ~NavigatorServiceWorker(); | 50 virtual ~NavigatorServiceWorker(); |
46 static NavigatorServiceWorker* from(Navigator*); | 51 static NavigatorServiceWorker* from(Navigator*); |
47 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } | 52 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator* navigator
) { return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); } |
48 | 53 |
49 static ScriptPromise registerServiceWorker(ExecutionContext*, Navigator*, co
nst String& pattern, const String& src, ExceptionState&); | 54 static ScriptPromise registerServiceWorker(ExecutionContext*, Navigator*, co
nst String& pattern, const String& src, ExceptionState&); |
50 static ScriptPromise unregisterServiceWorker(ExecutionContext*, Navigator*,
const String& pattern, ExceptionState&); | 55 static ScriptPromise unregisterServiceWorker(ExecutionContext*, Navigator*,
const String& pattern, ExceptionState&); |
51 | 56 |
52 private: | 57 private: |
53 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const String& src, ExceptionState&); | 58 ScriptPromise registerServiceWorker(ExecutionContext*, const String& pattern
, const String& src, ExceptionState&); |
54 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& patte
rn, ExceptionState&); | 59 ScriptPromise unregisterServiceWorker(ExecutionContext*, const String& patte
rn, ExceptionState&); |
55 | 60 |
56 explicit NavigatorServiceWorker(Navigator*); | 61 explicit NavigatorServiceWorker(Navigator*); |
57 | 62 |
| 63 virtual void willDetachGlobalObjectFromFrame() OVERRIDE; |
| 64 |
| 65 WebKit::WebServiceWorkerProvider* ensureProvider(); |
| 66 |
58 static const char* supplementName(); | 67 static const char* supplementName(); |
59 | 68 |
60 Navigator* m_navigator; | 69 Navigator* m_navigator; |
| 70 OwnPtr<WebKit::WebServiceWorkerProvider> m_provider; |
61 }; | 71 }; |
62 | 72 |
63 } // namespace WebCore | 73 } // namespace WebCore |
64 | 74 |
65 #endif // NavigatorServiceWorker_h | 75 #endif // NavigatorServiceWorker_h |
OLD | NEW |