| 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 16 matching lines...) Expand all Loading... |
| 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/WebVector.h" | 35 #include "public/platform/WebVector.h" |
| 36 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" | 36 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" |
| 37 #include "public/platform/modules/serviceworker/WebServiceWorkerUpdateViaCache.h
" |
| 37 | 38 |
| 38 #include <memory> | 39 #include <memory> |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 class WebURL; | 43 class WebURL; |
| 43 class WebServiceWorkerProviderClient; | 44 class WebServiceWorkerProviderClient; |
| 44 struct WebServiceWorkerError; | 45 struct WebServiceWorkerError; |
| 45 | 46 |
| 46 // WebServiceWorkerProvider essentially attaches to a document or worker | 47 // WebServiceWorkerProvider essentially attaches to a document or worker |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 WebCallbacks<std::unique_ptr<WebServiceWorkerRegistrationHandles>, | 99 WebCallbacks<std::unique_ptr<WebServiceWorkerRegistrationHandles>, |
| 99 const WebServiceWorkerError&>; | 100 const WebServiceWorkerError&>; |
| 100 using WebServiceWorkerGetRegistrationForReadyCallbacks = | 101 using WebServiceWorkerGetRegistrationForReadyCallbacks = |
| 101 WebCallbacks<std::unique_ptr<WebServiceWorkerRegistration::Handle>, void>; | 102 WebCallbacks<std::unique_ptr<WebServiceWorkerRegistration::Handle>, void>; |
| 102 | 103 |
| 103 // For ServiceWorkerContainer#register(). Requests the embedder to register a | 104 // For ServiceWorkerContainer#register(). Requests the embedder to register a |
| 104 // service worker. | 105 // service worker. |
| 105 virtual void RegisterServiceWorker( | 106 virtual void RegisterServiceWorker( |
| 106 const WebURL& pattern, | 107 const WebURL& pattern, |
| 107 const WebURL& script_url, | 108 const WebURL& script_url, |
| 109 blink::WebServiceWorkerUpdateViaCache update_via_cache, |
| 108 std::unique_ptr<WebServiceWorkerRegistrationCallbacks>) {} | 110 std::unique_ptr<WebServiceWorkerRegistrationCallbacks>) {} |
| 109 // For ServiceWorkerContainer#getRegistration(). Requests the embedder to | 111 // For ServiceWorkerContainer#getRegistration(). Requests the embedder to |
| 110 // return a registration. | 112 // return a registration. |
| 111 virtual void GetRegistration( | 113 virtual void GetRegistration( |
| 112 const WebURL& document_url, | 114 const WebURL& document_url, |
| 113 std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>) {} | 115 std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>) {} |
| 114 // For ServiceWorkerContainer#getRegistrations(). Requests the embedder to | 116 // For ServiceWorkerContainer#getRegistrations(). Requests the embedder to |
| 115 // return matching registrations. | 117 // return matching registrations. |
| 116 virtual void GetRegistrations( | 118 virtual void GetRegistrations( |
| 117 std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks>) {} | 119 std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks>) {} |
| 118 // For ServiceWorkerContainer#ready. Requests the embedder to return the | 120 // For ServiceWorkerContainer#ready. Requests the embedder to return the |
| 119 // ready registration. | 121 // ready registration. |
| 120 virtual void GetRegistrationForReady( | 122 virtual void GetRegistrationForReady( |
| 121 std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>) {} | 123 std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>) {} |
| 122 // Helper function for checking URLs. The |scope| and |script_url| cannot | 124 // Helper function for checking URLs. The |scope| and |script_url| cannot |
| 123 // include escape sequences for "/" or "\" as per spec, as they would break | 125 // include escape sequences for "/" or "\" as per spec, as they would break |
| 124 // would the path restriction. | 126 // would the path restriction. |
| 125 virtual bool ValidateScopeAndScriptURL(const WebURL& scope, | 127 virtual bool ValidateScopeAndScriptURL(const WebURL& scope, |
| 126 const WebURL& script_url, | 128 const WebURL& script_url, |
| 127 WebString* error_message) { | 129 WebString* error_message) { |
| 128 return false; | 130 return false; |
| 129 } | 131 } |
| 130 | 132 |
| 131 virtual ~WebServiceWorkerProvider() {} | 133 virtual ~WebServiceWorkerProvider() {} |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 } // namespace blink | 136 } // namespace blink |
| 135 | 137 |
| 136 #endif | 138 #endif |
| OLD | NEW |