From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../Modules/geolocation/GeolocationController.h | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'Source/WebCore/Modules/geolocation/GeolocationController.h') 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 @@ -39,45 +39,47 @@ namespace WebCore { class GeolocationClient; class GeolocationError; class GeolocationPosition; -class Page; -class GeolocationController : public Supplement { +class GeolocationController : public Supplement, private ActivityStateChangeObserver { + WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GeolocationController); public: + GeolocationController(Page&, GeolocationClient&); ~GeolocationController(); - static PassOwnPtr 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(Supplement::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 m_lastPosition; + typedef HashSet> 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> m_pendedPermissionRequest; }; } // namespace WebCore #endif // ENABLE(GEOLOCATION) - -#endif // GeolocationController_h -- cgit v1.2.1