[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 18:24:04 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 38560d2b07a0109ba000581dc2019faba8e3a993
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 10 15:11:54 2010 +0000
2010-12-10 John Knottenbelt <jknotten at 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
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 3d8a0e0..8164d6b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,61 @@
+2010-12-10 John Knottenbelt <jknotten at 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 at chromium.org>
Reviewed by Jeremy Orlow.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 01bb092..cbea04d 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -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.*'],
],
}]
diff --git a/WebKit/chromium/public/WebGeolocationClient.h b/WebKit/chromium/public/WebGeolocationClient.h
new file mode 100644
index 0000000..1dfb0cd
--- /dev/null
+++ b/WebKit/chromium/public/WebGeolocationClient.h
@@ -0,0 +1,54 @@
+/*
+ * 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
diff --git a/WebKit/chromium/public/WebGeolocationController.h b/WebKit/chromium/public/WebGeolocationController.h
new file mode 100644
index 0000000..3cddd0f
--- /dev/null
+++ b/WebKit/chromium/public/WebGeolocationController.h
@@ -0,0 +1,65 @@
+/*
+ * 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
diff --git a/WebKit/chromium/public/WebGeolocationError.h b/WebKit/chromium/public/WebGeolocationError.h
index e9354d3..ecb758c 100644
--- a/WebKit/chromium/public/WebGeolocationError.h
+++ b/WebKit/chromium/public/WebGeolocationError.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;
diff --git a/WebKit/chromium/public/WebGeolocationPermissionRequest.h b/WebKit/chromium/public/WebGeolocationPermissionRequest.h
new file mode 100644
index 0000000..8b2f69e
--- /dev/null
+++ b/WebKit/chromium/public/WebGeolocationPermissionRequest.h
@@ -0,0 +1,63 @@
+/*
+ * 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
diff --git a/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h b/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h
new file mode 100644
index 0000000..dfa1642
--- /dev/null
+++ b/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h
@@ -0,0 +1,63 @@
+/*
+ * 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
+
diff --git a/WebKit/chromium/public/WebGeolocationPosition.h b/WebKit/chromium/public/WebGeolocationPosition.h
index de73431..57ba314 100644
--- a/WebKit/chromium/public/WebGeolocationPosition.h
+++ b/WebKit/chromium/public/WebGeolocationPosition.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 {
diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h
index 7ce1483..033e120 100644
--- a/WebKit/chromium/public/WebViewClient.h
+++ b/WebKit/chromium/public/WebViewClient.h
@@ -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 --------------------------------------------------------------
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 7b67ede..28d78d0 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -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
diff --git a/WebKit/chromium/src/GeolocationClientProxy.cpp b/WebKit/chromium/src/GeolocationClientProxy.cpp
new file mode 100644
index 0000000..73a8690
--- /dev/null
+++ b/WebKit/chromium/src/GeolocationClientProxy.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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));
+}
+
+}
diff --git a/WebKit/chromium/src/GeolocationClientProxy.h b/WebKit/chromium/src/GeolocationClientProxy.h
new file mode 100644
index 0000000..ee175dc
--- /dev/null
+++ b/WebKit/chromium/src/GeolocationClientProxy.h
@@ -0,0 +1,61 @@
+/*
+ * 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
diff --git a/WebKit/chromium/src/WebGeolocationController.cpp b/WebKit/chromium/src/WebGeolocationController.cpp
new file mode 100644
index 0000000..12cbaa0
--- /dev/null
+++ b/WebKit/chromium/src/WebGeolocationController.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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
diff --git a/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp b/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp
new file mode 100644
index 0000000..8d8c53e
--- /dev/null
+++ b/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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 {
+
+WebSecurityOrigin WebGeolocationPermissionRequest::securityOrigin() const
+{
+ return WebSecurityOrigin::create(m_private->frame()->document()->url());
+}
+
+void WebGeolocationPermissionRequest::setIsAllowed(bool allowed)
+{
+ m_private->setIsAllowed(allowed);
+}
+
+}
diff --git a/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp b/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp
new file mode 100644
index 0000000..4c0ed9c
--- /dev/null
+++ b/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp
@@ -0,0 +1,95 @@
+/*
+ * 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 "WebGeolocationPermissionRequestManager.h"
+
+#include "WebGeolocationPermissionRequest.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+class Geolocation;
+}
+
+using namespace WebCore;
+
+typedef HashMap<Geolocation*, int> GeolocationIdMap;
+typedef HashMap<int, Geolocation*> IdGeolocationMap;
+
+namespace WebKit {
+class WebGeolocationPermissionRequestManagerPrivate {
+public:
+ GeolocationIdMap m_geolocationIdMap;
+ IdGeolocationMap m_idGeolocationMap;
+};
+}
+
+using namespace WebKit;
+
+int WebGeolocationPermissionRequestManager::add(const WebKit::WebGeolocationPermissionRequest& permissionRequest)
+{
+ Geolocation* geolocation = permissionRequest.geolocation();
+ ASSERT(!m_private->m_geolocationIdMap.contains(geolocation));
+ int id = ++m_lastId;
+ m_private->m_geolocationIdMap.add(geolocation, id);
+ m_private->m_idGeolocationMap.add(id, geolocation);
+ return id;
+}
+
+bool WebGeolocationPermissionRequestManager::remove(const WebKit::WebGeolocationPermissionRequest& permissionRequest, int& id)
+{
+ Geolocation* geolocation = permissionRequest.geolocation();
+ GeolocationIdMap::iterator it = m_private->m_geolocationIdMap.find(geolocation);
+ if (it == m_private->m_geolocationIdMap.end())
+ return false;
+ id = it->second;
+ m_private->m_geolocationIdMap.remove(it);
+ m_private->m_idGeolocationMap.remove(id);
+ return true;
+}
+
+bool WebGeolocationPermissionRequestManager::remove(int id, WebKit::WebGeolocationPermissionRequest& permissionRequest)
+{
+ IdGeolocationMap::iterator it = m_private->m_idGeolocationMap.find(id);
+ if (it == m_private->m_idGeolocationMap.end())
+ return false;
+ Geolocation* geolocation = it->second;
+ permissionRequest = WebGeolocationPermissionRequest(geolocation);
+ m_private->m_idGeolocationMap.remove(it);
+ m_private->m_geolocationIdMap.remove(geolocation);
+ return true;
+}
+
+void WebGeolocationPermissionRequestManager::init()
+{
+ m_lastId = 0;
+ m_private.reset(new WebGeolocationPermissionRequestManagerPrivate);
+}
+
+void WebGeolocationPermissionRequestManager::reset()
+{
+ m_private.reset(0);
+}
+
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 7bec254..49a3d78 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -59,6 +59,7 @@
#include "FrameLoader.h"
#include "FrameTree.h"
#include "FrameView.h"
+#include "GeolocationClientProxy.h"
#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "GraphicsContext3DInternal.h"
@@ -310,6 +311,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
, m_speechInputClient(SpeechInputClientImpl::create(client))
#endif
, m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0))
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ , m_geolocationClientProxy(new GeolocationClientProxy(client ? client->geolocationClient() : 0))
+#endif
{
// WebKit/win/WebView.cpp does the same thing, except they call the
// KJS specific wrapper around this method. We need to have threading
@@ -333,9 +337,16 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
pageClients.speechInputClient = m_speechInputClient.get();
#endif
pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get();
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ pageClients.geolocationClient = m_geolocationClientProxy.get();
+#endif
m_page.set(new Page(pageClients));
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ m_geolocationClientProxy->setController(m_page->geolocationController());
+#endif
+
static_cast<BackForwardListImpl*>(m_page->backForwardList())->setClient(&m_backForwardListClientImpl);
m_page->setGroupName(pageGroupName);
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index 0388770..759a463 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -73,6 +73,7 @@ class AutoFillPopupMenuClient;
class ContextMenuClientImpl;
class DeviceOrientationClientProxy;
class DragScrollTimer;
+class GeolocationClientProxy;
class SpeechInputClientImpl;
class WebAccessibilityObject;
class WebDevToolsAgentClient;
@@ -555,6 +556,10 @@ private:
// early. This member holds on to the GC3D in this case.
RefPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
+#endif
};
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list