| 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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/ScriptPromise.h" |
| 30 #include "bindings/core/v8/ScriptWrappable.h" | 31 #include "bindings/core/v8/ScriptWrappable.h" |
| 31 #include "core/dom/ActiveDOMObject.h" | 32 #include "core/dom/ActiveDOMObject.h" |
| 32 #include "modules/geolocation/Geoposition.h" | 33 #include "modules/geolocation/Geoposition.h" |
| 33 #include "modules/geolocation/PositionCallback.h" | 34 #include "modules/geolocation/PositionCallback.h" |
| 34 #include "modules/geolocation/PositionError.h" | 35 #include "modules/geolocation/PositionError.h" |
| 35 #include "modules/geolocation/PositionErrorCallback.h" | 36 #include "modules/geolocation/PositionErrorCallback.h" |
| 36 #include "modules/geolocation/PositionOptions.h" | 37 #include "modules/geolocation/PositionOptions.h" |
| 37 #include "platform/Timer.h" | 38 #include "platform/Timer.h" |
| 38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 39 | 40 |
| 40 namespace WebCore { | 41 namespace WebCore { |
| 41 | 42 |
| 42 class Dictionary; | 43 class Dictionary; |
| 43 class Document; | 44 class Document; |
| 44 class LocalFrame; | 45 class LocalFrame; |
| 46 class GeofencingRegion; |
| 45 class GeolocationController; | 47 class GeolocationController; |
| 46 class GeolocationError; | 48 class GeolocationError; |
| 47 class GeolocationPosition; | 49 class GeolocationPosition; |
| 48 class ExecutionContext; | 50 class ExecutionContext; |
| 49 | 51 |
| 50 class Geolocation FINAL | 52 class Geolocation FINAL |
| 51 : public GarbageCollectedFinalized<Geolocation> | 53 : public GarbageCollectedFinalized<Geolocation> |
| 52 , public ScriptWrappable | 54 , public ScriptWrappable |
| 53 , public ActiveDOMObject { | 55 , public ActiveDOMObject { |
| 54 public: | 56 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 | 77 |
| 76 bool isAllowed() const { return m_allowGeolocation == Yes; } | 78 bool isAllowed() const { return m_allowGeolocation == Yes; } |
| 77 | 79 |
| 78 // Notifies this that a new position is available. Must never be called | 80 // Notifies this that a new position is available. Must never be called |
| 79 // before permission is granted by the user. | 81 // before permission is granted by the user. |
| 80 void positionChanged(); | 82 void positionChanged(); |
| 81 | 83 |
| 82 // Notifies this that an error has occurred, it must be handled immediately. | 84 // Notifies this that an error has occurred, it must be handled immediately. |
| 83 void setError(GeolocationError*); | 85 void setError(GeolocationError*); |
| 84 | 86 |
| 87 ScriptPromise registerRegion(ScriptState*, GeofencingRegion*); |
| 88 ScriptPromise unregisterRegion(ScriptState*, const String& regionId); |
| 89 ScriptPromise getRegisteredRegions(ScriptState*) const; |
| 90 |
| 85 private: | 91 private: |
| 86 // Returns the last known position, if any. May return null. | 92 // Returns the last known position, if any. May return null. |
| 87 Geoposition* lastPosition(); | 93 Geoposition* lastPosition(); |
| 88 | 94 |
| 89 bool isDenied() const { return m_allowGeolocation == No; } | 95 bool isDenied() const { return m_allowGeolocation == No; } |
| 90 | 96 |
| 91 explicit Geolocation(ExecutionContext*); | 97 explicit Geolocation(ExecutionContext*); |
| 92 | 98 |
| 93 // Holds the success and error callbacks and the options that were provided | 99 // Holds the success and error callbacks and the options that were provided |
| 94 // when a oneshot or watcher were created. Also, if specified in the | 100 // when a oneshot or watcher were created. Also, if specified in the |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 Yes, | 244 Yes, |
| 239 No | 245 No |
| 240 } m_allowGeolocation; | 246 } m_allowGeolocation; |
| 241 | 247 |
| 242 GeoNotifierSet m_requestsAwaitingCachedPosition; | 248 GeoNotifierSet m_requestsAwaitingCachedPosition; |
| 243 }; | 249 }; |
| 244 | 250 |
| 245 } // namespace WebCore | 251 } // namespace WebCore |
| 246 | 252 |
| 247 #endif // Geolocation_h | 253 #endif // Geolocation_h |
| OLD | NEW |