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

Unified Diff: content/browser/geofencing/geofencing_dispatcher_host.cc

Issue 476293002: Pass through geofencing API calls to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 3 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/browser/geofencing/geofencing_dispatcher_host.cc
diff --git a/content/browser/geofencing/geofencing_dispatcher_host.cc b/content/browser/geofencing/geofencing_dispatcher_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..98d019ad122eb158138c26b1dc218490e8e49718
--- /dev/null
+++ b/content/browser/geofencing/geofencing_dispatcher_host.cc
@@ -0,0 +1,65 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/geofencing/geofencing_dispatcher_host.h"
+
+#include "content/common/geofencing_messages.h"
+#include "content/common/geofencing_status.h"
+#include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h"
+
+namespace content {
+
+GeofencingDispatcherHost::GeofencingDispatcherHost()
+ : BrowserMessageFilter(GeofencingMsgStart) {
+}
+
+GeofencingDispatcherHost::~GeofencingDispatcherHost() {
+}
+
+bool GeofencingDispatcherHost::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(GeofencingDispatcherHost, message)
+ IPC_MESSAGE_HANDLER(GeofencingHostMsg_RegisterRegion, OnRegisterRegion)
+ IPC_MESSAGE_HANDLER(GeofencingHostMsg_UnregisterRegion, OnUnregisterRegion)
+ IPC_MESSAGE_HANDLER(GeofencingHostMsg_GetRegisteredRegions,
+ OnGetRegisteredRegions)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void GeofencingDispatcherHost::OnRegisterRegion(
+ int thread_id,
+ int request_id,
+ const std::string& region_id,
+ const blink::WebCircularGeofencingRegion& region) {
+ Send(new GeofencingMsg_RegisterRegionComplete(
+ thread_id,
+ request_id,
+ GeofencingStatus::
+ GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE));
+}
+
+void GeofencingDispatcherHost::OnUnregisterRegion(int thread_id,
+ int request_id,
+ const std::string& regionId) {
+ Send(new GeofencingMsg_UnregisterRegionComplete(
+ thread_id,
+ request_id,
+ GeofencingStatus::
+ GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE));
+}
+
+void GeofencingDispatcherHost::OnGetRegisteredRegions(int thread_id,
+ int request_id) {
+ GeofencingRegistrations result;
+ Send(new GeofencingMsg_GetRegisteredRegionsComplete(
+ thread_id,
+ request_id,
+ GeofencingStatus::
+ GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE,
+ result));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698