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

Unified Diff: Source/modules/geofencing/CircularGeofencingRegion.cpp

Issue 464073002: Pass through geofencing API calls to the content layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: only support circular regions for now 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: Source/modules/geofencing/CircularGeofencingRegion.cpp
diff --git a/Source/modules/geofencing/CircularGeofencingRegion.cpp b/Source/modules/geofencing/CircularGeofencingRegion.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5ab258579f2bc094e1a7eb584f1e1033959bf6f6
--- /dev/null
+++ b/Source/modules/geofencing/CircularGeofencingRegion.cpp
@@ -0,0 +1,56 @@
+// 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 "config.h"
+#include "modules/geofencing/CircularGeofencingRegion.h"
+
+#include "bindings/core/v8/Dictionary.h"
+#include "public/platform/WebCircularGeofencingRegion.h"
+#include "public/platform/WebString.h"
+
+namespace blink {
+
+namespace {
+
+WebCircularGeofencingRegion WebCircularGeofencingRegionFromDictionary(const Dictionary& init)
+{
+ WebCircularGeofencingRegion region;
+ String id;
+ DictionaryHelper::get(init, "id", id);
+ region.id = id;
+ DictionaryHelper::get(init, "latitude", region.latitude);
+ DictionaryHelper::get(init, "longitude", region.longitude);
+ DictionaryHelper::get(init, "radius", region.radius);
+ return region;
+}
+
+} // namespace
+
+CircularGeofencingRegion* CircularGeofencingRegion::create(const Dictionary& dictionary)
+{
+ return new CircularGeofencingRegion(WebCircularGeofencingRegionFromDictionary(dictionary));
+}
+
+CircularGeofencingRegion* CircularGeofencingRegion::create(const WebCircularGeofencingRegion& region)
+{
+ return new CircularGeofencingRegion(region);
+}
+
+CircularGeofencingRegion::CircularGeofencingRegion(const WebCircularGeofencingRegion& region)
+ : GeofencingRegion(region.id), m_latitude(region.latitude), m_longitude(region.longitude), m_radius(region.radius)
jochen (gone - plz use gerrit) 2014/09/04 11:14:54 nit. initializers on separate lines
Marijn Kruisselbrink 2014/09/04 17:44:19 Done.
+{
+ ScriptWrappable::init(this);
+}
+
+WebCircularGeofencingRegion CircularGeofencingRegion::webRegion() const
+{
+ WebCircularGeofencingRegion result;
+ result.id = id();
+ result.latitude = m_latitude;
+ result.longitude = m_longitude;
+ result.radius = m_radius;
+ return result;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698