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

Side by Side Diff: content/browser/geofencing/geofencing_dispatcher_host.cc

Issue 701953007: Expose mock geofencing service via testRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/geofencing/geofencing_dispatcher_host.h" 5 #include "content/browser/geofencing/geofencing_dispatcher_host.h"
6 6
7 #include "content/browser/geofencing/geofencing_manager.h" 7 #include "content/browser/geofencing/geofencing_manager.h"
8 #include "content/browser/service_worker/service_worker_context_core.h" 8 #include "content/browser/service_worker/service_worker_context_core.h"
9 #include "content/browser/service_worker/service_worker_context_wrapper.h" 9 #include "content/browser/service_worker/service_worker_context_wrapper.h"
10 #include "content/browser/service_worker/service_worker_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
(...skipping 14 matching lines...) Expand all
25 GeofencingDispatcherHost::~GeofencingDispatcherHost() { 25 GeofencingDispatcherHost::~GeofencingDispatcherHost() {
26 } 26 }
27 27
28 bool GeofencingDispatcherHost::OnMessageReceived(const IPC::Message& message) { 28 bool GeofencingDispatcherHost::OnMessageReceived(const IPC::Message& message) {
29 bool handled = true; 29 bool handled = true;
30 IPC_BEGIN_MESSAGE_MAP(GeofencingDispatcherHost, message) 30 IPC_BEGIN_MESSAGE_MAP(GeofencingDispatcherHost, message)
31 IPC_MESSAGE_HANDLER(GeofencingHostMsg_RegisterRegion, OnRegisterRegion) 31 IPC_MESSAGE_HANDLER(GeofencingHostMsg_RegisterRegion, OnRegisterRegion)
32 IPC_MESSAGE_HANDLER(GeofencingHostMsg_UnregisterRegion, OnUnregisterRegion) 32 IPC_MESSAGE_HANDLER(GeofencingHostMsg_UnregisterRegion, OnUnregisterRegion)
33 IPC_MESSAGE_HANDLER(GeofencingHostMsg_GetRegisteredRegions, 33 IPC_MESSAGE_HANDLER(GeofencingHostMsg_GetRegisteredRegions,
34 OnGetRegisteredRegions) 34 OnGetRegisteredRegions)
35 IPC_MESSAGE_HANDLER(GeofencingHostMsg_SetMockProvider, OnSetMockProvider)
36 IPC_MESSAGE_HANDLER(GeofencingHostMsg_SetMockPosition, OnSetMockPosition)
35 IPC_MESSAGE_UNHANDLED(handled = false) 37 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP() 38 IPC_END_MESSAGE_MAP()
37 return handled; 39 return handled;
38 } 40 }
39 41
40 void GeofencingDispatcherHost::OnRegisterRegion( 42 void GeofencingDispatcherHost::OnRegisterRegion(
41 int thread_id, 43 int thread_id,
42 int request_id, 44 int request_id,
43 const std::string& region_id, 45 const std::string& region_id,
44 const blink::WebCircularGeofencingRegion& region, 46 const blink::WebCircularGeofencingRegion& region,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int request_id, 88 int request_id,
87 int64 service_worker_registration_id) { 89 int64 service_worker_registration_id) {
88 GeofencingRegistrations result; 90 GeofencingRegistrations result;
89 91
90 GeofencingStatus status = 92 GeofencingStatus status =
91 manager_->GetRegisteredRegions(service_worker_registration_id, &result); 93 manager_->GetRegisteredRegions(service_worker_registration_id, &result);
92 Send(new GeofencingMsg_GetRegisteredRegionsComplete( 94 Send(new GeofencingMsg_GetRegisteredRegionsComplete(
93 thread_id, request_id, status, result)); 95 thread_id, request_id, status, result));
94 } 96 }
95 97
98 void GeofencingDispatcherHost::OnSetMockProvider(
99 int64 service_worker_registration_id,
100 GeofencingMockState mock_state) {
101 manager_->SetMockProvider(service_worker_registration_id, mock_state);
102 }
103
104 void GeofencingDispatcherHost::OnSetMockPosition(
105 int64 service_worker_registration_id,
106 double latitude,
107 double longitude) {
108 manager_->SetMockPosition(service_worker_registration_id, latitude,
109 longitude);
110 }
111
96 void GeofencingDispatcherHost::RegisterRegionCompleted( 112 void GeofencingDispatcherHost::RegisterRegionCompleted(
97 int thread_id, 113 int thread_id,
98 int request_id, 114 int request_id,
99 GeofencingStatus status) { 115 GeofencingStatus status) {
100 Send(new GeofencingMsg_RegisterRegionComplete(thread_id, request_id, status)); 116 Send(new GeofencingMsg_RegisterRegionComplete(thread_id, request_id, status));
101 } 117 }
102 118
103 void GeofencingDispatcherHost::UnregisterRegionCompleted( 119 void GeofencingDispatcherHost::UnregisterRegionCompleted(
104 int thread_id, 120 int thread_id,
105 int request_id, 121 int request_id,
106 GeofencingStatus status) { 122 GeofencingStatus status) {
107 Send(new GeofencingMsg_UnregisterRegionComplete( 123 Send(new GeofencingMsg_UnregisterRegionComplete(
108 thread_id, request_id, status)); 124 thread_id, request_id, status));
109 } 125 }
110 126
111 } // namespace content 127 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698