Chromium Code Reviews| Index: content/browser/geofencing/geofencing_manager.h |
| diff --git a/content/browser/geofencing/geofencing_manager.h b/content/browser/geofencing/geofencing_manager.h |
| index 29c52e4830b92d6e7f6670545ac9429778ca4b44..5207730b02e7e599e0e67cace795be21508a9795 100644 |
| --- a/content/browser/geofencing/geofencing_manager.h |
| +++ b/content/browser/geofencing/geofencing_manager.h |
| @@ -11,12 +11,13 @@ |
| #include "base/callback_forward.h" |
| #include "base/macros.h" |
| +#include "base/memory/linked_ptr.h" |
| #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/geofencing_types.h" |
| #include "content/common/service_worker/service_worker_status_code.h" |
| template <typename T> |
| @@ -30,6 +31,7 @@ struct WebCircularGeofencingRegion; |
| namespace content { |
| class GeofencingService; |
| +class MockGeofencingService; |
| class ServiceWorkerContextWrapper; |
| class ServiceWorkerRegistration; |
| @@ -89,6 +91,12 @@ class CONTENT_EXPORT GeofencingManager |
| int64 service_worker_registration_id, |
| std::map<std::string, blink::WebCircularGeofencingRegion>* result); |
| + void SetMockProvider(int64 service_worker_registration_id, |
| + GeofencingMockState mock_state); |
| + void SetMockPosition(int64 service_worker_registration_id, |
| + double latitude, |
| + double longitude); |
| + |
| void SetServiceForTesting(GeofencingService* service) { |
| service_ = service; |
| } |
| @@ -110,6 +118,9 @@ class CONTENT_EXPORT GeofencingManager |
| void RegionEntered(int64 geofencing_registration_id) override; |
| void RegionExited(int64 geofencing_registration_id) override; |
| + GeofencingService* ServiceForServiceWorker( |
| + int64 service_worker_registration_id); |
| + |
| // Looks up a particular geofence registration. Returns nullptr if no |
| // registration with the given IDs exists. |
| Registration* FindRegistration(int64 service_worker_registration_id, |
| @@ -132,6 +143,11 @@ class CONTENT_EXPORT GeofencingManager |
| // Clears a registration. |
| void ClearRegistration(Registration* registration); |
| + // Unregisters and clears all registrations associated with a specific |
| + // service worker. Used when a service worker is unregistered or when enabling |
| + // or disabling mocking for this 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 |
| @@ -169,6 +185,7 @@ class CONTENT_EXPORT GeofencingManager |
| RegistrationIdRegistrationMap registrations_by_id_; |
| GeofencingService* service_; |
| + std::map<int64, linked_ptr<MockGeofencingService>> mock_services_; |
|
scheib
2014/12/03 17:54:31
Why not have the mock simply replace service_? Why
|
| scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
| DISALLOW_COPY_AND_ASSIGN(GeofencingManager); |