Changeset 54883 in webkit


Ignore:
Timestamp:
Feb 17, 2010 4:00:15 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-02-17 Marcus Bulach <bulach@chromium.org>

Reviewed by Jeremy Orlow.

Implements GeolocationServices for Chromium.
https://bugs.webkit.org/show_bug.cgi?id=32068

This is part of implementing Geolocation framework for Chromium. Existing layout tests should pass.

  • WebCore.gypi:
  • page/Geolocation.h:
  • platform/GeolocationService.h:
Location:
trunk
Files:
3 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54881 r54883  
     12010-02-17  Marcus Bulach  <bulach@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Implements GeolocationServices for Chromium.
     6        https://bugs.webkit.org/show_bug.cgi?id=32068
     7
     8        This is part of implementing Geolocation framework for Chromium. Existing layout tests should pass.
     9
     10        * WebCore.gypi:
     11        * page/Geolocation.h:
     12        * platform/GeolocationService.h:
     13
    1142010-02-17  Steve Block  <steveblock@google.com>
    215
  • trunk/WebCore/WebCore.gypi

    r54820 r54883  
    19261926            'platform/chromium/FramelessScrollViewClient.h',
    19271927            'platform/chromium/GeolocationServiceChromium.cpp',
     1928            'platform/chromium/GeolocationServiceChromium.h',
    19281929            'platform/chromium/KeyCodeConversion.h',
    19291930            'platform/chromium/KeyCodeConversionGtk.cpp',
  • trunk/WebCore/page/Geolocation.h

    r54079 r54883  
    7979    void setShouldClearCache(bool shouldClearCache) { m_shouldClearCache = shouldClearCache; }
    8080    bool shouldClearCache() const { return m_shouldClearCache; }
     81    Frame* frame() const { return m_frame; }
    8182
    8283#if ENABLE(CLIENT_BASED_GEOLOCATION)
    8384    void setPosition(GeolocationPosition*);
    8485    void setError(GeolocationError*);
     86#else
     87    GeolocationService* getGeolocationService() const { return m_service.get(); }
    8588#endif
    8689
  • trunk/WebCore/platform/GeolocationService.cpp

    r53751 r54883  
    2626#include "config.h"
    2727#include "GeolocationService.h"
     28
     29#include "GeolocationServiceMock.h"
    2830#include "Geoposition.h"
    29 #include "GeolocationServiceMock.h"
    3031#include "PositionError.h"
    3132
     33#include <wtf/Assertions.h>
    3234#include <wtf/CurrentTime.h>
    33 #include <wtf/Assertions.h>
    3435
    3536namespace WebCore {
  • trunk/WebCore/platform/GeolocationService.h

    r48144 r54883  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
     
    4747    static GeolocationService* create(GeolocationServiceClient*);
    4848    virtual ~GeolocationService() { }
    49    
     49
    5050    virtual bool startUpdating(PositionOptions*) { return false; }
    5151    virtual void stopUpdating() { }
    52    
     52
    5353    virtual void suspend() { }
    5454    virtual void resume() { }
     
    6464protected:
    6565    GeolocationService(GeolocationServiceClient*);
     66    GeolocationServiceClient* geolocationServiceClient() const { return m_geolocationServiceClient; }
    6667
    6768private:
  • trunk/WebCore/platform/chromium/ChromiumBridge.h

    r54742 r54883  
    5454    class Document;
    5555    class Frame;
     56    class GeolocationServiceBridge;
     57    class GeolocationServiceChromium;
    5658    class GraphicsContext;
    5759    class Image;
     
    118120        static void notifyFormStateChanged(const Document*);
    119121
     122        // Geolocation --------------------------------------------------------
     123        static GeolocationServiceBridge* createGeolocationServiceBridge(GeolocationServiceChromium*);
     124
    120125        // HTML5 DB -----------------------------------------------------------
    121126#if ENABLE(DATABASE)
  • trunk/WebCore/platform/chromium/GeolocationServiceChromium.cpp

    r51660 r54883  
    11/*
    2  * Copyright (c) 2009, Google Inc. All rights reserved.
     2 * Copyright (c) 2010, Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030
    3131#include "config.h"
    32 #include "GeolocationService.h"
     32#include "GeolocationServiceChromium.h"
     33
     34#include "ChromiumBridge.h"
    3335
    3436namespace WebCore {
    3537
    36 class GeolocationServiceChromium : public GeolocationService {
    37 public:
    38     GeolocationServiceChromium(GeolocationServiceClient* c)
    39         : GeolocationService(c)
    40     {
    41     }
    42     // FIXME: Implement. https://bugs.webkit.org/show_bug.cgi?id=32068
    43 };
     38GeolocationServiceChromium::GeolocationServiceChromium(GeolocationServiceClient* c)
     39        : GeolocationService(c),
     40          m_geolocation(reinterpret_cast<Geolocation*>(c)),
     41          m_lastPosition(Geoposition::create(Coordinates::create(0.0, 0.0, false, 0.0, 0.0, false, 0.0, false, 0.0, false, 0.0), 0)),
     42          m_lastError(PositionError::create(PositionError::POSITION_UNAVAILABLE, "")),
     43          m_geolocationServiceBridge(ChromiumBridge::createGeolocationServiceBridge(this))
     44{
     45}
    4446
    45 // This guard is the counterpart of the one in WebCore/platform/GeolocationService.cpp
    46 #if ENABLE(GEOLOCATION)
    47 static GeolocationService* createGeolocationService(GeolocationServiceClient* c)
     47void GeolocationServiceChromium::setIsAllowed(bool allowed)
     48{
     49    m_geolocation->setIsAllowed(allowed); 
     50}
     51
     52void GeolocationServiceChromium::setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp)
     53{
     54    m_lastPosition = Geoposition::create(Coordinates::create(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed), timestamp);
     55    positionChanged();
     56}
     57
     58void GeolocationServiceChromium::setLastError(int errorCode, const String& message)
     59{
     60    m_lastError = PositionError::create(static_cast<PositionError::ErrorCode>(errorCode), message);
     61    errorOccurred();
     62}
     63
     64Frame* GeolocationServiceChromium::frame()
     65{
     66    return m_geolocation->frame();
     67}
     68
     69bool GeolocationServiceChromium::startUpdating(PositionOptions* options)
     70{
     71    return m_geolocationServiceBridge->startUpdating(options);
     72}
     73
     74void GeolocationServiceChromium::stopUpdating()
     75{
     76    return m_geolocationServiceBridge->stopUpdating();
     77}
     78
     79void GeolocationServiceChromium::suspend()
     80{
     81    return m_geolocationServiceBridge->suspend();
     82}
     83
     84void GeolocationServiceChromium::resume()
     85{
     86    return m_geolocationServiceBridge->resume();
     87}
     88
     89Geoposition* GeolocationServiceChromium::lastPosition() const
     90{
     91    return m_lastPosition.get();
     92}
     93
     94PositionError* GeolocationServiceChromium::lastError() const
     95{
     96    return m_lastError.get();
     97}
     98
     99static GeolocationService* createGeolocationServiceChromium(GeolocationServiceClient* c)
    48100{
    49101    return new GeolocationServiceChromium(c);
    50102}
    51103
    52 GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createGeolocationService;
    53 #endif
     104// Sets up the factory function for GeolocationService.
     105GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createGeolocationServiceChromium;
    54106
    55107} // namespace WebCore
  • trunk/WebKit/chromium/WebKit.gyp

    r54742 r54883  
    6969            ],
    7070            'sources': [
     71                'public/GeolocationServiceBridgeChromium.h',
    7172                'public/gtk/WebInputEventFactory.h',
    7273                'public/linux/WebFontRendering.h',
     
    233234                'src/FrameLoaderClientImpl.cpp',
    234235                'src/FrameLoaderClientImpl.h',
     236                'src/GeolocationServiceBridgeChromium.cpp',             
    235237                'src/gtk/WebFontInfo.cpp',
    236238                'src/gtk/WebFontInfo.h',
  • trunk/WebKit/chromium/public/WebViewClient.h

    r54584 r54883  
    4747class WebFileChooserCompletion;
    4848class WebFrame;
     49class WebGeolocationServiceInterface;
    4950class WebNode;
    5051class WebNotificationPresenter;
     
    278279                                           const WebString& value) { }
    279280
     281    // Geolocation ---------------------------------------------------------
     282
     283    // Access the embedder API for geolocation services.
     284    virtual WebKit::WebGeolocationServiceInterface* getGeolocationService() { return 0; }
     285
    280286protected:
    281287    ~WebViewClient() { }
  • trunk/WebKit/chromium/src/ChromeClientImpl.cpp

    r54584 r54883  
    4444#include "FrameLoadRequest.h"
    4545#include "FrameView.h"
     46#include "Geolocation.h"
     47#include "GeolocationService.h"
     48#include "GeolocationServiceBridgeChromium.h"
     49#include "GeolocationServiceChromium.h"
    4650#include "HitTestResult.h"
    4751#include "IntRect.h"
     
    675679#endif
    676680
     681void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
     682{
     683    GeolocationServiceChromium* geolocationService = reinterpret_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService());
     684    m_webView->client()->getGeolocationService()->requestPermissionForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url());
     685}
     686
    677687} // namespace WebKit
  • trunk/WebKit/chromium/src/ChromeClientImpl.h

    r54584 r54883  
    122122    virtual WebCore::NotificationPresenter* notificationPresenter() const;
    123123#endif
    124     virtual void requestGeolocationPermissionForFrame(
    125         WebCore::Frame*, WebCore::Geolocation*) { }
     124    virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
    126125    virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
    127126    virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; }
  • trunk/WebKit/chromium/src/ChromiumBridge.cpp

    r54742 r54883  
    7575#include "Cookie.h"
    7676#include "FrameView.h"
     77#include "GeolocationServiceBridgeChromium.h"
    7778#include "GraphicsContext.h"
    7879#include "KURL.h"
     
    358359#endif
    359360
     361// Geolocation ----------------------------------------------------------------
     362
     363GeolocationServiceBridge* ChromiumBridge::createGeolocationServiceBridge(GeolocationServiceChromium* geolocationServiceChromium)
     364{
     365    return createGeolocationServiceBridgeImpl(geolocationServiceChromium);
     366}
     367
    360368// HTML5 DB -------------------------------------------------------------------
    361369
Note: See TracChangeset for help on using the changeset viewer.