diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-07 07:25:20 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-07 07:25:20 -0700 |
commit | 6d09cb37a17ff64055323f4ab232dbee6c4cd474 (patch) | |
tree | 1dfdecdf87a69e99d8c7ff776cf1a5dea701a27d | |
parent | 767159fd17933d674d0ba0698ab99970de8215a1 (diff) | |
parent | 00bd0fc337f03c8595ccae3a2d3d56c6d8e97cc9 (diff) | |
download | external_webkit-6d09cb37a17ff64055323f4ab232dbee6c4cd474.zip external_webkit-6d09cb37a17ff64055323f4ab232dbee6c4cd474.tar.gz external_webkit-6d09cb37a17ff64055323f4ab232dbee6c4cd474.tar.bz2 |
Merge change 20295
* changes:
Fixes WebKit bug 26993.
-rw-r--r-- | WebCore/page/Geolocation.cpp | 33 | ||||
-rw-r--r-- | WebCore/page/Geolocation.h | 1 |
2 files changed, 24 insertions, 10 deletions
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index 86a7f16..8bfa093 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -140,7 +140,7 @@ void Geolocation::setIsAllowed(bool allowed) if (isAllowed()) { startTimers(); - geolocationServicePositionChanged(m_service.get()); + makeSuccessCallbacks(); } else { WTF::RefPtr<WebCore::PositionError> error = WebCore::PositionError::create(PositionError::PERMISSION_DENIED, "User disallowed GeoLocation"); handleError(error.get()); @@ -264,17 +264,30 @@ void Geolocation::requestPermission() m_allowGeolocation = InProgress; } -void Geolocation::geolocationServicePositionChanged(GeolocationService* service) +void Geolocation::geolocationServicePositionChanged(GeolocationService*) { - ASSERT(service->lastPosition()); - - requestPermission(); - if (!isAllowed()) + ASSERT(m_service->lastPosition()); + + if (!isAllowed()) { + // requestPermission() will ask the chrome for permission. This may be + // implemented synchronously or asynchronously. In both cases, + // makeSucessCallbacks() will be called if permission is granted, so + // there's nothing more to do here. + requestPermission(); return; - - sendPositionToOneShots(service->lastPosition()); - sendPositionToWatchers(service->lastPosition()); - + } + + makeSuccessCallbacks(); +} + +void Geolocation::makeSuccessCallbacks() +{ + ASSERT(m_service->lastPosition()); + ASSERT(isAllowed()); + + sendPositionToOneShots(m_service->lastPosition()); + sendPositionToWatchers(m_service->lastPosition()); + m_oneShots.clear(); if (!hasListeners()) diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h index ae24bdd..44a7fe0 100644 --- a/WebCore/page/Geolocation.h +++ b/WebCore/page/Geolocation.h @@ -99,6 +99,7 @@ private: void startTimersForWatchers(); void startTimers(); + void makeSuccessCallbacks(); void handleError(PositionError*); void requestPermission(); |