| 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 24 matching lines...) Expand all Loading... |
| 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 class WebServiceWorkerRegistration; |
| 43 struct WebServiceWorkerError; | 43 struct WebServiceWorkerError; |
| 44 | 44 |
| 45 // FIXME: Remove this macro after the chromium side patch is applied |
| 46 // See: https://crbug.com/390894 |
| 47 #define DISABLE_SERVICEWORKER_UNREGISTER_RESOLVE_TO_BOOLEAN |
| 48 |
| 45 // Created on the main thread, and may be passed to another script context | 49 // Created on the main thread, and may be passed to another script context |
| 46 // thread (e.g. worker thread) later. All methods of this class must be called | 50 // thread (e.g. worker thread) later. All methods of this class must be called |
| 47 // on the single script context thread. | 51 // on the single script context thread. |
| 48 class WebServiceWorkerProvider { | 52 class WebServiceWorkerProvider { |
| 49 public: | 53 public: |
| 50 // Called when a client wants to start listening to the service worker | 54 // Called when a client wants to start listening to the service worker |
| 51 // events. Must be cleared before the client becomes invalid. | 55 // events. Must be cleared before the client becomes invalid. |
| 52 virtual void setClient(WebServiceWorkerProviderClient*) { } | 56 virtual void setClient(WebServiceWorkerProviderClient*) { } |
| 53 | 57 |
| 54 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are | 58 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are |
| 55 // passed to the WebServiceWorkerRegistrationCallbacks implementation. | 59 // passed to the WebServiceWorkerRegistrationCallbacks implementation. |
| 56 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; | 60 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; |
| 61 #ifdef DISABLE_SERVICEWORKER_UNREGISTER_RESOLVE_TO_BOOLEAN |
| 62 typedef WebServiceWorkerRegistrationCallbacks WebServiceWorkerUnregistration
Callbacks; |
| 63 #else |
| 64 typedef WebCallbacks<bool, WebServiceWorkerError> WebServiceWorkerUnregistra
tionCallbacks; |
| 65 #endif |
| 57 | 66 |
| 58 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } | 67 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } |
| 59 | 68 |
| 60 // Unregisters the ServiceWorker for a given scope. The provider | 69 // Unregisters the ServiceWorker for a given scope. |
| 61 // must always pass null to onSuccess. | 70 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
UnregistrationCallbacks*) { } |
| 62 // FIXME: "unregister" does not provide a WebServiceWorkerRegistration, | |
| 63 // revisit this to clean up the the callback type to not take a | |
| 64 // WebServiceWorkerRegistration*. | |
| 65 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
RegistrationCallbacks*) { } | |
| 66 | 71 |
| 67 virtual ~WebServiceWorkerProvider() { } | 72 virtual ~WebServiceWorkerProvider() { } |
| 68 }; | 73 }; |
| 69 | 74 |
| 70 } // namespace blink | 75 } // namespace blink |
| 71 | 76 |
| 72 #endif | 77 #endif |
| OLD | NEW |