OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "modules/geofencing/Geofencing.h" | 6 #include "modules/geofencing/Geofencing.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
11 #include "core/dom/DOMException.h" | 11 #include "core/dom/DOMException.h" |
12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
13 #include "modules/geofencing/CircularGeofencingRegion.h" | 13 #include "modules/geofencing/CircularGeofencingRegion.h" |
14 #include "modules/geofencing/GeofencingError.h" | 14 #include "modules/geofencing/GeofencingError.h" |
15 #include "modules/geofencing/GeofencingRegion.h" | 15 #include "modules/geofencing/GeofencingRegion.h" |
16 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 16 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
17 #include "public/platform/Platform.h" | 17 #include "public/platform/Platform.h" |
18 #include "public/platform/WebCircularGeofencingRegion.h" | 18 #include "public/platform/WebCircularGeofencingRegion.h" |
19 #include "public/platform/WebGeofencingProvider.h" | 19 #include "public/platform/WebGeofencingProvider.h" |
20 #include "public/platform/WebGeofencingRegistration.h" | 20 #include "public/platform/WebGeofencingRegistration.h" |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // For CallbackPromiseAdapter to convert a WebVector of regions to a HeapVector. | 26 // For CallbackPromiseAdapter to convert a WebVector of regions to a HeapVector. |
27 class RegionArray { | 27 class RegionArray { |
28 public: | 28 public: |
29 typedef blink::WebVector<blink::WebGeofencingRegistration> WebType; | 29 typedef blink::WebVector<blink::WebGeofencingRegistration> WebType; |
30 static HeapVector<Member<GeofencingRegion> > take(ScriptPromiseResolver* res
olver, WebType* regionsRaw) | 30 static HeapVector<Member<GeofencingRegion>> take(ScriptPromiseResolver* reso
lver, WebType* regionsRaw) |
31 { | 31 { |
32 OwnPtr<WebType> webRegions = adoptPtr(regionsRaw); | 32 OwnPtr<WebType> webRegions = adoptPtr(regionsRaw); |
33 HeapVector<Member<GeofencingRegion> > regions; | 33 HeapVector<Member<GeofencingRegion>> regions; |
34 for (size_t i = 0; i < webRegions->size(); ++i) | 34 for (size_t i = 0; i < webRegions->size(); ++i) |
35 regions.append(CircularGeofencingRegion::create((*webRegions)[i].id,
(*webRegions)[i].region)); | 35 regions.append(CircularGeofencingRegion::create((*webRegions)[i].id,
(*webRegions)[i].region)); |
36 return regions; | 36 return regions; |
37 } | 37 } |
38 | 38 |
39 static void dispose(WebType* regionsRaw) | 39 static void dispose(WebType* regionsRaw) |
40 { | 40 { |
41 delete regionsRaw; | 41 delete regionsRaw; |
42 } | 42 } |
43 | 43 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 provider->getRegisteredRegions(serviceWorkerRegistration, callbacks); | 99 provider->getRegisteredRegions(serviceWorkerRegistration, callbacks); |
100 return promise; | 100 return promise; |
101 } | 101 } |
102 | 102 |
103 void Geofencing::trace(Visitor* visitor) | 103 void Geofencing::trace(Visitor* visitor) |
104 { | 104 { |
105 visitor->trace(m_registration); | 105 visitor->trace(m_registration); |
106 } | 106 } |
107 | 107 |
108 } // namespace blink | 108 } // namespace blink |
OLD | NEW |