Index: content/browser/geofencing/geofencing_manager.h |
diff --git a/content/browser/geofencing/geofencing_manager.h b/content/browser/geofencing/geofencing_manager.h |
index 590b3f3d4470122920890105be1d95785a1094c9..6954d7bd39b48ebe841287dfc48a9730c74afee3 100644 |
--- a/content/browser/geofencing/geofencing_manager.h |
+++ b/content/browser/geofencing/geofencing_manager.h |
@@ -14,6 +14,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "content/browser/geofencing/geofencing_registration_delegate.h" |
+#include "content/browser/service_worker/service_worker_context_observer.h" |
#include "content/browser/service_worker/service_worker_storage.h" |
#include "content/common/content_export.h" |
#include "content/common/geofencing_types.h" |
@@ -42,10 +43,9 @@ class ServiceWorkerRegistration; |
// This class is created on the UI thread, but all its methods should only be |
// called from the IO thread. |
// TODO(mek): Implement some kind of persistence of registrations. |
-// TODO(mek): Unregister a geofence when the ServiceWorkerRegistration it |
-// belongs to goes away. |
class CONTENT_EXPORT GeofencingManager |
: NON_EXPORTED_BASE(public GeofencingRegistrationDelegate), |
+ NON_EXPORTED_BASE(public ServiceWorkerContextObserver), |
public base::RefCountedThreadSafe<GeofencingManager> { |
public: |
typedef base::Callback<void(GeofencingStatus)> StatusCallback; |
@@ -113,6 +113,10 @@ class CONTENT_EXPORT GeofencingManager |
void InitOnIO(); |
void ShutdownOnIO(); |
+ // ServiceWorkerContextObserver implementation. |
+ void OnRegistrationDeleted(int64 service_worker_registration_id, |
+ const GURL& pattern) override; |
+ |
// GeofencingRegistrationDelegate implementation. |
void RegistrationFinished(int64 geofencing_registration_id, |
GeofencingStatus status) override; |
@@ -141,6 +145,10 @@ class CONTENT_EXPORT GeofencingManager |
// Clears a registration. |
void ClearRegistration(Registration* registration); |
+ // Unregisters and clears all registrations associated with a specific |
+ // service worker. |
+ void CleanUpForServiceWorker(int64 service_worker_registration_id); |
+ |
// Starts dispatching a particular geofencing |event_type| for the geofence |
// registration with the given ID. This first looks up the Service Worker |
// Registration the geofence is associated with, and then attempts to deliver |