| 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 #include "wtf/OwnPtr.h" |
| 21 #include "wtf/PassOwnPtr.h" | 22 #include "wtf/PassOwnPtr.h" |
| 22 | 23 |
| 23 namespace blink { | 24 namespace blink { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 // For CallbackPromiseAdapter to convert a WebVector of regions to a HeapVector. | 28 // For CallbackPromiseAdapter to convert a WebVector of regions to a HeapVector. |
| 28 class RegionArray { | 29 class RegionArray { |
| 29 public: | 30 public: |
| 30 typedef WebVector<WebGeofencingRegistration> WebType; | 31 using WebType = OwnPtr<WebVector<WebGeofencingRegistration>>; |
| 31 static HeapVector<Member<GeofencingRegion>> take(ScriptPromiseResolver* reso
lver, PassOwnPtr<WebType> webRegions) | 32 static HeapVector<Member<GeofencingRegion>> take(ScriptPromiseResolver* reso
lver, PassOwnPtr<WebVector<WebGeofencingRegistration>> webRegions) |
| 32 { | 33 { |
| 33 HeapVector<Member<GeofencingRegion>> regions; | 34 HeapVector<Member<GeofencingRegion>> regions; |
| 34 for (size_t i = 0; i < webRegions->size(); ++i) | 35 for (size_t i = 0; i < webRegions->size(); ++i) |
| 35 regions.append(CircularGeofencingRegion::create((*webRegions)[i].id,
(*webRegions)[i].region)); | 36 regions.append(CircularGeofencingRegion::create((*webRegions)[i].id,
(*webRegions)[i].region)); |
| 36 return regions; | 37 return regions; |
| 37 } | 38 } |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 RegionArray(); | 41 RegionArray(); |
| 41 }; | 42 }; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 provider->getRegisteredRegions(serviceWorkerRegistration, callbacks); | 95 provider->getRegisteredRegions(serviceWorkerRegistration, callbacks); |
| 95 return promise; | 96 return promise; |
| 96 } | 97 } |
| 97 | 98 |
| 98 DEFINE_TRACE(Geofencing) | 99 DEFINE_TRACE(Geofencing) |
| 99 { | 100 { |
| 100 visitor->trace(m_registration); | 101 visitor->trace(m_registration); |
| 101 } | 102 } |
| 102 | 103 |
| 103 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |