summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/geolocation/GeolocationController.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/Modules/geolocation/GeolocationController.h')
-rw-r--r--Source/WebCore/Modules/geolocation/GeolocationController.h30
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