Changeset 47152 in webkit


Ignore:
Timestamp:
Aug 12, 2009 3:08:55 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-08-12 Steve Block <steveblock@google.com>

Reviewed by Eric Seidel.

Bug 26993 : Geolocation::requestPermission()
https://bugs.webkit.org/show_bug.cgi?id=26993

Second patch to allow the Geolocation permission request to chrome to be asynchronous
or synchronous. Fixes a bug where callbacks were called twice when permissions
are granted synchronously.

No new tests required.

  • page/Geolocation.cpp: (WebCore::Geolocation::setIsAllowed): Modified. Calls makeSuccessCallbacks() rather than geolocationServicePositionChanged(). (WebCore::Geolocation::geolocationServicePositionChanged): Modified. Updated logic to avoid repeated callbacks when permissions are granted synchronously. (WebCore::Geolocation::makeSuccessCallbacks): Added. Calls success callbacks.
  • page/Geolocation.h: Modified. Adds makeSuccessCallbacks().
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r47151 r47152  
     12009-08-12  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Bug 26993 : Geolocation::requestPermission()
     6        https://bugs.webkit.org/show_bug.cgi?id=26993
     7
     8        Second patch to allow the Geolocation permission request to chrome to be asynchronous
     9        or synchronous. Fixes a bug where callbacks were called twice when permissions
     10        are granted synchronously.
     11
     12        No new tests required.
     13
     14        * page/Geolocation.cpp:
     15        (WebCore::Geolocation::setIsAllowed): Modified. Calls makeSuccessCallbacks() rather than geolocationServicePositionChanged().
     16        (WebCore::Geolocation::geolocationServicePositionChanged): Modified. Updated logic to avoid repeated callbacks when permissions are granted synchronously.
     17        (WebCore::Geolocation::makeSuccessCallbacks): Added. Calls success callbacks.
     18        * page/Geolocation.h: Modified. Adds makeSuccessCallbacks().
     19
    1202009-08-12  Anders Carlsson  <andersca@apple.com>
    221
  • trunk/WebCore/page/Geolocation.cpp

    r46663 r47152  
    140140    if (isAllowed()) {
    141141        startTimers();
    142         geolocationServicePositionChanged(m_service.get());
     142        makeSuccessCallbacks();
    143143    } else {
    144144        WTF::RefPtr<WebCore::PositionError> error = WebCore::PositionError::create(PositionError::PERMISSION_DENIED, "User disallowed GeoLocation");
     
    271271void Geolocation::geolocationServicePositionChanged(GeolocationService* service)
    272272{
    273     ASSERT(service->lastPosition());
    274    
    275     requestPermission();
    276     if (!isAllowed())
    277         return;
    278    
    279     sendPositionToOneShots(service->lastPosition());
    280     sendPositionToWatchers(service->lastPosition());
     273    ASSERT_UNUSED(service, service == m_service);
     274    ASSERT(m_service->lastPosition());
     275   
     276    if (!isAllowed()) {
     277        // requestPermission() will ask the chrome for permission. This may be
     278        // implemented synchronously or asynchronously. In both cases,
     279        // makeSuccessCallbacks() will be called if permission is granted, so
     280        // there's nothing more to do here.
     281        requestPermission();
     282        return;
     283    }
     284
     285    makeSuccessCallbacks();
     286}
     287
     288void Geolocation::makeSuccessCallbacks()
     289{
     290    ASSERT(m_service->lastPosition());
     291    ASSERT(isAllowed());
     292   
     293    sendPositionToOneShots(m_service->lastPosition());
     294    sendPositionToWatchers(m_service->lastPosition());
    281295       
    282296    m_oneShots.clear();
  • trunk/WebCore/page/Geolocation.h

    r46633 r47152  
    103103    void startTimers();
    104104   
     105    void makeSuccessCallbacks();
    105106    void handleError(PositionError*);
    106107
Note: See TracChangeset for help on using the changeset viewer.