| 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 WebServiceWorkerRegistrationProxy_h | 5 #ifndef WebServiceWorkerRegistrationProxy_h |
| 6 #define WebServiceWorkerRegistrationProxy_h | 6 #define WebServiceWorkerRegistrationProxy_h |
| 7 | 7 |
| 8 #include "public/platform/WebCommon.h" | 8 #include "WebCommon.h" |
| 9 #include "WebPrivatePtr.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 class ServiceWorkerRegistration; | 13 class ServiceWorkerRegistrationProxy; |
| 13 class WebServiceWorker; | 14 class WebServiceWorker; |
| 14 | 15 |
| 15 // A proxy interface, passed via WebServiceWorkerRegistration.setProxy() from | 16 // A proxy interface, passed via WebServiceWorkerRegistration.setProxy() from |
| 16 // blink to the embedder, to talk to the ServiceWorkerRegistration object from | 17 // blink to the embedder, to talk to the ServiceWorkerRegistration object from |
| 17 // embedder. | 18 // embedder. |
| 18 class WebServiceWorkerRegistrationProxy { | 19 class WebServiceWorkerRegistrationProxy { |
| 19 public: | 20 public: |
| 20 WebServiceWorkerRegistrationProxy() : m_private(0) { } | 21 WebServiceWorkerRegistrationProxy() { } |
| 21 virtual ~WebServiceWorkerRegistrationProxy() { } | 22 WebServiceWorkerRegistrationProxy(const WebServiceWorkerRegistrationProxy& o
ther) { assign(other); } |
| 23 virtual ~WebServiceWorkerRegistrationProxy() { reset(); } |
| 22 | 24 |
| 23 // Notifies that the registration entered the installation process. | 25 // Notifies that the registration entered the installation process. |
| 24 // The installing worker should be accessible via | 26 // The installing worker should be accessible via |
| 25 // WebServiceWorkerRegistration.installing. | 27 // WebServiceWorkerRegistration.installing. |
| 26 virtual void dispatchUpdateFoundEvent() = 0; | 28 virtual void dispatchUpdateFoundEvent() = 0; |
| 27 | 29 |
| 28 virtual void setInstalling(WebServiceWorker*) = 0; | 30 virtual void setInstalling(WebServiceWorker*) = 0; |
| 29 virtual void setWaiting(WebServiceWorker*) = 0; | 31 virtual void setWaiting(WebServiceWorker*) = 0; |
| 30 virtual void setActive(WebServiceWorker*) = 0; | 32 virtual void setActive(WebServiceWorker*) = 0; |
| 31 | 33 |
| 34 BLINK_PLATFORM_EXPORT void assign(const WebServiceWorkerRegistrationProxy&); |
| 35 BLINK_PLATFORM_EXPORT void reset(); |
| 36 |
| 32 #if INSIDE_BLINK | 37 #if INSIDE_BLINK |
| 33 BLINK_PLATFORM_EXPORT WebServiceWorkerRegistrationProxy(ServiceWorkerRegistr
ation*); | 38 BLINK_PLATFORM_EXPORT WebServiceWorkerRegistrationProxy(ServiceWorkerRegistr
ationProxy*); |
| 34 BLINK_PLATFORM_EXPORT operator ServiceWorkerRegistration*() const; | 39 BLINK_PLATFORM_EXPORT WebServiceWorkerRegistrationProxy& operator=(ServiceWo
rkerRegistrationProxy*); |
| 40 BLINK_PLATFORM_EXPORT operator ServiceWorkerRegistrationProxy*() const; |
| 35 #endif | 41 #endif |
| 36 | 42 |
| 43 bool isNull() const { return m_private.isNull(); } |
| 44 |
| 37 protected: | 45 protected: |
| 38 ServiceWorkerRegistration* m_private; | 46 WebPrivatePtr<ServiceWorkerRegistrationProxy> m_private; |
| 39 }; | 47 }; |
| 40 | 48 |
| 41 } // namespace blink | 49 } // namespace blink |
| 42 | 50 |
| 43 #endif // WebServiceWorkerRegistrationProxy_h | 51 #endif // WebServiceWorkerRegistrationProxy_h |
| OLD | NEW |