Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: content/browser/geofencing/geofencing_manager.h

Issue 788073007: Cleanup geofence registrations when a service worker is unregistered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: slightly improve mock usage in test Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « no previous file | content/browser/geofencing/geofencing_manager.cc » ('j') | content/browser/geofencing/geofencing_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698