Index: content/browser/geofencing/geofencing_dispatcher_host.cc |
diff --git a/content/browser/geofencing/geofencing_dispatcher_host.cc b/content/browser/geofencing/geofencing_dispatcher_host.cc |
index 43e5037cea3c0bd1371f5a5d243084fef62c4831..c0a84eb8d5561ad408e406494721241ea6b991d6 100644 |
--- a/content/browser/geofencing/geofencing_dispatcher_host.cc |
+++ b/content/browser/geofencing/geofencing_dispatcher_host.cc |
@@ -4,8 +4,8 @@ |
#include "content/browser/geofencing/geofencing_dispatcher_host.h" |
+#include "content/browser/geofencing/geofencing_manager.h" |
#include "content/common/geofencing_messages.h" |
-#include "content/common/geofencing_status.h" |
#include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" |
namespace content { |
@@ -42,12 +42,14 @@ void GeofencingDispatcherHost::OnRegisterRegion( |
thread_id, request_id, GeofencingStatus::GEOFENCING_STATUS_ERROR)); |
return; |
} |
- // TODO(mek): Handle registration request. |
- Send(new GeofencingMsg_RegisterRegionComplete( |
- thread_id, |
- request_id, |
- GeofencingStatus:: |
- GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE)); |
+ GeofencingManager::GetInstance()->RegisterRegion( |
+ 0, /* service_worker_registration_id */ |
Michael van Ouwerkerk
2014/10/06 16:43:42
I assume you need a TODO here? And below.
Marijn Kruisselbrink
2014/10/06 19:14:11
Sure, I can add more TODO's here as well, although
Michael van Ouwerkerk
2014/10/08 16:59:01
TODO's are not just reminders for your future self
|
+ region_id, |
+ region, |
+ base::Bind(&GeofencingDispatcherHost::RegisterRegionCompleted, |
+ this, |
Michael van Ouwerkerk
2014/10/06 16:43:41
Should this be a weak pointer?
Marijn Kruisselbrink
2014/10/06 19:14:11
Yes, that's probably better. Done.
|
+ thread_id, |
+ request_id)); |
} |
void GeofencingDispatcherHost::OnUnregisterRegion( |
@@ -60,23 +62,39 @@ void GeofencingDispatcherHost::OnUnregisterRegion( |
thread_id, request_id, GeofencingStatus::GEOFENCING_STATUS_ERROR)); |
return; |
} |
- // TODO(mek): Handle unregistration request. |
- Send(new GeofencingMsg_UnregisterRegionComplete( |
- thread_id, |
- request_id, |
- GeofencingStatus:: |
- GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE)); |
+ GeofencingManager::GetInstance()->UnregisterRegion( |
+ 0, /* service_worker_registration_id */ |
+ region_id, |
+ base::Bind(&GeofencingDispatcherHost::UnregisterRegionCompleted, |
+ this, |
+ thread_id, |
+ request_id)); |
} |
void GeofencingDispatcherHost::OnGetRegisteredRegions(int thread_id, |
int request_id) { |
GeofencingRegistrations result; |
+ GeofencingStatus status = |
+ GeofencingManager::GetInstance()->GetRegisteredRegions( |
+ 0, /* service_worker_registration_id */ |
+ &result); |
Send(new GeofencingMsg_GetRegisteredRegionsComplete( |
- thread_id, |
- request_id, |
- GeofencingStatus:: |
- GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, |
- result)); |
+ thread_id, request_id, status, result)); |
+} |
+ |
+void GeofencingDispatcherHost::RegisterRegionCompleted( |
+ int thread_id, |
+ int request_id, |
+ GeofencingStatus result) { |
Michael van Ouwerkerk
2014/10/06 16:43:41
Let's call this status as you use result for other
Marijn Kruisselbrink
2014/10/06 19:14:11
Done.
|
+ Send(new GeofencingMsg_RegisterRegionComplete(thread_id, request_id, result)); |
+} |
+ |
+void GeofencingDispatcherHost::UnregisterRegionCompleted( |
+ int thread_id, |
+ int request_id, |
+ GeofencingStatus result) { |
+ Send(new GeofencingMsg_UnregisterRegionComplete( |
+ thread_id, request_id, result)); |
} |
} // namespace content |