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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 "config.h"
6 #include "modules/geofencing/CircularGeofencingRegion.h"
7
8 #include "bindings/core/v8/Dictionary.h"
9 #include "public/platform/WebCircularGeofencingRegion.h"
10 #include "public/platform/WebString.h"
11
12 namespace blink {
13
14 namespace {
15
16 WebCircularGeofencingRegion WebCircularGeofencingRegionFromDictionary(const Dict ionary& init)
17 {
18 WebCircularGeofencingRegion region;
19 String id;
20 DictionaryHelper::get(init, "id", id);
21 region.id = id;
22 DictionaryHelper::get(init, "latitude", region.latitude);
23 DictionaryHelper::get(init, "longitude", region.longitude);
24 DictionaryHelper::get(init, "radius", region.radius);
25 return region;
26 }
27
28 } // namespace
29
30 CircularGeofencingRegion* CircularGeofencingRegion::create(const Dictionary& dic tionary)
31 {
32 return new CircularGeofencingRegion(WebCircularGeofencingRegionFromDictionar y(dictionary));
33 }
34
35 CircularGeofencingRegion* CircularGeofencingRegion::create(const WebCircularGeof encingRegion& region)
36 {
37 return new CircularGeofencingRegion(region);
38 }
39
40 CircularGeofencingRegion::CircularGeofencingRegion(const WebCircularGeofencingRe gion& region)
41 : GeofencingRegion(region.id), m_latitude(region.latitude), m_longitude(regi on.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.
42 {
43 ScriptWrappable::init(this);
44 }
45
46 WebCircularGeofencingRegion CircularGeofencingRegion::webRegion() const
47 {
48 WebCircularGeofencingRegion result;
49 result.id = id();
50 result.latitude = m_latitude;
51 result.longitude = m_longitude;
52 result.radius = m_radius;
53 return result;
54 }
55
56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698