Changeset 73724 in webkit


Ignore:
Timestamp:
Dec 10, 2010 7:11:54 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-10 John Knottenbelt <jknotten@chromium.org>

Reviewed by Steve Block.

[chromium] Implement client based geolocation bindings
https://bugs.webkit.org/show_bug.cgi?id=45752

Implements the necessary plumbing to expose client-based geolocation in Chromium
webkit. The plan is to remove the non-client-based geolocation code (GeolocationService*)
in the future.

  • WebKit.gyp:
  • public/WebGeolocationClient.h: Added. (WebKit::WebGeolocationClient::~WebGeolocationClient):
  • public/WebGeolocationController.h: Added. (WebKit::WebGeolocationController::WebGeolocationController): (WebKit::WebGeolocationController::reset):
  • public/WebGeolocationError.h:
  • public/WebGeolocationPermissionRequest.h: Added. (WebKit::WebGeolocationPermissionRequest::WebGeolocationPermissionRequest): (WebKit::WebGeolocationPermissionRequest::geolocation):
  • public/WebGeolocationPermissionRequestManager.h: Added. (WebKit::WebGeolocationPermissionRequestManager::WebGeolocationPermissionRequestManager): (WebKit::WebGeolocationPermissionRequestManager::~WebGeolocationPermissionRequestManager):
  • public/WebGeolocationPosition.h:
  • public/WebViewClient.h: (WebKit::WebViewClient::geolocationClient):
  • src/ChromeClientImpl.cpp: (WebKit::ChromeClientImpl::requestGeolocationPermissionForFrame): (WebKit::ChromeClientImpl::cancelGeolocationPermissionRequestForFrame):
  • src/GeolocationClientProxy.cpp: Added. (WebKit::GeolocationClientProxy::GeolocationClientProxy): (WebKit::GeolocationClientProxy::~GeolocationClientProxy): (WebKit::GeolocationClientProxy::setController): (WebKit::GeolocationClientProxy::geolocationDestroyed): (WebKit::GeolocationClientProxy::startUpdating): (WebKit::GeolocationClientProxy::stopUpdating): (WebKit::GeolocationClientProxy::setEnableHighAccuracy): (WebKit::GeolocationClientProxy::lastPosition): (WebKit::GeolocationClientProxy::requestPermission): (WebKit::GeolocationClientProxy::cancelPermissionRequest):
  • src/GeolocationClientProxy.h: Added.
  • src/WebGeolocationController.cpp: Added. (WebKit::WebGeolocationController::positionChanged): (WebKit::WebGeolocationController::errorOccurred): (WebKit::WebGeolocationController::controller):
  • src/WebGeolocationPermissionRequest.cpp: Added. (WebKit::WebGeolocationPermissionRequest::securityOrigin): (WebKit::WebGeolocationPermissionRequest::setIsAllowed):
  • src/WebGeolocationPermissionRequestManager.cpp: Added. (WebGeolocationPermissionRequestManager::add): (WebGeolocationPermissionRequestManager::remove): (WebGeolocationPermissionRequestManager::init): (WebGeolocationPermissionRequestManager::reset):
  • src/WebViewImpl.cpp: (WebKit::WebViewImpl::WebViewImpl):
  • src/WebViewImpl.h:
Location:
trunk/WebKit/chromium
Files:
2 added
8 edited
7 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r73697 r73724  
     12010-12-10  John Knottenbelt  <jknotten@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        [chromium] Implement client based geolocation bindings
     6        https://bugs.webkit.org/show_bug.cgi?id=45752
     7
     8        Implements the necessary plumbing to expose client-based geolocation in Chromium
     9        webkit. The plan is to remove the non-client-based geolocation code (GeolocationService*)
     10        in the future.
     11
     12        * WebKit.gyp:
     13        * public/WebGeolocationClient.h: Added.
     14        (WebKit::WebGeolocationClient::~WebGeolocationClient):
     15        * public/WebGeolocationController.h: Added.
     16        (WebKit::WebGeolocationController::WebGeolocationController):
     17        (WebKit::WebGeolocationController::reset):
     18        * public/WebGeolocationError.h:
     19        * public/WebGeolocationPermissionRequest.h: Added.
     20        (WebKit::WebGeolocationPermissionRequest::WebGeolocationPermissionRequest):
     21        (WebKit::WebGeolocationPermissionRequest::geolocation):
     22        * public/WebGeolocationPermissionRequestManager.h: Added.
     23        (WebKit::WebGeolocationPermissionRequestManager::WebGeolocationPermissionRequestManager):
     24        (WebKit::WebGeolocationPermissionRequestManager::~WebGeolocationPermissionRequestManager):
     25        * public/WebGeolocationPosition.h:
     26        * public/WebViewClient.h:
     27        (WebKit::WebViewClient::geolocationClient):
     28        * src/ChromeClientImpl.cpp:
     29        (WebKit::ChromeClientImpl::requestGeolocationPermissionForFrame):
     30        (WebKit::ChromeClientImpl::cancelGeolocationPermissionRequestForFrame):
     31        * src/GeolocationClientProxy.cpp: Added.
     32        (WebKit::GeolocationClientProxy::GeolocationClientProxy):
     33        (WebKit::GeolocationClientProxy::~GeolocationClientProxy):
     34        (WebKit::GeolocationClientProxy::setController):
     35        (WebKit::GeolocationClientProxy::geolocationDestroyed):
     36        (WebKit::GeolocationClientProxy::startUpdating):
     37        (WebKit::GeolocationClientProxy::stopUpdating):
     38        (WebKit::GeolocationClientProxy::setEnableHighAccuracy):
     39        (WebKit::GeolocationClientProxy::lastPosition):
     40        (WebKit::GeolocationClientProxy::requestPermission):
     41        (WebKit::GeolocationClientProxy::cancelPermissionRequest):
     42        * src/GeolocationClientProxy.h: Added.
     43        * src/WebGeolocationController.cpp: Added.
     44        (WebKit::WebGeolocationController::positionChanged):
     45        (WebKit::WebGeolocationController::errorOccurred):
     46        (WebKit::WebGeolocationController::controller):
     47        * src/WebGeolocationPermissionRequest.cpp: Added.
     48        (WebKit::WebGeolocationPermissionRequest::securityOrigin):
     49        (WebKit::WebGeolocationPermissionRequest::setIsAllowed):
     50        * src/WebGeolocationPermissionRequestManager.cpp: Added.
     51        (WebGeolocationPermissionRequestManager::add):
     52        (WebGeolocationPermissionRequestManager::remove):
     53        (WebGeolocationPermissionRequestManager::init):
     54        (WebGeolocationPermissionRequestManager::reset):
     55        * src/WebViewImpl.cpp:
     56        (WebKit::WebViewImpl::WebViewImpl):
     57        * src/WebViewImpl.h:
     58
    1592010-12-10  Hans Wennborg  <hans@chromium.org>
    260
  • trunk/WebKit/chromium/WebKit.gyp

    r72794 r73724  
    174174                'public/WebFormControlElement.h',
    175175                'public/WebFormElement.h',
     176                'public/WebGeolocationClient.h',
     177                'public/WebGeolocationController.h',
    176178                'public/WebGeolocationError.h',
     179                'public/WebGeolocationPermissionRequest.h',
     180                'public/WebGeolocationPermissionRequestManager.h',
    177181                'public/WebGeolocationPosition.h',
    178182                'public/WebGeolocationService.h',
     
    340344                'src/FrameLoaderClientImpl.h',
    341345                'src/FrameNetworkingContextImpl.h',
     346                'src/GeolocationClientProxy.cpp',
     347                'src/GeolocationClientProxy.h',
    342348                'src/GraphicsContext3DChromium.cpp',
    343349                'src/GraphicsContext3DInternal.h',
     
    445451                'src/WebFrameImpl.cpp',
    446452                'src/WebFrameImpl.h',
     453                'src/WebGeolocationController.cpp',
    447454                'src/WebGeolocationError.cpp',
     455                'src/WebGeolocationPermissionRequest.cpp',
     456                'src/WebGeolocationPermissionRequestManager.cpp',
    448457                'src/WebGeolocationPosition.cpp',
    449458                'src/WebGeolocationServiceBridgeImpl.cpp',
     
    672681                }, {
    673682                   'sources/': [
     683                        ['exclude', 'GeolocationClientProxy.*'],
     684                        ['exclude', 'WebGeolocationClient.*'],
     685                        ['exclude', 'WebGeolocationController.*'],
    674686                        ['exclude', 'WebGeolocationError.*'],
     687                        ['exclude', 'WebGeolocationPermissionRequest.*'],
    675688                        ['exclude', 'WebGeolocationPosition.*'],
    676689                   ],
  • trunk/WebKit/chromium/public/WebGeolocationClient.h

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
    28 
    29 #include "WebCommon.h"
    30 #include "WebPrivatePtr.h"
    31 
    32 #if WEBKIT_IMPLEMENTATION
    33 #include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     26#ifndef WebGeolocationClient_h
     27#define WebGeolocationClient_h
    3628
    3729namespace WebKit {
     30class WebGeolocationController;
     31class WebGeolocationPermissionRequest;
     32class WebGeolocationPosition;
    3833
    39 class WebString;
     34class WebGeolocationClient {
     35public:
     36    virtual ~WebGeolocationClient() {}
    4037
    41 class WebGeolocationError {
    42 public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
     38    virtual void startUpdating() = 0;
     39    virtual void stopUpdating() = 0;
     40    virtual void setEnableHighAccuracy(bool) = 0;
     41    virtual void geolocationDestroyed() = 0;
     42    virtual bool lastPosition(WebGeolocationPosition&) = 0;
    4743
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
     44    virtual void requestPermission(const WebGeolocationPermissionRequest&) = 0;
     45    virtual void cancelPermissionRequest(const WebGeolocationPermissionRequest&) = 0;
    5146
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
    54     WEBKIT_API void reset();
    55 
    56 #if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
    60 #endif
    61 
    62 private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
     47    // The controller is valid until geolocationDestroyed() is invoked.
     48    // Ownership of the WebGeolocationController is transferred to the client.
     49    virtual void setController(WebGeolocationController*) = 0;
    6450};
    6551
    6652} // namespace WebKit
    6753
    68 #endif // WebGeolocationError_h
     54#endif // WebGeolocationClient_h
  • trunk/WebKit/chromium/public/WebGeolocationController.h

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
     26#ifndef WebGeolocationController_h
     27#define WebGeolocationController_h
    2828
    2929#include "WebCommon.h"
    30 #include "WebPrivatePtr.h"
     30#include "WebNonCopyable.h"
    3131
    32 #if WEBKIT_IMPLEMENTATION
    33 #include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     32namespace WebCore { class GeolocationController; }
    3633
    3734namespace WebKit {
    3835
    39 class WebString;
     36class WebGeolocationPosition;
     37class WebGeolocationError;
    4038
    41 class WebGeolocationError {
     39// Note that the WebGeolocationController is invalid after the
     40// WebGeolocationClient::geolocationDestroyed() has been received.
     41class WebGeolocationController : public WebNonCopyable {
    4242public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
    47 
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
    51 
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
    54     WEBKIT_API void reset();
     43    WEBKIT_API void positionChanged(const WebGeolocationPosition&);
     44    WEBKIT_API void errorOccurred(const WebGeolocationError&);
    5545
    5646#if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
     47    WebGeolocationController(WebCore::GeolocationController* c)
     48        : m_private(c)
     49    {
     50    }
     51
     52    WebCore::GeolocationController* controller() const { return m_private; }
    6053#endif
    6154
    6255private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
     56    // No implementation for the default constructor. Declared private to ensure that no instances
     57    // can be created by the consumers of Chromium WebKit.
     58    WebGeolocationController();
     59
     60    WebCore::GeolocationController* m_private;
    6461};
    6562
    6663} // namespace WebKit
    6764
    68 #endif // WebGeolocationError_h
     65#endif // WebGeolocationController_h
  • trunk/WebKit/chromium/public/WebGeolocationError.h

    r72624 r73724  
    3232#if WEBKIT_IMPLEMENTATION
    3333#include <wtf/PassRefPtr.h>
     34#endif
     35
    3436namespace WebCore { class GeolocationError; }
    35 #endif
    3637
    3738namespace WebKit {
  • trunk/WebKit/chromium/public/WebGeolocationPermissionRequest.h

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
     26#ifndef WebGeolocationPermissionRequest_h
     27#define WebGeolocationPermissionRequest_h
    2828
    2929#include "WebCommon.h"
    3030#include "WebPrivatePtr.h"
    3131
    32 #if WEBKIT_IMPLEMENTATION
    33 #include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     32namespace WebCore {
     33class Geolocation;
     34}
    3635
    3736namespace WebKit {
     37class WebSecurityOrigin;
    3838
    39 class WebString;
    40 
    41 class WebGeolocationError {
     39// WebGeolocationPermissionRequest encapsulates a WebCore Geolocation object and represents
     40// a request from WebCore for permission to be determined for that Geolocation object.
     41// The underlying Geolocation object is guaranteed to be valid until the invocation of
     42// either  WebGeolocationPermissionRequest::setIsAllowed (request complete) or
     43// WebGeolocationClient::cancelPermissionRequest (request cancelled).
     44class WebGeolocationPermissionRequest {
    4245public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
    47 
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
    51 
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
    54     WEBKIT_API void reset();
     46    WEBKIT_API WebSecurityOrigin securityOrigin() const;
     47    WEBKIT_API void setIsAllowed(bool);
    5548
    5649#if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
     50    WebGeolocationPermissionRequest(WebCore::Geolocation* geolocation)
     51        : m_private(geolocation)
     52    {
     53    }
     54
     55    WebCore::Geolocation* geolocation() const { return m_private; }
    6056#endif
    6157
    6258private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
     59    WebCore::Geolocation* m_private;
    6460};
     61}
    6562
    66 } // namespace WebKit
    67 
    68 #endif // WebGeolocationError_h
     63#endif // WebGeolocationPermissionRequest_h
  • trunk/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
     26#ifndef WebGeolocationPermissionRequestManager_h
     27#define WebGeolocationPermissionRequestManager_h
    2828
    29 #include "WebCommon.h"
    30 #include "WebPrivatePtr.h"
    31 
    32 #if WEBKIT_IMPLEMENTATION
    33 #include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     29#include "WebNonCopyable.h"
     30#include "WebPrivateOwnPtr.h"
    3631
    3732namespace WebKit {
    3833
    39 class WebString;
     34class WebGeolocationPermissionRequest;
     35class WebGeolocationPermissionRequestManagerPrivate;
    4036
    41 class WebGeolocationError {
     37// This class is used to map between integer identifiers and WebGeolocationPermissionRequest
     38// instances. The intended usage is that on WebGeolocationClient::requestPermission(),
     39// the implementer can call add() to associate an id with the WebGeolocationPermissionRequest object.
     40// Once the permission request has been decided, the second remove() method can be used to
     41// find the request. On WebGeolocationClient::cancelPermissionRequest, the first remove() method will
     42// remove the association with the id.
     43class WebGeolocationPermissionRequestManager : public WebNonCopyable {
    4244public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
     45    WebGeolocationPermissionRequestManager() { init(); }
     46    ~WebGeolocationPermissionRequestManager() { reset(); }
    4747
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
     48    WEBKIT_API int add(const WebKit::WebGeolocationPermissionRequest&);
     49    WEBKIT_API bool remove(const WebKit::WebGeolocationPermissionRequest&, int&);
     50    WEBKIT_API bool remove(int, WebKit::WebGeolocationPermissionRequest&);
    5151
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
     52private:
     53    WEBKIT_API void init();
    5454    WEBKIT_API void reset();
    5555
    56 #if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
    60 #endif
    61 
    62 private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
     56    WebPrivateOwnPtr<WebGeolocationPermissionRequestManagerPrivate> m_private;
     57    int m_lastId;
    6458};
    6559
    66 } // namespace WebKit
     60}
    6761
    68 #endif // WebGeolocationError_h
     62#endif // WebGeolocationPermissionRequestManager_h
     63
  • trunk/WebKit/chromium/public/WebGeolocationPosition.h

    r72624 r73724  
    3232#if WEBKIT_IMPLEMENTATION
    3333#include <wtf/PassRefPtr.h>
     34#endif
     35
    3436namespace WebCore { class GeolocationPosition; }
    35 #endif
    3637
    3738namespace WebKit {
  • trunk/WebKit/chromium/public/WebViewClient.h

    r72001 r73724  
    5353class WebFileChooserCompletion;
    5454class WebFrame;
     55class WebGeolocationClient;
    5556class WebGeolocationService;
    5657class WebImage;
     
    341342    // Geolocation ---------------------------------------------------------
    342343
    343     // Access the embedder API for geolocation services.
     344    // Access the embedder API for (client-based) geolocation client .
     345    virtual WebGeolocationClient* geolocationClient() { return 0; }
     346    // Access the embedder API for (non-client-based) geolocation services.
    344347    virtual WebGeolocationService* geolocationService() { return 0; }
    345348
  • trunk/WebKit/chromium/src/ChromeClientImpl.cpp

    r73055 r73724  
    777777#endif
    778778
     779// FIXME: Remove ChromeClientImpl::requestGeolocationPermissionForFrame and ChromeClientImpl::cancelGeolocationPermissionRequestForFrame
     780// once all ports have moved to client-based geolocation (see https://bugs.webkit.org/show_bug.cgi?id=40373 ).
     781// For client-based geolocation, these methods are now implemented as WebGeolocationClient::requestPermission and WebGeolocationClient::cancelPermissionRequest.
     782// (see https://bugs.webkit.org/show_bug.cgi?id=50061 ).
    779783void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
    780784{
    781 #if ENABLE(CLIENT_BASED_GEOLOCATION)
    782     // FIXME: Implement Client-based Geolocation Permissions
    783 #else
     785#if !ENABLE(CLIENT_BASED_GEOLOCATION)
    784786    GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService());
    785787    geolocationService->geolocationServiceBridge()->attachBridgeIfNeeded();
     
    790792void ChromeClientImpl::cancelGeolocationPermissionRequestForFrame(Frame* frame, Geolocation* geolocation)
    791793{
    792 #if ENABLE(CLIENT_BASED_GEOLOCATION)
    793     // FIXME: Implement Client-based Geolocation Permissions
    794 #else
     794#if !ENABLE(CLIENT_BASED_GEOLOCATION)
    795795    GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService());
    796796    m_webView->client()->geolocationService()->cancelPermissionRequestForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url());
  • trunk/WebKit/chromium/src/GeolocationClientProxy.h

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
     26#ifndef GeolocationClientProxy_h
     27#define GeolocationClientProxy_h
    2828
    29 #include "WebCommon.h"
    30 #include "WebPrivatePtr.h"
     29#include "GeolocationClient.h"
     30#include "WebGeolocationController.h"
     31#include <wtf/RefPtr.h>
    3132
    32 #if WEBKIT_IMPLEMENTATION
    33 #include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     33namespace WebCore {
     34class GeolocationPosition;
     35}
    3636
    3737namespace WebKit {
     38class WebGeolocationClient;
    3839
    39 class WebString;
     40class GeolocationClientProxy : public WebCore::GeolocationClient {
     41public:
     42    GeolocationClientProxy(WebGeolocationClient* client);
     43    ~GeolocationClientProxy();
     44    void setController(WebCore::GeolocationController *controller);
     45    virtual void geolocationDestroyed();
     46    virtual void startUpdating();
     47    virtual void stopUpdating();
     48    virtual void setEnableHighAccuracy(bool);
     49    virtual WebCore::GeolocationPosition* lastPosition();
    4050
    41 class WebGeolocationError {
    42 public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
    47 
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
    51 
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
    54     WEBKIT_API void reset();
    55 
    56 #if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
    60 #endif
     51    virtual void requestPermission(WebCore::Geolocation*);
     52    virtual void cancelPermissionRequest(WebCore::Geolocation*);
    6153
    6254private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
     55    WebGeolocationClient* m_client;
     56    RefPtr<WebCore::GeolocationPosition> m_lastPosition;
    6457};
    6558
    6659} // namespace WebKit
    6760
    68 #endif // WebGeolocationError_h
     61#endif // GeolocationClientProxy_h
  • trunk/WebKit/chromium/src/WebGeolocationController.cpp

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
     26#include "config.h"
     27#include "WebGeolocationController.h"
    2828
    29 #include "WebCommon.h"
    30 #include "WebPrivatePtr.h"
     29#include "GeolocationController.h"
     30#include "GeolocationError.h"
     31#include "GeolocationPosition.h"
     32#include "WebGeolocationError.h"
     33#include "WebGeolocationPosition.h"
    3134
    32 #if WEBKIT_IMPLEMENTATION
    3335#include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     36#include <wtf/RefPtr.h>
     37
     38using namespace WebCore;
    3639
    3740namespace WebKit {
    3841
    39 class WebString;
     42void WebGeolocationController::positionChanged(const WebGeolocationPosition& webPosition)
     43{
     44    m_private->positionChanged(PassRefPtr<GeolocationPosition>(webPosition).get());
     45}
    4046
    41 class WebGeolocationError {
    42 public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
    47 
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
    51 
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
    54     WEBKIT_API void reset();
    55 
    56 #if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
    60 #endif
    61 
    62 private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
    64 };
     47void WebGeolocationController::errorOccurred(const WebGeolocationError& webError)
     48{
     49    m_private->errorOccurred(PassRefPtr<GeolocationError>(webError).get());
     50}
    6551
    6652} // namespace WebKit
    67 
    68 #endif // WebGeolocationError_h
  • trunk/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp

    r73723 r73724  
    2424 */
    2525
    26 #ifndef WebGeolocationError_h
    27 #define WebGeolocationError_h
     26#include "config.h"
     27#include "WebGeolocationPermissionRequest.h"
    2828
    29 #include "WebCommon.h"
    30 #include "WebPrivatePtr.h"
     29#include "Document.h"
     30#include "Frame.h"
     31#include "Geolocation.h"
     32#include "WebSecurityOrigin.h"
     33#include "WebURL.h"
    3134
    32 #if WEBKIT_IMPLEMENTATION
    33 #include <wtf/PassRefPtr.h>
    34 namespace WebCore { class GeolocationError; }
    35 #endif
     35using namespace WebCore;
    3636
    3737namespace WebKit {
    3838
    39 class WebString;
     39WebSecurityOrigin WebGeolocationPermissionRequest::securityOrigin() const
     40{
     41    return WebSecurityOrigin::create(m_private->frame()->document()->url());
     42}
    4043
    41 class WebGeolocationError {
    42 public:
    43     enum Error {
    44         ErrorPermissionDenied,
    45         ErrorPositionUnavailable
    46     };
     44void WebGeolocationPermissionRequest::setIsAllowed(bool allowed)
     45{
     46    m_private->setIsAllowed(allowed);
     47}
    4748
    48     WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
    49     WebGeolocationError(const WebGeolocationError& other) { assign(other); }
    50     ~WebGeolocationError() { reset(); }
    51 
    52     WEBKIT_API void assign(Error code, const WebString& message);
    53     WEBKIT_API void assign(const WebGeolocationError&);
    54     WEBKIT_API void reset();
    55 
    56 #if WEBKIT_IMPLEMENTATION
    57     WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
    58     WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
    59     operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
    60 #endif
    61 
    62 private:
    63     WebPrivatePtr<WebCore::GeolocationError> m_private;
    64 };
    65 
    66 } // namespace WebKit
    67 
    68 #endif // WebGeolocationError_h
     49}
  • trunk/WebKit/chromium/src/WebViewImpl.cpp

    r73436 r73724  
    6060#include "FrameTree.h"
    6161#include "FrameView.h"
     62#include "GeolocationClientProxy.h"
    6263#include "GraphicsContext.h"
    6364#include "GraphicsContext3D.h"
     
    311312#endif
    312313    , m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0))
     314#if ENABLE(CLIENT_BASED_GEOLOCATION)
     315    , m_geolocationClientProxy(new GeolocationClientProxy(client ? client->geolocationClient() : 0))
     316#endif
    313317{
    314318    // WebKit/win/WebView.cpp does the same thing, except they call the
     
    334338#endif
    335339    pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get();
     340#if ENABLE(CLIENT_BASED_GEOLOCATION)
     341    pageClients.geolocationClient = m_geolocationClientProxy.get();
     342#endif
    336343
    337344    m_page.set(new Page(pageClients));
     345
     346#if ENABLE(CLIENT_BASED_GEOLOCATION)
     347    m_geolocationClientProxy->setController(m_page->geolocationController());
     348#endif
    338349
    339350    static_cast<BackForwardListImpl*>(m_page->backForwardList())->setClient(&m_backForwardListClientImpl);
  • trunk/WebKit/chromium/src/WebViewImpl.h

    r70863 r73724  
    7474class DeviceOrientationClientProxy;
    7575class DragScrollTimer;
     76class GeolocationClientProxy;
    7677class SpeechInputClientImpl;
    7778class WebAccessibilityObject;
     
    556557    RefPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
    557558    OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
     559
     560#if ENABLE(CLIENT_BASED_GEOLOCATION)
     561    OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
     562#endif
    558563};
    559564
Note: See TracChangeset for help on using the changeset viewer.