Index: content/browser/service_worker/service_worker_registration.h |
diff --git a/content/browser/service_worker/service_worker_registration.h b/content/browser/service_worker/service_worker_registration.h |
index a8b0fa735a1db61b0e19935dc2d0557737199c6b..ba4076aeb0519779bcfb4e8d9cf965579efe5818 100644 |
--- a/content/browser/service_worker/service_worker_registration.h |
+++ b/content/browser/service_worker/service_worker_registration.h |
@@ -26,7 +26,8 @@ class ServiceWorkerVersion; |
// being associated with the same registration. The class roughly |
// corresponds to navigator.serviceWorker.registgration. |
class CONTENT_EXPORT ServiceWorkerRegistration |
- : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerRegistration>) { |
+ : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerRegistration>), |
+ public ServiceWorkerVersion::Listener { |
public: |
typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; |
@@ -59,6 +60,8 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
return installing_version_.get(); |
} |
+ bool is_uninstalling() const { return is_uninstalling_; } |
+ |
void AddListener(Listener* listener); |
void RemoveListener(Listener* listener); |
@@ -76,13 +79,26 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
// listeners via OnVersionAttributesChanged. |
void UnsetVersion(ServiceWorkerVersion* version); |
+ virtual void OnNoControllees(ServiceWorkerVersion* version) OVERRIDE; |
+ |
// This method corresponds to the [[Activate]] algorithm described in |
// the service worker specification. It's only valid to call this method |
// when the registration's active version has no controllees. |
void ActivateWaitingVersion(const StatusCallback& completion_callback); |
+ // Triggers the [[ClearRegistration]] algorithm when the currently |
+ // active version has no controllees. Deletes this registration |
+ // from storage immediately. |
+ void ClearWhenReady(); |
+ |
+ // Restores this registration in storage and cancels the pending |
+ // [[ClearRegistration]] algorithm. If the algorithm was already triggered, |
+ // does nothing. |
+ void AbortPendingClear(); |
+ |
private: |
- ~ServiceWorkerRegistration(); |
+ virtual ~ServiceWorkerRegistration(); |
+ void Clear(); |
friend class base::RefCounted<ServiceWorkerRegistration>; |
void SetVersionInternal( |
@@ -100,6 +116,7 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
const GURL pattern_; |
const GURL script_url_; |
const int64 registration_id_; |
+ bool is_uninstalling_; |
scoped_refptr<ServiceWorkerVersion> active_version_; |
scoped_refptr<ServiceWorkerVersion> waiting_version_; |
scoped_refptr<ServiceWorkerVersion> installing_version_; |
@@ -108,5 +125,7 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
}; |
+ |
} // namespace content |
+ |
#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |