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

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

Issue 629393002: Chromium side of geofencing event dispatching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@geofencing_serviceworker
Patch Set: rebase Created 6 years, 2 months 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 7cd7b17ef44c7362c258de94291a8bd1af49156e..d926a060b7c5d685457b4e46838d970f90c036a0 100644
--- a/content/browser/geofencing/geofencing_manager.h
+++ b/content/browser/geofencing/geofencing_manager.h
@@ -14,8 +14,10 @@
#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_storage.h"
#include "content/common/content_export.h"
#include "content/common/geofencing_status.h"
+#include "content/common/service_worker/service_worker_status_code.h"
template <typename T>
struct DefaultSingletonTraits;
@@ -29,6 +31,7 @@ namespace content {
class GeofencingService;
class ServiceWorkerContextWrapper;
+class ServiceWorkerRegistration;
// This is the main API to the geofencing subsystem. There is one instance of
// this class per storage partition.
@@ -38,6 +41,8 @@ class ServiceWorkerContextWrapper;
// 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),
public base::RefCountedThreadSafe<GeofencingManager> {
@@ -102,6 +107,8 @@ class CONTENT_EXPORT GeofencingManager
// GeofencingRegistrationDelegate implementation.
void RegistrationFinished(int64 geofencing_registration_id,
GeofencingStatus status) override;
+ void RegionEntered(int64 geofencing_registration_id) override;
+ void RegionExited(int64 geofencing_registration_id) override;
// Looks up a particular geofence registration. Returns nullptr if no
// registration with the given IDs exists.
@@ -125,6 +132,17 @@ class CONTENT_EXPORT GeofencingManager
// Clears a registration.
void ClearRegistration(Registration* registration);
+ void DispatchGeofencingEvent(blink::WebGeofencingEventType event_type,
Michael van Ouwerkerk 2014/10/27 15:57:40 Please document these methods. I can't tell from t
Marijn Kruisselbrink 2014/10/27 18:29:10 Done.
+ int64 geofencing_registration_id);
+ void DeliverGeofencingEvent(blink::WebGeofencingEventType event_type,
+ int64 geofencing_registration_id,
+ ServiceWorkerStatusCode service_worker_status,
+ const scoped_refptr<ServiceWorkerRegistration>&
+ service_worker_registration);
+ void DeliverGeofencingEventEnd(const scoped_refptr<ServiceWorkerRegistration>&
+ service_worker_registration,
+ ServiceWorkerStatusCode service_worker_status);
+
// Map of all registered regions for a particular service worker registration.
typedef std::map<std::string, Registration> RegionIdRegistrationMap;
// Map of service worker registration id to the regions registered by that

Powered by Google App Engine
This is Rietveld 408576698