OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/geofencing/geofencing_dispatcher_host.h" |
| 6 |
| 7 #include "content/common/geofencing_messages.h" |
| 8 #include "content/common/geofencing_status.h" |
| 9 #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 GeofencingDispatcherHost::GeofencingDispatcherHost() |
| 14 : BrowserMessageFilter(GeofencingMsgStart) { |
| 15 } |
| 16 |
| 17 GeofencingDispatcherHost::~GeofencingDispatcherHost() { |
| 18 } |
| 19 |
| 20 bool GeofencingDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
| 21 bool handled = true; |
| 22 IPC_BEGIN_MESSAGE_MAP(GeofencingDispatcherHost, message) |
| 23 IPC_MESSAGE_HANDLER(GeofencingHostMsg_RegisterRegion, OnRegisterRegion) |
| 24 IPC_MESSAGE_HANDLER(GeofencingHostMsg_UnregisterRegion, OnUnregisterRegion) |
| 25 IPC_MESSAGE_HANDLER(GeofencingHostMsg_GetRegisteredRegions, |
| 26 OnGetRegisteredRegions) |
| 27 IPC_MESSAGE_UNHANDLED(handled = false) |
| 28 IPC_END_MESSAGE_MAP() |
| 29 return handled; |
| 30 } |
| 31 |
| 32 void GeofencingDispatcherHost::OnRegisterRegion( |
| 33 int thread_id, |
| 34 int request_id, |
| 35 const std::string& region_id, |
| 36 const blink::WebCircularGeofencingRegion& region) { |
| 37 Send(new GeofencingMsg_RegisterRegionComplete( |
| 38 thread_id, |
| 39 request_id, |
| 40 GeofencingStatus:: |
| 41 GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE)); |
| 42 } |
| 43 |
| 44 void GeofencingDispatcherHost::OnUnregisterRegion(int thread_id, |
| 45 int request_id, |
| 46 const std::string& regionId) { |
| 47 Send(new GeofencingMsg_UnregisterRegionComplete( |
| 48 thread_id, |
| 49 request_id, |
| 50 GeofencingStatus:: |
| 51 GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE)); |
| 52 } |
| 53 |
| 54 void GeofencingDispatcherHost::OnGetRegisteredRegions(int thread_id, |
| 55 int request_id) { |
| 56 GeofencingRegistrations result; |
| 57 Send(new GeofencingMsg_GetRegisteredRegionsComplete( |
| 58 thread_id, |
| 59 request_id, |
| 60 GeofencingStatus:: |
| 61 GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, |
| 62 result)); |
| 63 } |
| 64 |
| 65 } // namespace content |
OLD | NEW |