diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/Modules/geolocation/GeolocationController.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/Modules/geolocation/GeolocationController.h')
-rw-r--r-- | Source/WebCore/Modules/geolocation/GeolocationController.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.h b/Source/WebCore/Modules/geolocation/GeolocationController.h index 9192c60dc..474708777 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.h +++ b/Source/WebCore/Modules/geolocation/GeolocationController.h @@ -23,11 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GeolocationController_h -#define GeolocationController_h +#pragma once #if ENABLE(GEOLOCATION) +#include "ActivityStateChangeObserver.h" #include "Geolocation.h" #include "Page.h" #include <wtf/HashSet.h> @@ -39,45 +39,47 @@ namespace WebCore { class GeolocationClient; class GeolocationError; class GeolocationPosition; -class Page; -class GeolocationController : public Supplement<Page> { +class GeolocationController : public Supplement<Page>, private ActivityStateChangeObserver { + WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GeolocationController); public: + GeolocationController(Page&, GeolocationClient&); ~GeolocationController(); - static PassOwnPtr<GeolocationController> create(GeolocationClient*); - void addObserver(Geolocation*, bool enableHighAccuracy); void removeObserver(Geolocation*); void requestPermission(Geolocation*); void cancelPermissionRequest(Geolocation*); - void positionChanged(GeolocationPosition*); - void errorOccurred(GeolocationError*); + WEBCORE_EXPORT void positionChanged(GeolocationPosition*); + WEBCORE_EXPORT void errorOccurred(GeolocationError*); GeolocationPosition* lastPosition(); - GeolocationClient* client() { return m_client; } + GeolocationClient& client() { return m_client; } - static const char* supplementName(); + WEBCORE_EXPORT static const char* supplementName(); static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); } private: - GeolocationController(GeolocationClient*); + Page& m_page; + GeolocationClient& m_client; - GeolocationClient* m_client; + void activityStateDidChange(ActivityState::Flags oldActivityState, ActivityState::Flags newActivityState) override; RefPtr<GeolocationPosition> m_lastPosition; + typedef HashSet<RefPtr<Geolocation>> ObserversSet; // All observers; both those requesting high accuracy and those not. ObserversSet m_observers; ObserversSet m_highAccuracyObservers; + + // While the page is not visible, we pend permission requests. + HashSet<RefPtr<Geolocation>> m_pendedPermissionRequest; }; } // namespace WebCore #endif // ENABLE(GEOLOCATION) - -#endif // GeolocationController_h |