Chromium Code Reviews| Index: content/child/geofencing/geofencing_dispatcher.cc | 
| diff --git a/content/child/geofencing/geofencing_dispatcher.cc b/content/child/geofencing/geofencing_dispatcher.cc | 
| index 1b0f8498c463d35c31f08f8dc68747085b7ae526..9fb4f3c7066e132a24ba572b83a331a583a0f74c 100644 | 
| --- a/content/child/geofencing/geofencing_dispatcher.cc | 
| +++ b/content/child/geofencing/geofencing_dispatcher.cc | 
| @@ -8,9 +8,11 @@ | 
| #include "base/memory/scoped_ptr.h" | 
| #include "base/message_loop/message_loop.h" | 
| #include "base/thread_task_runner_handle.h" | 
| +#include "content/child/service_worker/web_service_worker_registration_impl.h" | 
| #include "content/child/thread_safe_sender.h" | 
| #include "content/child/worker_thread_task_runner.h" | 
| #include "content/common/geofencing_messages.h" | 
| +#include "content/common/service_worker/service_worker_types.h" | 
| #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" | 
| #include "third_party/WebKit/public/platform/WebGeofencingError.h" | 
| #include "third_party/WebKit/public/platform/WebGeofencingRegistration.h" | 
| @@ -63,28 +65,60 @@ void GeofencingDispatcher::OnMessageReceived(const IPC::Message& msg) { | 
| void GeofencingDispatcher::RegisterRegion( | 
| const blink::WebString& region_id, | 
| const blink::WebCircularGeofencingRegion& region, | 
| + blink::WebServiceWorkerRegistration* service_worker_registration, | 
| blink::WebGeofencingCallbacks* callbacks) { | 
| DCHECK(callbacks); | 
| int request_id = region_registration_requests_.Add(callbacks); | 
| - Send(new GeofencingHostMsg_RegisterRegion( | 
| - CurrentWorkerId(), request_id, region_id.utf8(), region)); | 
| + // TODO(mek): Reject requests without a service worker registration without | 
| 
 
palmer
2014/10/16 01:22:34
Nit: Wording: "without...without..." sounds a bit
 
Marijn Kruisselbrink
2014/10/16 17:00:19
Done.
 
 | 
| + // bouncing through browser process. | 
| + int64 serviceworker_registration_id = kInvalidServiceWorkerRegistrationId; | 
| + if (service_worker_registration) { | 
| + serviceworker_registration_id = | 
| + static_cast<WebServiceWorkerRegistrationImpl*>( | 
| + service_worker_registration)->registration_id(); | 
| + } | 
| + Send(new GeofencingHostMsg_RegisterRegion(CurrentWorkerId(), | 
| + request_id, | 
| + region_id.utf8(), | 
| + region, | 
| + serviceworker_registration_id)); | 
| } | 
| void GeofencingDispatcher::UnregisterRegion( | 
| const blink::WebString& region_id, | 
| + blink::WebServiceWorkerRegistration* service_worker_registration, | 
| blink::WebGeofencingCallbacks* callbacks) { | 
| DCHECK(callbacks); | 
| int request_id = region_unregistration_requests_.Add(callbacks); | 
| - Send(new GeofencingHostMsg_UnregisterRegion( | 
| - CurrentWorkerId(), request_id, region_id.utf8())); | 
| + // TODO(mek): Reject requests without a service worker registration without | 
| + // bouncing through browser process. | 
| + int64 serviceworker_registration_id = kInvalidServiceWorkerRegistrationId; | 
| + if (service_worker_registration) { | 
| + serviceworker_registration_id = | 
| + static_cast<WebServiceWorkerRegistrationImpl*>( | 
| + service_worker_registration)->registration_id(); | 
| + } | 
| + Send(new GeofencingHostMsg_UnregisterRegion(CurrentWorkerId(), | 
| + request_id, | 
| + region_id.utf8(), | 
| + serviceworker_registration_id)); | 
| } | 
| void GeofencingDispatcher::GetRegisteredRegions( | 
| + blink::WebServiceWorkerRegistration* service_worker_registration, | 
| blink::WebGeofencingRegionsCallbacks* callbacks) { | 
| DCHECK(callbacks); | 
| int request_id = get_registered_regions_requests_.Add(callbacks); | 
| - Send(new GeofencingHostMsg_GetRegisteredRegions(CurrentWorkerId(), | 
| - request_id)); | 
| + // TODO(mek): Reject requests without a service worker registration without | 
| + // bouncing through browser process. | 
| + int64 serviceworker_registration_id = kInvalidServiceWorkerRegistrationId; | 
| + if (service_worker_registration) { | 
| + serviceworker_registration_id = | 
| + static_cast<WebServiceWorkerRegistrationImpl*>( | 
| + service_worker_registration)->registration_id(); | 
| + } | 
| + Send(new GeofencingHostMsg_GetRegisteredRegions( | 
| + CurrentWorkerId(), request_id, serviceworker_registration_id)); | 
| } | 
| GeofencingDispatcher* GeofencingDispatcher::GetOrCreateThreadSpecificInstance( |