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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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 WebServiceWorkerProvider_h | 31 #ifndef WebServiceWorkerProvider_h |
32 #define WebServiceWorkerProvider_h | 32 #define WebServiceWorkerProvider_h |
33 | 33 |
34 #include "public/platform/WebCallbacks.h" | 34 #include "public/platform/WebCallbacks.h" |
| 35 #include "public/platform/WebServiceWorkerRegistration.h" |
| 36 #include "public/platform/WebVector.h" |
35 | 37 |
36 namespace blink { | 38 namespace blink { |
37 | 39 |
38 class WebURL; | 40 class WebURL; |
39 class WebServiceWorker; | 41 class WebServiceWorker; |
40 class WebServiceWorkerProviderClient; | 42 class WebServiceWorkerProviderClient; |
41 class WebServiceWorkerRegistration; | |
42 struct WebServiceWorkerError; | 43 struct WebServiceWorkerError; |
43 | 44 |
44 // Created on the main thread, and may be passed to another script context | 45 // Created on the main thread, and may be passed to another script context |
45 // thread (e.g. worker thread) later. All methods of this class must be called | 46 // thread (e.g. worker thread) later. All methods of this class must be called |
46 // on the single script context thread. | 47 // on the single script context thread. |
47 class WebServiceWorkerProvider { | 48 class WebServiceWorkerProvider { |
48 public: | 49 public: |
49 // Called when a client wants to start listening to the service worker | 50 // Called when a client wants to start listening to the service worker |
50 // events. Must be cleared before the client becomes invalid. | 51 // events. Must be cleared before the client becomes invalid. |
51 virtual void setClient(WebServiceWorkerProviderClient*) { } | 52 virtual void setClient(WebServiceWorkerProviderClient*) { } |
52 | 53 |
53 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are | 54 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are |
54 // passed to the WebServiceWorkerRegistrationCallbacks implementation. | 55 // passed to the WebServiceWorkerRegistrationCallbacks implementation. |
55 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; | 56 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; |
56 typedef WebCallbacks<bool, WebServiceWorkerError> WebServiceWorkerUnregistra
tionCallbacks; | 57 typedef WebCallbacks<bool, WebServiceWorkerError> WebServiceWorkerUnregistra
tionCallbacks; |
57 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerGetRegistrationCallbacks; | 58 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerGetRegistrationCallbacks; |
| 59 typedef WebCallbacks<WebVector<WebServiceWorkerRegistration*>, WebServiceWor
kerError> WebServiceWorkerGetRegistrationsCallbacks; |
58 typedef WebCallbacks<WebServiceWorkerRegistration, void> WebServiceWorkerGet
RegistrationForReadyCallbacks; | 60 typedef WebCallbacks<WebServiceWorkerRegistration, void> WebServiceWorkerGet
RegistrationForReadyCallbacks; |
59 | 61 |
60 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } | 62 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } |
61 | 63 |
62 // Unregisters the ServiceWorker for a given scope. | 64 // Unregisters the ServiceWorker for a given scope. |
63 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
UnregistrationCallbacks*) { } | 65 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
UnregistrationCallbacks*) { } |
64 | 66 |
65 virtual void getRegistration(const WebURL& documentURL, WebServiceWorkerGetR
egistrationCallbacks*) { } | 67 virtual void getRegistration(const WebURL& documentURL, WebServiceWorkerGetR
egistrationCallbacks*) { } |
| 68 virtual void getRegistrations(WebServiceWorkerGetRegistrationsCallbacks*) {
} |
66 virtual void getRegistrationForReady(WebServiceWorkerGetRegistrationForReady
Callbacks*) { } | 69 virtual void getRegistrationForReady(WebServiceWorkerGetRegistrationForReady
Callbacks*) { } |
67 | 70 |
68 virtual ~WebServiceWorkerProvider() { } | 71 virtual ~WebServiceWorkerProvider() { } |
69 }; | 72 }; |
70 | 73 |
71 } // namespace blink | 74 } // namespace blink |
72 | 75 |
73 #endif | 76 #endif |
OLD | NEW |