| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebServiceWorkerRegistration_h | 5 #ifndef WebServiceWorkerRegistration_h |
| 6 #define WebServiceWorkerRegistration_h | 6 #define WebServiceWorkerRegistration_h |
| 7 | 7 |
| 8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
| 9 #include "public/platform/WebURL.h" | 9 #include "public/platform/WebURL.h" |
| 10 #include "public/platform/modules/serviceworker/WebServiceWorkerError.h" | 10 #include "public/platform/modules/serviceworker/WebServiceWorkerError.h" |
| 11 | 11 |
| 12 #include <stdint.h> |
| 13 |
| 12 namespace blink { | 14 namespace blink { |
| 13 | 15 |
| 14 class WebServiceWorkerProvider; | 16 class WebServiceWorkerProvider; |
| 15 class WebServiceWorkerRegistrationProxy; | 17 class WebServiceWorkerRegistrationProxy; |
| 16 | 18 |
| 17 // The interface of the registration representation in the embedder. The | 19 // The interface of the registration representation in the embedder. The |
| 18 // embedder implements this interface and passes its handle | 20 // embedder implements this interface and passes its handle |
| 19 // (WebServiceWorkerRegistration::Handle) to Blink. Blink accesses the | 21 // (WebServiceWorkerRegistration::Handle) to Blink. Blink accesses the |
| 20 // implementation via the handle to update or unregister the registration. | 22 // implementation via the handle to update or unregister the registration. |
| 21 class WebServiceWorkerRegistration { | 23 class WebServiceWorkerRegistration { |
| 22 public: | 24 public: |
| 23 virtual ~WebServiceWorkerRegistration() { } | 25 virtual ~WebServiceWorkerRegistration() { } |
| 24 | 26 |
| 25 using WebServiceWorkerUpdateCallbacks = WebCallbacks<void, const WebServiceW
orkerError&>; | 27 using WebServiceWorkerUpdateCallbacks = WebCallbacks<void, const WebServiceW
orkerError&>; |
| 26 using WebServiceWorkerUnregistrationCallbacks = WebCallbacks<bool, const Web
ServiceWorkerError&>; | 28 using WebServiceWorkerUnregistrationCallbacks = WebCallbacks<bool, const Web
ServiceWorkerError&>; |
| 27 | 29 |
| 28 // The handle interface that retains a reference to the implementation of | 30 // The handle interface that retains a reference to the implementation of |
| 29 // WebServiceWorkerRegistration in the embedder and is owned by | 31 // WebServiceWorkerRegistration in the embedder and is owned by |
| 30 // ServiceWorkerRegistration object in Blink. The embedder must keep the | 32 // ServiceWorkerRegistration object in Blink. The embedder must keep the |
| 31 // registration representation while Blink is owning this handle. | 33 // registration representation while Blink is owning this handle. |
| 32 class Handle { | 34 class Handle { |
| 33 public: | 35 public: |
| 34 virtual ~Handle() { } | 36 virtual ~Handle() { } |
| 35 virtual WebServiceWorkerRegistration* registration() { return nullptr; } | 37 virtual WebServiceWorkerRegistration* registration() { return nullptr; } |
| 36 }; | 38 }; |
| 37 | 39 |
| 40 virtual int64_t registrationId() { return 0; } |
| 41 |
| 38 virtual void setProxy(WebServiceWorkerRegistrationProxy*) { } | 42 virtual void setProxy(WebServiceWorkerRegistrationProxy*) { } |
| 39 virtual WebServiceWorkerRegistrationProxy* proxy() { return nullptr; } | 43 virtual WebServiceWorkerRegistrationProxy* proxy() { return nullptr; } |
| 40 virtual void proxyStopped() { } | 44 virtual void proxyStopped() { } |
| 41 | 45 |
| 42 virtual WebURL scope() const { return WebURL(); } | 46 virtual WebURL scope() const { return WebURL(); } |
| 43 virtual void update(WebServiceWorkerProvider*, WebServiceWorkerUpdateCallbac
ks*) { } | 47 virtual void update(WebServiceWorkerProvider*, WebServiceWorkerUpdateCallbac
ks*) { } |
| 44 virtual void unregister(WebServiceWorkerProvider*, WebServiceWorkerUnregistr
ationCallbacks*) { } | 48 virtual void unregister(WebServiceWorkerProvider*, WebServiceWorkerUnregistr
ationCallbacks*) { } |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 } // namespace blink | 51 } // namespace blink |
| 48 | 52 |
| 49 #endif // WebServiceWorkerRegistration_h | 53 #endif // WebServiceWorkerRegistration_h |
| OLD | NEW |