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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a605c8fe
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:
2010-12-10 Hans Wennborg <hans@chromium.org>
Reviewed by Jeremy Orlow.
......
......@@ -173,7 +173,11 @@
'public/WebFontCache.h',
'public/WebFormControlElement.h',
'public/WebFormElement.h',
'public/WebGeolocationClient.h',
'public/WebGeolocationController.h',
'public/WebGeolocationError.h',
'public/WebGeolocationPermissionRequest.h',
'public/WebGeolocationPermissionRequestManager.h',
'public/WebGeolocationPosition.h',
'public/WebGeolocationService.h',
'public/WebGeolocationServiceBridge.h',
......@@ -339,6 +343,8 @@
'src/FrameLoaderClientImpl.cpp',
'src/FrameLoaderClientImpl.h',
'src/FrameNetworkingContextImpl.h',
'src/GeolocationClientProxy.cpp',
'src/GeolocationClientProxy.h',
'src/GraphicsContext3DChromium.cpp',
'src/GraphicsContext3DInternal.h',
'src/gtk/WebFontInfo.cpp',
......@@ -444,7 +450,10 @@
'src/WebFormElement.cpp',
'src/WebFrameImpl.cpp',
'src/WebFrameImpl.h',
'src/WebGeolocationController.cpp',
'src/WebGeolocationError.cpp',
'src/WebGeolocationPermissionRequest.cpp',
'src/WebGeolocationPermissionRequestManager.cpp',
'src/WebGeolocationPosition.cpp',
'src/WebGeolocationServiceBridgeImpl.cpp',
'src/WebGeolocationServiceBridgeImpl.h',
......@@ -671,7 +680,11 @@
],
}, {
'sources/': [
['exclude', 'GeolocationClientProxy.*'],
['exclude', 'WebGeolocationClient.*'],
['exclude', 'WebGeolocationController.*'],
['exclude', 'WebGeolocationError.*'],
['exclude', 'WebGeolocationPermissionRequest.*'],
['exclude', 'WebGeolocationPosition.*'],
],
}]
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebGeolocationClient_h
#define WebGeolocationClient_h
namespace WebKit {
class WebGeolocationController;
class WebGeolocationPermissionRequest;
class WebGeolocationPosition;
class WebGeolocationClient {
public:
virtual ~WebGeolocationClient() {}
virtual void startUpdating() = 0;
virtual void stopUpdating() = 0;
virtual void setEnableHighAccuracy(bool) = 0;
virtual void geolocationDestroyed() = 0;
virtual bool lastPosition(WebGeolocationPosition&) = 0;
virtual void requestPermission(const WebGeolocationPermissionRequest&) = 0;
virtual void cancelPermissionRequest(const WebGeolocationPermissionRequest&) = 0;
// The controller is valid until geolocationDestroyed() is invoked.
// Ownership of the WebGeolocationController is transferred to the client.
virtual void setController(WebGeolocationController*) = 0;
};
} // namespace WebKit
#endif // WebGeolocationClient_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebGeolocationController_h
#define WebGeolocationController_h
#include "WebCommon.h"
#include "WebNonCopyable.h"
namespace WebCore { class GeolocationController; }
namespace WebKit {
class WebGeolocationPosition;
class WebGeolocationError;
// Note that the WebGeolocationController is invalid after the
// WebGeolocationClient::geolocationDestroyed() has been received.
class WebGeolocationController : public WebNonCopyable {
public:
WEBKIT_API void positionChanged(const WebGeolocationPosition&);
WEBKIT_API void errorOccurred(const WebGeolocationError&);
#if WEBKIT_IMPLEMENTATION
WebGeolocationController(WebCore::GeolocationController* c)
: m_private(c)
{
}
WebCore::GeolocationController* controller() const { return m_private; }
#endif
private:
// No implementation for the default constructor. Declared private to ensure that no instances
// can be created by the consumers of Chromium WebKit.
WebGeolocationController();
WebCore::GeolocationController* m_private;
};
} // namespace WebKit
#endif // WebGeolocationController_h
......@@ -31,9 +31,10 @@
#if WEBKIT_IMPLEMENTATION
#include <wtf/PassRefPtr.h>
namespace WebCore { class GeolocationError; }
#endif
namespace WebCore { class GeolocationError; }
namespace WebKit {
class WebString;
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebGeolocationPermissionRequest_h
#define WebGeolocationPermissionRequest_h
#include "WebCommon.h"
#include "WebPrivatePtr.h"
namespace WebCore {
class Geolocation;
}
namespace WebKit {
class WebSecurityOrigin;
// WebGeolocationPermissionRequest encapsulates a WebCore Geolocation object and represents
// a request from WebCore for permission to be determined for that Geolocation object.
// The underlying Geolocation object is guaranteed to be valid until the invocation of
// either WebGeolocationPermissionRequest::setIsAllowed (request complete) or
// WebGeolocationClient::cancelPermissionRequest (request cancelled).
class WebGeolocationPermissionRequest {
public:
WEBKIT_API WebSecurityOrigin securityOrigin() const;
WEBKIT_API void setIsAllowed(bool);
#if WEBKIT_IMPLEMENTATION
WebGeolocationPermissionRequest(WebCore::Geolocation* geolocation)
: m_private(geolocation)
{
}
WebCore::Geolocation* geolocation() const { return m_private; }
#endif
private:
WebCore::Geolocation* m_private;
};
}
#endif // WebGeolocationPermissionRequest_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebGeolocationPermissionRequestManager_h
#define WebGeolocationPermissionRequestManager_h
#include "WebNonCopyable.h"
#include "WebPrivateOwnPtr.h"
namespace WebKit {
class WebGeolocationPermissionRequest;
class WebGeolocationPermissionRequestManagerPrivate;
// This class is used to map between integer identifiers and WebGeolocationPermissionRequest
// instances. The intended usage is that on WebGeolocationClient::requestPermission(),
// the implementer can call add() to associate an id with the WebGeolocationPermissionRequest object.
// Once the permission request has been decided, the second remove() method can be used to
// find the request. On WebGeolocationClient::cancelPermissionRequest, the first remove() method will
// remove the association with the id.
class WebGeolocationPermissionRequestManager : public WebNonCopyable {
public:
WebGeolocationPermissionRequestManager() { init(); }
~WebGeolocationPermissionRequestManager() { reset(); }
WEBKIT_API int add(const WebKit::WebGeolocationPermissionRequest&);
WEBKIT_API bool remove(const WebKit::WebGeolocationPermissionRequest&, int&);
WEBKIT_API bool remove(int, WebKit::WebGeolocationPermissionRequest&);
private:
WEBKIT_API void init();
WEBKIT_API void reset();
WebPrivateOwnPtr<WebGeolocationPermissionRequestManagerPrivate> m_private;
int m_lastId;
};
}
#endif // WebGeolocationPermissionRequestManager_h
......@@ -31,9 +31,10 @@
#if WEBKIT_IMPLEMENTATION
#include <wtf/PassRefPtr.h>
namespace WebCore { class GeolocationPosition; }
#endif
namespace WebCore { class GeolocationPosition; }
namespace WebKit {
class WebGeolocationPosition {
......
......@@ -52,6 +52,7 @@ class WebExternalPopupMenu;
class WebExternalPopupMenuClient;
class WebFileChooserCompletion;
class WebFrame;
class WebGeolocationClient;
class WebGeolocationService;
class WebImage;
class WebInputElement;
......@@ -340,7 +341,9 @@ public:
// Geolocation ---------------------------------------------------------
// Access the embedder API for geolocation services.
// Access the embedder API for (client-based) geolocation client .
virtual WebGeolocationClient* geolocationClient() { return 0; }
// Access the embedder API for (non-client-based) geolocation services.
virtual WebGeolocationService* geolocationService() { return 0; }
// Speech --------------------------------------------------------------
......
......@@ -776,11 +776,13 @@ NotificationPresenter* ChromeClientImpl::notificationPresenter() const
}
#endif
// FIXME: Remove ChromeClientImpl::requestGeolocationPermissionForFrame and ChromeClientImpl::cancelGeolocationPermissionRequestForFrame
// once all ports have moved to client-based geolocation (see https://bugs.webkit.org/show_bug.cgi?id=40373 ).
// For client-based geolocation, these methods are now implemented as WebGeolocationClient::requestPermission and WebGeolocationClient::cancelPermissionRequest.
// (see https://bugs.webkit.org/show_bug.cgi?id=50061 ).
void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
#if ENABLE(CLIENT_BASED_GEOLOCATION)
// FIXME: Implement Client-based Geolocation Permissions
#else
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService());
geolocationService->geolocationServiceBridge()->attachBridgeIfNeeded();
m_webView->client()->geolocationService()->requestPermissionForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url());
......@@ -789,9 +791,7 @@ void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geoloc
void ChromeClientImpl::cancelGeolocationPermissionRequestForFrame(Frame* frame, Geolocation* geolocation)
{
#if ENABLE(CLIENT_BASED_GEOLOCATION)
// FIXME: Implement Client-based Geolocation Permissions
#else
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService());
m_webView->client()->geolocationService()->cancelPermissionRequestForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url());
#endif
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "GeolocationClientProxy.h"
#include "Geolocation.h"
#include "GeolocationPosition.h"
#include "WebGeolocationClient.h"
#include "WebGeolocationController.h"
#include "WebGeolocationPermissionRequest.h"
#include "WebGeolocationPosition.h"
namespace WebKit {
GeolocationClientProxy::GeolocationClientProxy(WebGeolocationClient* client)
: m_client(client)
{
}
GeolocationClientProxy::~GeolocationClientProxy()
{
}
void GeolocationClientProxy::setController(WebCore::GeolocationController* controller)
{
// We support there not being a client, provided we don't do any Geolocation.
if (m_client) {
// Ownership of the WebGeolocationController is transferred to the client.
m_client->setController(new WebGeolocationController(controller));
}
}
void GeolocationClientProxy::geolocationDestroyed()
{
m_client->geolocationDestroyed();
}
void GeolocationClientProxy::startUpdating()
{
m_client->startUpdating();
}
void GeolocationClientProxy::stopUpdating()
{
m_client->stopUpdating();
}
void GeolocationClientProxy::setEnableHighAccuracy(bool highAccuracy)
{
m_client->setEnableHighAccuracy(highAccuracy);
}
WebCore::GeolocationPosition* GeolocationClientProxy::lastPosition()
{
WebGeolocationPosition webPosition;
if (m_client->lastPosition(webPosition))
m_lastPosition = webPosition;
else
m_lastPosition.clear();
return m_lastPosition.get();
}
void GeolocationClientProxy::requestPermission(WebCore::Geolocation* geolocation)
{
m_client->requestPermission(WebGeolocationPermissionRequest(geolocation));
}
void GeolocationClientProxy::cancelPermissionRequest(WebCore::Geolocation* geolocation)
{
m_client->cancelPermissionRequest(WebGeolocationPermissionRequest(geolocation));
}
}
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GeolocationClientProxy_h
#define GeolocationClientProxy_h
#include "GeolocationClient.h"
#include "WebGeolocationController.h"
#include <wtf/RefPtr.h>
namespace WebCore {
class GeolocationPosition;
}
namespace WebKit {
class WebGeolocationClient;
class GeolocationClientProxy : public WebCore::GeolocationClient {
public:
GeolocationClientProxy(WebGeolocationClient* client);
~GeolocationClientProxy();
void setController(WebCore::GeolocationController *controller);
virtual void geolocationDestroyed();
virtual void startUpdating();
virtual void stopUpdating();
virtual void setEnableHighAccuracy(bool);
virtual WebCore::GeolocationPosition* lastPosition();
virtual void requestPermission(WebCore::Geolocation*);
virtual void cancelPermissionRequest(WebCore::Geolocation*);
private:
WebGeolocationClient* m_client;
RefPtr<WebCore::GeolocationPosition> m_lastPosition;
};
} // namespace WebKit
#endif // GeolocationClientProxy_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "WebGeolocationController.h"
#include "GeolocationController.h"
#include "GeolocationError.h"
#include "GeolocationPosition.h"
#include "WebGeolocationError.h"
#include "WebGeolocationPosition.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
using namespace WebCore;
namespace WebKit {
void WebGeolocationController::positionChanged(const WebGeolocationPosition& webPosition)
{
m_private->positionChanged(PassRefPtr<GeolocationPosition>(webPosition).get());
}
void WebGeolocationController::errorOccurred(const WebGeolocationError& webError)
{
m_private->errorOccurred(PassRefPtr<GeolocationError>(webError).get());
}
} // namespace WebKit
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "WebGeolocationPermissionRequest.h"
#include "Document.h"
#include "Frame.h"
#include "Geolocation.h"
#include "WebSecurityOrigin.h"
#include "WebURL.h"
using namespace WebCore;
namespace WebKit {