summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-01 12:39:36 +0000
committerSteve Block <steveblock@google.com>2010-02-01 13:17:47 +0000
commit23c22a60ec108914d8df8cd80023582fbedfe978 (patch)
treeea9fe94f39ddb281f88ca25e8bcd024def4eb9a2 /WebCore
parentdb217ef7ffee230d812f9da02a02d7d7bc696a8d (diff)
downloadexternal_webkit-23c22a60ec108914d8df8cd80023582fbedfe978.zip
external_webkit-23c22a60ec108914d8df8cd80023582fbedfe978.tar.gz
external_webkit-23c22a60ec108914d8df8cd80023582fbedfe978.tar.bz2
Cherry-pick WebKit change 54079 for client-based Geolocation
See http://trac.webkit.org/changeset/54079 This is required to bring Geolocation up-to-date with webkit.org to allow upstreaming of maximumAge code. Change-Id: I46b8f439668768fa930c610d4b10c7e45cc1ca01
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/ChangeLog15
-rw-r--r--WebCore/page/Geolocation.cpp35
-rw-r--r--WebCore/page/Geolocation.h4
3 files changed, 48 insertions, 6 deletions
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b9bfc25..d2c246a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-29 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Client-based Geolocation starts updating before getting consent from the user
+ https://bugs.webkit.org/show_bug.cgi?id=34343
+
+ * page/Geolocation.cpp:
+ (WebCore::Geolocation::startRequest): Pass notifier instead of options to startUpdating.
+ (WebCore::Geolocation::setIsAllowed): Add the observer or notify of error for deferred startUpdating.
+ (WebCore::Geolocation::startUpdating): Pass notifier instead of options, since we may need to call it if we fail to get user consent.
+ Defer adding the observer if we don't yet have user consent, since this could kick off
+ server-based wifi Geolocation requests.
+ * page/Geolocation.h:
+
2010-01-22 Steve Falkenburg <sfalken@apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index ef3d43c..1ab4a8c 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -283,7 +283,7 @@ PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<Positi
if (haveSuitableCachedPosition(notifier->m_options.get()))
notifier->setUseCachedPosition();
else {
- if (notifier->hasZeroTimeout() || startUpdating(notifier->m_options.get()))
+ if (notifier->hasZeroTimeout() || startUpdating(notifier.get()))
notifier->startTimerIfNeeded();
else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, "Failed to start Geolocation service"));
@@ -348,7 +348,7 @@ void Geolocation::makeCachedPositionCallbacks()
if (m_oneShots.contains(notifier))
m_oneShots.remove(notifier);
else if (m_watchers.contains(notifier)) {
- if (notifier->hasZeroTimeout() || startUpdating(notifier->m_options.get()))
+ if (notifier->hasZeroTimeout() || startUpdating(notifier))
notifier->startTimerIfNeeded();
else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, "Failed to start Geolocation service"));
@@ -402,6 +402,26 @@ void Geolocation::setIsAllowed(bool allowed)
// This may be due to either a new position from the service, or a cached
// position.
m_allowGeolocation = allowed ? Yes : No;
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ if (m_startRequestPermissionNotifier) {
+ if (isAllowed()) {
+ // Permission request was made during the startUpdating process
+ m_startRequestPermissionNotifier = 0;
+ if (!m_frame)
+ return;
+ Page* page = m_frame->page();
+ if (!page)
+ return;
+ page->geolocationController()->addObserver(this);
+ } else {
+ m_startRequestPermissionNotifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
+ m_oneShots.add(m_startRequestPermissionNotifier);
+ m_startRequestPermissionNotifier = 0;
+ }
+ return;
+ }
+#endif
if (!isAllowed()) {
RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage);
@@ -594,12 +614,17 @@ void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service)
#endif
-bool Geolocation::startUpdating(PositionOptions* options)
+bool Geolocation::startUpdating(GeoNotifier* notifier)
{
#if ENABLE(CLIENT_BASED_GEOLOCATION)
// FIXME: Pass options to client.
- UNUSED_PARAM(options);
+ if (!isAllowed()) {
+ m_startRequestPermissionNotifier = notifier;
+ requestPermission();
+ return true;
+ }
+
if (!m_frame)
return false;
@@ -610,7 +635,7 @@ bool Geolocation::startUpdating(PositionOptions* options)
page->geolocationController()->addObserver(this);
return true;
#else
- return m_service->startUpdating(options);
+ return m_service->startUpdating(notifier->options);
#endif
}
diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h
index 077a695..0db37e4 100644
--- a/WebCore/page/Geolocation.h
+++ b/WebCore/page/Geolocation.h
@@ -145,7 +145,7 @@ private:
void requestPermission();
- bool startUpdating(PositionOptions*);
+ bool startUpdating(GeoNotifier*);
void stopUpdating();
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
@@ -173,6 +173,8 @@ private:
Frame* m_frame;
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
OwnPtr<GeolocationService> m_service;
+#else
+ RefPtr<GeoNotifier> m_startRequestPermissionNotifier;
#endif
RefPtr<Geoposition> m_lastPosition;
RefPtr<Geoposition> m_currentPosition;