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 21 matching lines...) Expand all Loading... |
32 #define WebServiceWorkerProvider_h | 32 #define WebServiceWorkerProvider_h |
33 | 33 |
34 #include "public/platform/WebCallbacks.h" | 34 #include "public/platform/WebCallbacks.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class WebString; | 38 class WebString; |
39 class WebURL; | 39 class WebURL; |
40 class WebServiceWorker; | 40 class WebServiceWorker; |
41 class WebServiceWorkerProviderClient; | 41 class WebServiceWorkerProviderClient; |
| 42 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 event
s. Must be cleared before the client becomes invalid. | 50 // Called when a client wants to start listening to the service worker event
s. Must be cleared before the client becomes invalid. |
50 virtual void setClient(WebServiceWorkerProviderClient*) { } | 51 virtual void setClient(WebServiceWorkerProviderClient*) { } |
51 | 52 |
| 53 // FIXME: Remove this macro after two-side patches are landed (http://crbug.
com/396400). |
| 54 #define DISABLE_SERVICE_WORKER_REGISTRATION |
| 55 #ifdef DISABLE_SERVICE_WORKER_REGISTRATION |
52 // The WebServiceWorker and WebServiceWorkerError ownership are passed to th
e WebServiceWorkerCallbacks implementation. | 56 // The WebServiceWorker and WebServiceWorkerError ownership are passed to th
e WebServiceWorkerCallbacks implementation. |
53 typedef WebCallbacks<WebServiceWorker, WebServiceWorkerError> WebServiceWork
erCallbacks; | 57 typedef WebCallbacks<WebServiceWorker, WebServiceWorkerError> WebServiceWork
erCallbacks; |
54 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerCallbacks*) { } | 58 typedef WebServiceWorkerCallbacks WebServiceWorkerRegistrationCallbacks; |
| 59 #else |
| 60 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are
passed to the WebServiceWorkerRegistrationCallbacks implementation. |
| 61 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; |
| 62 #endif |
| 63 |
| 64 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } |
55 | 65 |
56 // Unregisters the ServiceWorker for a given scope. The provider | 66 // Unregisters the ServiceWorker for a given scope. The provider |
57 // must always pass null to onSuccess. | 67 // must always pass null to onSuccess. |
58 // FIXME: "unregister" does not provide a WebServiceWorker, revisit this | 68 // FIXME: "unregister" does not provide a WebServiceWorkerRegistration, revi
sit this |
59 // to clean up the the callback type to not take a WebServiceWorker*. | 69 // to clean up the the callback type to not take a WebServiceWorkerRegistrat
ion*. |
60 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
Callbacks*) { } | 70 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
RegistrationCallbacks*) { } |
61 | 71 |
62 virtual ~WebServiceWorkerProvider() { } | 72 virtual ~WebServiceWorkerProvider() { } |
63 }; | 73 }; |
64 | 74 |
65 } // namespace blink | 75 } // namespace blink |
66 | 76 |
67 #endif | 77 #endif |
OLD | NEW |