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

Unified Diff: content/child/geofencing/geofencing_dispatcher.cc

Issue 623823002: Chrome side of passing on the service worker registration with geofencing API calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/child/geofencing/geofencing_dispatcher.cc
diff --git a/content/child/geofencing/geofencing_dispatcher.cc b/content/child/geofencing/geofencing_dispatcher.cc
index 1b0f8498c463d35c31f08f8dc68747085b7ae526..e864969cdc02cae718f4734a01c5b8c67aeab5ae 100644
--- a/content/child/geofencing/geofencing_dispatcher.cc
+++ b/content/child/geofencing/geofencing_dispatcher.cc
@@ -8,6 +8,7 @@
#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"
@@ -63,28 +64,46 @@ void GeofencingDispatcher::OnMessageReceived(const IPC::Message& msg) {
void GeofencingDispatcher::RegisterRegion(
const blink::WebString& region_id,
const blink::WebCircularGeofencingRegion& region,
+ blink::WebServiceWorkerRegistration* serviceworker,
blink::WebGeofencingCallbacks* callbacks) {
DCHECK(callbacks);
int request_id = region_registration_requests_.Add(callbacks);
- Send(new GeofencingHostMsg_RegisterRegion(
- CurrentWorkerId(), request_id, region_id.utf8(), region));
+ int serviceworker_id = -1;
+ if (serviceworker)
+ serviceworker_id = static_cast<WebServiceWorkerRegistrationImpl*>(
+ serviceworker)->handle_id();
+ Send(new GeofencingHostMsg_RegisterRegion(CurrentWorkerId(),
+ request_id,
+ region_id.utf8(),
+ region,
+ serviceworker_id));
}
void GeofencingDispatcher::UnregisterRegion(
const blink::WebString& region_id,
+ blink::WebServiceWorkerRegistration* serviceworker,
blink::WebGeofencingCallbacks* callbacks) {
DCHECK(callbacks);
int request_id = region_unregistration_requests_.Add(callbacks);
+ int serviceworker_id = -1;
+ if (serviceworker)
jsbell 2014/10/08 18:41:30 nit: need braces around multi-line if body
Marijn Kruisselbrink 2014/10/13 19:29:48 Done.
+ serviceworker_id = static_cast<WebServiceWorkerRegistrationImpl*>(
+ serviceworker)->handle_id();
Send(new GeofencingHostMsg_UnregisterRegion(
- CurrentWorkerId(), request_id, region_id.utf8()));
+ CurrentWorkerId(), request_id, region_id.utf8(), serviceworker_id));
}
void GeofencingDispatcher::GetRegisteredRegions(
+ blink::WebServiceWorkerRegistration* serviceworker,
blink::WebGeofencingRegionsCallbacks* callbacks) {
DCHECK(callbacks);
int request_id = get_registered_regions_requests_.Add(callbacks);
- Send(new GeofencingHostMsg_GetRegisteredRegions(CurrentWorkerId(),
- request_id));
+ int serviceworker_id = -1;
+ if (serviceworker)
jsbell 2014/10/08 18:41:30 nit: need braces around multi-line if body
Marijn Kruisselbrink 2014/10/13 19:29:48 Done.
+ serviceworker_id = static_cast<WebServiceWorkerRegistrationImpl*>(
+ serviceworker)->handle_id();
+ Send(new GeofencingHostMsg_GetRegisteredRegions(
+ CurrentWorkerId(), request_id, serviceworker_id));
}
GeofencingDispatcher* GeofencingDispatcher::GetOrCreateThreadSpecificInstance(

Powered by Google App Engine
This is Rietveld 408576698