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 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> { |
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(ScriptExecutionContext*, Navigato r*, const String& pattern, const String& src, ExceptionState&); | 54 static ScriptPromise registerServiceWorker(ScriptExecutionContext*, Navigato r*, const String& pattern, const String& src, ExceptionState&); |
50 static ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, Naviga tor*, const String& pattern, ExceptionState&); | 55 static ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, Naviga tor*, const String& pattern, ExceptionState&); |
51 | 56 |
52 private: | 57 private: |
53 ScriptPromise registerServiceWorker(ScriptExecutionContext*, const String& p attern, const String& src, ExceptionState&); | 58 ScriptPromise registerServiceWorker(ScriptExecutionContext*, const String& p attern, const String& src, ExceptionState&); |
54 ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, const String& pattern, ExceptionState&); | 59 ScriptPromise unregisterServiceWorker(ScriptExecutionContext*, const String& pattern, ExceptionState&); |
55 | 60 |
56 explicit NavigatorServiceWorker(Navigator*); | 61 explicit NavigatorServiceWorker(Navigator*); |
57 | 62 |
63 WebKit::WebServiceWorkerProvider* serviceWorkerProvider(); | |
abarth-chromium
2013/10/11 18:08:14
Sometimes we call functions like this ensureProvid
alecflett
2013/10/11 18:52:23
Done.
| |
64 | |
58 static const char* supplementName(); | 65 static const char* supplementName(); |
59 | 66 |
60 Navigator* m_navigator; | 67 Navigator* m_navigator; |
68 OwnPtr<WebKit::WebServiceWorkerProvider> m_provider; | |
abarth-chromium
2013/10/11 18:08:14
I don't understand how m_provider is cleaned up.
alecflett
2013/10/11 18:52:23
Done. This hangs off navigator, but I assume it's
| |
61 }; | 69 }; |
62 | 70 |
63 } // namespace WebCore | 71 } // namespace WebCore |
64 | 72 |
65 #endif // NavigatorServiceWorker_h | 73 #endif // NavigatorServiceWorker_h |
OLD | NEW |