| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. |
| 3 * Copyright 2010, The Android Open Source Project | 3 * Copyright 2010, The Android Open Source Project |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef Geolocation_h | 27 #ifndef Geolocation_h |
| 28 #define Geolocation_h | 28 #define Geolocation_h |
| 29 | 29 |
| 30 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.h" |
| 31 #include "core/dom/ContextLifecycleObserver.h" | 31 #include "core/dom/ContextLifecycleObserver.h" |
| 32 #include "core/page/PageVisibilityObserver.h" | 32 #include "core/page/PageVisibilityObserver.h" |
| 33 #include "device/geolocation/public/interfaces/geolocation.mojom-blink.h" |
| 33 #include "modules/ModulesExport.h" | 34 #include "modules/ModulesExport.h" |
| 34 #include "modules/geolocation/GeoNotifier.h" | 35 #include "modules/geolocation/GeoNotifier.h" |
| 35 #include "modules/geolocation/GeolocationWatchers.h" | 36 #include "modules/geolocation/GeolocationWatchers.h" |
| 36 #include "modules/geolocation/Geoposition.h" | 37 #include "modules/geolocation/Geoposition.h" |
| 37 #include "modules/geolocation/PositionCallback.h" | 38 #include "modules/geolocation/PositionCallback.h" |
| 38 #include "modules/geolocation/PositionError.h" | 39 #include "modules/geolocation/PositionError.h" |
| 39 #include "modules/geolocation/PositionErrorCallback.h" | 40 #include "modules/geolocation/PositionErrorCallback.h" |
| 40 #include "modules/geolocation/PositionOptions.h" | 41 #include "modules/geolocation/PositionOptions.h" |
| 41 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
| 42 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
| 43 #include "third_party/WebKit/public/platform/modules/geolocation/geolocation.moj
om-blink.h" | 44 |
| 44 #include "third_party/WebKit/public/platform/modules/permissions/permission.mojo
m-blink.h" | 45 #include "third_party/WebKit/public/platform/modules/permissions/permission.mojo
m-blink.h" |
| 45 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom-blink.h" | 46 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom-blink.h" |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 class Document; | 50 class Document; |
| 50 class LocalFrame; | 51 class LocalFrame; |
| 51 class GeolocationError; | 52 class GeolocationError; |
| 52 class ExecutionContext; | 53 class ExecutionContext; |
| 53 | 54 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // obtained. | 158 // obtained. |
| 158 void startRequest(GeoNotifier*); | 159 void startRequest(GeoNotifier*); |
| 159 | 160 |
| 160 bool haveSuitableCachedPosition(const PositionOptions&); | 161 bool haveSuitableCachedPosition(const PositionOptions&); |
| 161 | 162 |
| 162 // Record whether the origin trying to access Geolocation would be allowed | 163 // Record whether the origin trying to access Geolocation would be allowed |
| 163 // to access a feature that can only be accessed by secure origins. | 164 // to access a feature that can only be accessed by secure origins. |
| 164 // See https://goo.gl/Y0ZkNV | 165 // See https://goo.gl/Y0ZkNV |
| 165 void recordOriginTypeAccess() const; | 166 void recordOriginTypeAccess() const; |
| 166 | 167 |
| 167 void onPositionUpdated(mojom::blink::GeopositionPtr); | 168 void onPositionUpdated(device::mojom::blink::GeopositionPtr); |
| 168 | 169 |
| 169 // Processes the notifiers that were waiting for a permission decision. If | 170 // Processes the notifiers that were waiting for a permission decision. If |
| 170 // granted then the notifier's timers are started. Otherwise, a fatal error | 171 // granted then the notifier's timers are started. Otherwise, a fatal error |
| 171 // is set on them. | 172 // is set on them. |
| 172 void onGeolocationPermissionUpdated(mojom::blink::PermissionStatus); | 173 void onGeolocationPermissionUpdated(mojom::blink::PermissionStatus); |
| 173 | 174 |
| 174 void onGeolocationConnectionError(); | 175 void onGeolocationConnectionError(); |
| 175 void onPermissionConnectionError(); | 176 void onPermissionConnectionError(); |
| 176 | 177 |
| 177 GeoNotifierSet m_oneShots; | 178 GeoNotifierSet m_oneShots; |
| 178 GeolocationWatchers m_watchers; | 179 GeolocationWatchers m_watchers; |
| 179 GeoNotifierSet m_pendingForPermissionNotifiers; | 180 GeoNotifierSet m_pendingForPermissionNotifiers; |
| 180 Member<Geoposition> m_lastPosition; | 181 Member<Geoposition> m_lastPosition; |
| 181 | 182 |
| 182 // States of Geolocation permission as granted by the embedder. Unknown | 183 // States of Geolocation permission as granted by the embedder. Unknown |
| 183 // means that the embedder still has to be asked for the current permission | 184 // means that the embedder still has to be asked for the current permission |
| 184 // level; Requested means that the user has yet to make a decision. | 185 // level; Requested means that the user has yet to make a decision. |
| 185 enum Permission { | 186 enum Permission { |
| 186 PermissionUnknown, | 187 PermissionUnknown, |
| 187 PermissionRequested, | 188 PermissionRequested, |
| 188 PermissionAllowed, | 189 PermissionAllowed, |
| 189 PermissionDenied | 190 PermissionDenied |
| 190 }; | 191 }; |
| 191 | 192 |
| 192 Permission m_geolocationPermission; | 193 Permission m_geolocationPermission; |
| 193 mojom::blink::GeolocationServicePtr m_geolocationService; | 194 device::mojom::blink::GeolocationServicePtr m_geolocationService; |
| 194 bool m_enableHighAccuracy = false; | 195 bool m_enableHighAccuracy = false; |
| 195 mojom::blink::PermissionServicePtr m_permissionService; | 196 mojom::blink::PermissionServicePtr m_permissionService; |
| 196 | 197 |
| 197 // Whether a GeoNotifier is waiting for a position update. | 198 // Whether a GeoNotifier is waiting for a position update. |
| 198 bool m_updating = false; | 199 bool m_updating = false; |
| 199 | 200 |
| 200 // Set to true when m_geolocationService is disconnected. This is used to | 201 // Set to true when m_geolocationService is disconnected. This is used to |
| 201 // detect when m_geolocationService is disconnected and reconnected while | 202 // detect when m_geolocationService is disconnected and reconnected while |
| 202 // running callbacks in response to a call to onPositionUpdated(). | 203 // running callbacks in response to a call to onPositionUpdated(). |
| 203 bool m_disconnectedGeolocationService = false; | 204 bool m_disconnectedGeolocationService = false; |
| 204 }; | 205 }; |
| 205 | 206 |
| 206 } // namespace blink | 207 } // namespace blink |
| 207 | 208 |
| 208 #endif // Geolocation_h | 209 #endif // Geolocation_h |
| OLD | NEW |