[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

weinig at apple.com weinig at apple.com
Sun Feb 20 22:47:21 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 7fb8e5bb992146ff033d24608f82f2e96dadb790
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 11 17:56:06 2011 +0000

    Tools: Roll r75474 back in.
    
    WebKit2: Roll r75460 back in with build fix.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75508 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index c8451e5..a292cb8 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-11  Sam Weinig  <sam at webkit.org>
+
+        Roll r75474 back in.
+
 2011-01-11  Jocelyn Turcotte  <jocelyn.turcotte at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/Tools/MiniBrowser/mac/BrowserWindowController.m b/Tools/MiniBrowser/mac/BrowserWindowController.m
index ad3fcab..e761624 100644
--- a/Tools/MiniBrowser/mac/BrowserWindowController.m
+++ b/Tools/MiniBrowser/mac/BrowserWindowController.m
@@ -637,7 +637,8 @@ static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParameters
         0,          /* didDraw */
         0,          /* pageDidScroll */
         0,          /* exceededDatabaseQuota */
-        runOpenPanel
+        runOpenPanel,
+        0,          /* decidePolicyForGeolocationPermissionRequest */
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
 }
diff --git a/Tools/MiniBrowser/win/BrowserView.cpp b/Tools/MiniBrowser/win/BrowserView.cpp
index a93ca96..b9aaadc 100644
--- a/Tools/MiniBrowser/win/BrowserView.cpp
+++ b/Tools/MiniBrowser/win/BrowserView.cpp
@@ -118,7 +118,8 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
         0,          /* didDraw */
         0,          /* pageDidScroll */
         0,          /* exceededDatabaseQuota */
-        0           /* runOpenPanel */
+        0,          /* runOpenPanel */
+        0,          /* decidePolicyForGeolocationPermissionRequest */
     };
 
     WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient);
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index 3ea46ee..764bd50 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -138,7 +138,8 @@ static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModi
         0, // didDraw
         0, // pageDidScroll
         0, // exceededDatabaseQuota
-        0  // runOpenPanel
+        0, // runOpenPanel
+        0, // decidePolicyForGeolocationPermissionRequest
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient);
 
@@ -242,7 +243,8 @@ void TestController::initialize(int argc, const char* argv[])
         0, // didDraw
         0, // pageDidScroll
         0, // exceededDatabaseQuota
-        0  // runOpenPanel
+        0, // runOpenPanel
+        0, // decidePolicyForGeolocationPermissionRequest
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
 
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 6c90327..aa0bf68 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-11  Sam Weinig  <sam at webkit.org>
+
+        Roll r75460 back in with build fix.
+
 2011-01-11  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit2/Shared/API/c/WKBase.h b/WebKit2/Shared/API/c/WKBase.h
index a0e9dd9..5c29db0 100644
--- a/WebKit2/Shared/API/c/WKBase.h
+++ b/WebKit2/Shared/API/c/WKBase.h
@@ -73,6 +73,7 @@ typedef const struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef
 typedef const struct OpaqueWKFrame* WKFrameRef;
 typedef const struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
 typedef const struct OpaqueWKGeolocationManager* WKGeolocationManagerRef;
+typedef const struct OpaqueWKGeolocationPermissionRequest* WKGeolocationPermissionRequestRef;
 typedef const struct OpaqueWKGeolocationPosition* WKGeolocationPositionRef;
 typedef const struct OpaqueWKInspector* WKInspectorRef;
 typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index 9d3bd04..70ed0ba 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -68,8 +68,9 @@ public:
         TypeFormSubmissionListener,
         TypeFrame,
         TypeFramePolicyListener,
-        TypeGeolocationPosition,
         TypeGeolocationManager,
+        TypeGeolocationPermissionRequest,
+        TypeGeolocationPosition,
         TypeInspector,
         TypeNavigationData,
         TypeOpenPanelParameters,
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index b3e8e83..15cb7ee 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -43,6 +43,7 @@ namespace WebKit {
 class AuthenticationChallengeProxy;
 class AuthenticationDecisionListener;
 class DownloadProxy;
+class GeolocationPermissionRequestProxy;
 class WebBackForwardList;
 class WebBackForwardListItem;
 class WebContext;
@@ -74,6 +75,7 @@ WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
 WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
 WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
 WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy)
+WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy)
 WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition)
 WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
 WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters)
diff --git a/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp b/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp
new file mode 100644
index 0000000..ca52798
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 "WKGeolocationPermissionRequest.h"
+
+#include "GeolocationPermissionRequestProxy.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKGeolocationPermissionRequestGetTypeID()
+{
+    return toAPI(GeolocationPermissionRequestProxy::APIType);
+}
+
+void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequestRef)
+{
+    return toImpl(geolocationPermissionRequestRef)->allow();
+}
+
+void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequestRef)
+{
+    return toImpl(geolocationPermissionRequestRef)->deny();
+}
diff --git a/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h b/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h
new file mode 100644
index 0000000..ee27b66
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 WKGeolocationPermissionRequest_h
+#define WKGeolocationPermissionRequest_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKGeolocationPermissionRequestGetTypeID();
+
+WK_EXPORT void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequest);
+WK_EXPORT void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKGeolocationPermissionRequest_h */
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 4d89178..dde726b 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -176,6 +176,7 @@ typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo);
 typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo);
 typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo);
 typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo);
+typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo);
 
 struct WKPageUIClient {
     int                                                                 version;
@@ -205,6 +206,7 @@ struct WKPageUIClient {
     WKPageDidScrollCallback                                             pageDidScroll;
     WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
     WKPageRunOpenPanelCallback                                          runOpenPanel;
+    WKPageDecidePolicyForGeolocationPermissionRequestCallback           decidePolicyForGeolocationPermissionRequest;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
diff --git a/WebKit2/UIProcess/API/C/WebKit2.h b/WebKit2/UIProcess/API/C/WebKit2.h
index 8f6e5f0..02a339f 100644
--- a/WebKit2/UIProcess/API/C/WebKit2.h
+++ b/WebKit2/UIProcess/API/C/WebKit2.h
@@ -40,6 +40,7 @@
 #include <WebKit2/WKFrame.h>
 #include <WebKit2/WKFramePolicyListener.h>
 #include <WebKit2/WKGeolocationManager.h>
+#include <WebKit2/WKGeolocationPermissionRequest.h>
 #include <WebKit2/WKGeolocationPosition.h>
 #include <WebKit2/WKMutableArray.h>
 #include <WebKit2/WKMutableDictionary.h>
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 507e8d3..5288160 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -434,7 +434,8 @@ QWKPage::QWKPage(QWKContext* context)
         0,  /* didDraw */
         0,  /* pageDidScroll */
         0,  /* exceededDatabaseQuota */
-        0   /* runOpenPanel */
+        0,  /* runOpenPanel */
+        0   /* decidePolicyForGeolocationPermissionRequest */
     };
     WKPageSetPageUIClient(pageRef(), &uiClient);
 }
diff --git a/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp b/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
new file mode 100644
index 0000000..285e329
--- /dev/null
+++ b/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 "GeolocationPermissionRequestManagerProxy.h"
+
+#include "WebPageMessages.h"
+#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
+
+namespace WebKit {
+
+GeolocationPermissionRequestManagerProxy::GeolocationPermissionRequestManagerProxy(WebPageProxy* page)
+    : m_page(page)
+{
+}
+
+void GeolocationPermissionRequestManagerProxy::invalidateRequests()
+{
+    PendingRequestMap::const_iterator it = m_pendingRequests.begin();
+    PendingRequestMap::const_iterator end = m_pendingRequests.end();
+    for (; it != end; ++it)
+        it->second->invalidate();
+
+    m_pendingRequests.clear();
+}
+
+PassRefPtr<GeolocationPermissionRequestProxy> GeolocationPermissionRequestManagerProxy::createRequest(uint64_t geolocationID)
+{
+    RefPtr<GeolocationPermissionRequestProxy> request = GeolocationPermissionRequestProxy::create(this, geolocationID);
+    m_pendingRequests.add(geolocationID, request.get());
+    return request.release();
+}
+
+void GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
+{
+    if (!m_page->isValid())
+        return;
+
+    PendingRequestMap::iterator it = m_pendingRequests.find(geolocationID);
+    if (it == m_pendingRequests.end())
+        return;
+
+    m_page->process()->send(Messages::WebPage::DidReceiveGeolocationPermissionDecision(geolocationID, allowed), m_page->pageID());
+    m_pendingRequests.remove(it);
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h b/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h
new file mode 100644
index 0000000..98885bf
--- /dev/null
+++ b/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 GeolocationPermissionRequestManagerProxy_h
+#define GeolocationPermissionRequestManagerProxy_h
+
+#include "GeolocationPermissionRequestProxy.h"
+#include <wtf/HashMap.h>
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class GeolocationPermissionRequestManagerProxy {
+public:
+    explicit GeolocationPermissionRequestManagerProxy(WebPageProxy*);
+
+    void invalidateRequests();
+
+    // Create a request to be presented to the user.
+    PassRefPtr<GeolocationPermissionRequestProxy> createRequest(uint64_t geolocationID);
+    
+    // Called by GeolocationPermissionRequestProxy when a decision is made by the user.
+    void didReceiveGeolocationPermissionDecision(uint64_t, bool allow);
+
+private:
+    typedef HashMap<uint64_t, RefPtr<GeolocationPermissionRequestProxy> > PendingRequestMap;
+    PendingRequestMap m_pendingRequests;
+    WebPageProxy* m_page;
+};
+
+} // namespace WebKit
+
+#endif // GeolocationPermissionRequestManagerProxy_h
diff --git a/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp b/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp
new file mode 100644
index 0000000..9766ad2
--- /dev/null
+++ b/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 "GeolocationPermissionRequestProxy.h"
+
+#include "GeolocationPermissionRequestManagerProxy.h"
+
+namespace WebKit {
+
+GeolocationPermissionRequestProxy::GeolocationPermissionRequestProxy(GeolocationPermissionRequestManagerProxy* manager, uint64_t geolocationID)
+    : m_manager(manager)
+    , m_geolocationID(geolocationID)
+{
+}
+
+void GeolocationPermissionRequestProxy::allow()
+{
+    if (!m_manager)
+        return;
+
+    m_manager->didReceiveGeolocationPermissionDecision(m_geolocationID, true);
+    m_manager = 0;
+}
+
+void GeolocationPermissionRequestProxy::deny()
+{
+    if (!m_manager)
+        return;
+    
+    m_manager->didReceiveGeolocationPermissionDecision(m_geolocationID, false);
+    m_manager = 0;
+}
+
+void GeolocationPermissionRequestProxy::invalidate()
+{
+    m_manager = 0;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h b/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h
new file mode 100644
index 0000000..c34c3fd
--- /dev/null
+++ b/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 GeolocationPermissionRequestProxy_h
+#define GeolocationPermissionRequestProxy_h
+
+#include "APIObject.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class GeolocationPermissionRequestManagerProxy;
+
+class GeolocationPermissionRequestProxy : public APIObject {
+public:
+    static const Type APIType = TypeGeolocationPermissionRequest;
+
+    static PassRefPtr<GeolocationPermissionRequestProxy> create(GeolocationPermissionRequestManagerProxy* manager, uint64_t geolocationID)
+    {
+        return adoptRef(new GeolocationPermissionRequestProxy(manager, geolocationID));
+    }
+
+    void allow();
+    void deny();
+    
+    void invalidate();
+
+private:
+    GeolocationPermissionRequestProxy(GeolocationPermissionRequestManagerProxy*, uint64_t geolocationID);
+
+    virtual Type type() const { return APIType; }
+
+    GeolocationPermissionRequestManagerProxy* m_manager;
+    uint64_t m_geolocationID;
+};
+
+} // namespace WebKit
+
+#endif // GeolocationPermissionRequestProxy_h
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 703ebef..d029b5e 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -96,6 +96,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG
     , m_pageGroup(pageGroup)
     , m_mainFrame(0)
     , m_userAgent(standardUserAgent())
+    , m_geolocationPermissionRequestManager(this)
     , m_estimatedProgress(0)
     , m_isInWindow(m_pageClient->isViewInWindow())
     , m_isVisible(m_pageClient->isViewVisible())
@@ -259,6 +260,8 @@ void WebPageProxy::close()
         m_openPanelResultListener = 0;
     }
 
+    m_geolocationPermissionRequestManager.invalidateRequests();
+
     m_toolTip = String();
 
     invalidateCallbackMap(m_dataCallbacks);
@@ -2107,6 +2110,8 @@ void WebPageProxy::processDidCrash()
         m_openPanelResultListener = 0;
     }
 
+    m_geolocationPermissionRequestManager.invalidateRequests();
+
     m_toolTip = String();
 
     invalidateCallbackMap(m_dataCallbacks);
@@ -2206,6 +2211,18 @@ void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originI
     newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage);
 }
 
+void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
+{
+    WebFrameProxy* frame = process()->webFrame(frameID);
+    MESSAGE_CHECK(frame);
+
+    RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+    RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
+
+    if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
+        request->deny();
+}
+
 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
 {
     m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 1c7cea4..622d991 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -29,6 +29,7 @@
 #include "APIObject.h"
 #include "ContextMenuState.h"
 #include "DrawingAreaProxy.h"
+#include "GeolocationPermissionRequestManagerProxy.h"
 #include "SelectionState.h"
 #include "SharedMemory.h"
 #include "WKBase.h"
@@ -398,11 +399,13 @@ private:
     void didChangeViewportData(const WebCore::ViewportArguments&);
     void pageDidScroll();
     void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&);
+    void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
+    void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
 
 #if ENABLE(TILED_BACKING_STORE)
     void pageDidRequestScroll(const WebCore::IntSize&);
 #endif
-    void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
+
 #if PLATFORM(QT)
     void didChangeContentsSize(const WebCore::IntSize&);
     void didFindZoomableArea(const WebCore::IntRect&);
@@ -518,6 +521,7 @@ private:
     RefPtr<WebContextMenuProxy> m_activeContextMenu;
     ContextMenuState m_activeContextMenuState;
     RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
+    GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
 
     double m_estimatedProgress;
 
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index 841b89d..00632ba 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -165,6 +165,9 @@ messages -> WebPageProxy {
     # Database messages.
     ExceededDatabaseQuota(uint64_t frameID, WTF::String originIdentifier, WTF::String databaseName, WTF::String databaseDisplayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage) -> (uint64_t newQuota)
 
+    # Geolocation messages.
+    RequestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, WTF::String originIdentifier)
+
     # Plug-in complex text input support messages.
 #if PLATFORM(MAC)
     SetComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
diff --git a/WebKit2/UIProcess/WebUIClient.cpp b/WebKit2/UIProcess/WebUIClient.cpp
index 661f4b7..e95af34 100644
--- a/WebKit2/UIProcess/WebUIClient.cpp
+++ b/WebKit2/UIProcess/WebUIClient.cpp
@@ -264,4 +264,13 @@ bool WebUIClient::runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, const W
     return true;
 }
 
+bool WebUIClient::decidePolicyForGeolocationPermissionRequest(WebPageProxy* page, WebFrameProxy* frame, WebSecurityOrigin* origin, GeolocationPermissionRequestProxy* permissionRequest)
+{
+    if (!m_client.decidePolicyForGeolocationPermissionRequest)
+        return false;
+
+    m_client.decidePolicyForGeolocationPermissionRequest(toAPI(page), toAPI(frame), toAPI(origin), toAPI(permissionRequest), m_client.clientInfo);
+    return true;
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebUIClient.h b/WebKit2/UIProcess/WebUIClient.h
index 909a63c..a25b37f 100644
--- a/WebKit2/UIProcess/WebUIClient.h
+++ b/WebKit2/UIProcess/WebUIClient.h
@@ -42,6 +42,7 @@ namespace WebCore {
 namespace WebKit {
 
 class APIObject;
+class GeolocationPermissionRequestProxy;
 class NativeWebKeyboardEvent;
 class WebFrameProxy;
 class WebPageProxy;
@@ -84,6 +85,7 @@ public:
     unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage);
 
     bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebOpenPanelParameters::Data&, WebOpenPanelResultListenerProxy*);
+    bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*);
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index c1937e0..fbcaa45 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -311,6 +311,7 @@ HEADERS += \
     UIProcess/API/C/WKFrame.h \
     UIProcess/API/C/WKFramePolicyListener.h \
     UIProcess/API/C/WKGeolocationManager.h \
+    UIProcess/API/C/WKGeolocationPermissionRequest.h \
     UIProcess/API/C/WKGeolocationPosition.h \
     UIProcess/API/C/WKInspector.h \
     UIProcess/API/C/WKOpenPanelParameters.h \
@@ -346,6 +347,8 @@ HEADERS += \
     UIProcess/DrawingAreaProxy.h \
     UIProcess/FindIndicator.h \
     UIProcess/GenericCallback.h \
+    UIProcess/GeolocationPermissionRequestManagerProxy.h \
+    UIProcess/GeolocationPermissionRequestProxy.h \
     UIProcess/Launcher/ProcessLauncher.h \
     UIProcess/Launcher/ThreadLauncher.h \
     UIProcess/PageClient.h \
@@ -390,6 +393,7 @@ HEADERS += \
     WebProcess/Authentication/AuthenticationManager.h \
     WebProcess/Downloads/Download.h \
     WebProcess/Downloads/DownloadManager.h \
+    WebProcess/Geolocation/GeolocationPermissionRequestManager.h \
     WebProcess/Geolocation/WebGeolocationManager.h \
     WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \
     WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h \
@@ -530,6 +534,7 @@ SOURCES += \
     UIProcess/API/C/WKFrame.cpp \
     UIProcess/API/C/WKFramePolicyListener.cpp \
     UIProcess/API/C/WKGeolocationManager.cpp \
+    UIProcess/API/C/WKGeolocationPermissionRequest.cpp \
     UIProcess/API/C/WKGeolocationPosition.cpp \
     UIProcess/API/C/WKInspector.cpp \
     UIProcess/API/C/WKOpenPanelParameters.cpp \
@@ -555,6 +560,8 @@ SOURCES += \
     UIProcess/Downloads/DownloadProxy.cpp \
     UIProcess/DrawingAreaProxy.cpp \
     UIProcess/FindIndicator.cpp \
+    UIProcess/GeolocationPermissionRequestManagerProxy.cpp \
+    UIProcess/GeolocationPermissionRequestProxy.cpp \
     UIProcess/Launcher/ProcessLauncher.cpp \
     UIProcess/Launcher/ThreadLauncher.cpp \
     UIProcess/Launcher/qt/ProcessLauncherQt.cpp \
@@ -607,6 +614,7 @@ SOURCES += \
     WebProcess/Authentication/AuthenticationManager.cpp \
     WebProcess/Downloads/Download.cpp \
     WebProcess/Downloads/DownloadManager.cpp \
+    WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp \
     WebProcess/Geolocation/WebGeolocationManager.cpp \
     WebProcess/Downloads/qt/DownloadQt.cpp \
     WebProcess/InjectedBundle/API/c/WKBundle.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index d855abd..bc048ef 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -311,6 +311,14 @@
 		BC032DD110F4389F0058C15A /* WebPageProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DCB10F4389F0058C15A /* WebPageProxy.h */; };
 		BC032DD310F4389F0058C15A /* WebProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DCD10F4389F0058C15A /* WebProcessManager.h */; };
 		BC032DD510F4389F0058C15A /* WebProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DCF10F4389F0058C15A /* WebProcessProxy.h */; };
+		BC06F42F12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F42D12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h */; };
+		BC06F43012DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F42E12DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp */; };
+		BC06F43A12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */; };
+		BC06F43B12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */; };
+		BC06F44A12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */; };
+		BC06F44B12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */; };
+		BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F44C12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BC06F44F12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F44D12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp */; };
 		BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E5FE312D697160012A72A /* WebGeolocationManager.h */; };
 		BC0E5FE612D697160012A72A /* WebGeolocationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E5FE412D697160012A72A /* WebGeolocationManager.cpp */; };
 		BC0E606112D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E605F12D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp */; };
@@ -1019,6 +1027,14 @@
 		BC032DCB10F4389F0058C15A /* WebPageProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageProxy.h; sourceTree = "<group>"; };
 		BC032DCD10F4389F0058C15A /* WebProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessManager.h; sourceTree = "<group>"; };
 		BC032DCF10F4389F0058C15A /* WebProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxy.h; sourceTree = "<group>"; };
+		BC06F42D12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPermissionRequestManager.h; sourceTree = "<group>"; };
+		BC06F42E12DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPermissionRequestManager.cpp; sourceTree = "<group>"; };
+		BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPermissionRequestProxy.h; sourceTree = "<group>"; };
+		BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPermissionRequestProxy.cpp; sourceTree = "<group>"; };
+		BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPermissionRequestManagerProxy.h; sourceTree = "<group>"; };
+		BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPermissionRequestManagerProxy.cpp; sourceTree = "<group>"; };
+		BC06F44C12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGeolocationPermissionRequest.h; sourceTree = "<group>"; };
+		BC06F44D12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGeolocationPermissionRequest.cpp; sourceTree = "<group>"; };
 		BC0E5FE312D697160012A72A /* WebGeolocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationManager.h; sourceTree = "<group>"; };
 		BC0E5FE412D697160012A72A /* WebGeolocationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationManager.cpp; sourceTree = "<group>"; };
 		BC0E604812D6B6370012A72A /* WebGeolocationManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGeolocationManager.messages.in; sourceTree = "<group>"; };
@@ -2010,6 +2026,10 @@
 				1A910070126675C4001842F5 /* FindIndicator.cpp */,
 				1A91006F126675C3001842F5 /* FindIndicator.h */,
 				BC17753E118BABF0007D9E9A /* GenericCallback.h */,
+				BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */,
+				BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */,
+				BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */,
+				BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */,
 				0F5265B711DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp */,
 				0F5265B811DD377F0006D33C /* LayerBackedDrawingAreaProxy.h */,
 				BC6EDAA5111271C600E7678B /* PageClient.h */,
@@ -2134,6 +2154,8 @@
 				BCB9F6A31123DD0D00A137E0 /* WKFramePolicyListener.h */,
 				BC54CC1112D674EE005C67B0 /* WKGeolocationManager.cpp */,
 				BC54CC1012D674EE005C67B0 /* WKGeolocationManager.h */,
+				BC06F44D12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp */,
+				BC06F44C12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h */,
 				BC0E619712D6CD120012A72A /* WKGeolocationPosition.cpp */,
 				BC0E619612D6CD120012A72A /* WKGeolocationPosition.h */,
 				1C8E293812761E5B00BC7BD0 /* WKInspector.cpp */,
@@ -2163,6 +2185,8 @@
 		BC0E5FCB12D696DD0012A72A /* Geolocation */ = {
 			isa = PBXGroup;
 			children = (
+				BC06F42E12DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp */,
+				BC06F42D12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h */,
 				BC0E5FE412D697160012A72A /* WebGeolocationManager.cpp */,
 				BC0E5FE312D697160012A72A /* WebGeolocationManager.h */,
 				BC0E604812D6B6370012A72A /* WebGeolocationManager.messages.in */,
@@ -2942,6 +2966,10 @@
 				BC0E607312D6BC200012A72A /* WebGeolocationPosition.h in Headers */,
 				BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */,
 				BC0E619812D6CD120012A72A /* WKGeolocationPosition.h in Headers */,
+				BC06F42F12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h in Headers */,
+				BC06F43A12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h in Headers */,
+				BC06F44A12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h in Headers */,
+				BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3386,6 +3414,10 @@
 				BC0E607412D6BC200012A72A /* WebGeolocationPosition.cpp in Sources */,
 				BC0E618212D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp in Sources */,
 				BC0E619912D6CD120012A72A /* WKGeolocationPosition.cpp in Sources */,
+				BC06F43012DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp in Sources */,
+				BC06F43B12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp in Sources */,
+				BC06F44B12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp in Sources */,
+				BC06F44F12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp b/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
new file mode 100644
index 0000000..3068d5e
--- /dev/null
+++ b/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 "GeolocationPermissionRequestManager.h"
+
+#include "WebFrame.h"
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include <WebCore/Frame.h>
+#include <WebCore/Geolocation.h>
+#include <WebCore/SecurityOrigin.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static uint64_t generateGeolocationID()
+{
+    static uint64_t uniqueGeolocationID = 1;
+    return uniqueGeolocationID++;
+}
+
+GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage* page)
+    : m_page(page)
+{
+}
+
+void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation* geolocation)
+{
+    uint64_t geolocationID = generateGeolocationID();
+
+    m_geolocationToIDMap.set(geolocation, geolocationID);
+    m_idToGeolocationMap.set(geolocationID, geolocation);
+
+
+    Frame* frame = geolocation->frame();
+
+    WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
+    SecurityOrigin* origin = frame->document()->securityOrigin();
+
+    m_page->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), origin->databaseIdentifier()));
+}
+
+void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation* geolocation)
+{
+    GeolocationToIDMap::iterator it = m_geolocationToIDMap.find(geolocation);
+    if (it == m_geolocationToIDMap.end())
+        return;
+
+    m_geolocationToIDMap.remove(it);
+    m_idToGeolocationMap.remove(it->second);
+}
+
+void GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
+{
+    IDToGeolocationMap::iterator it = m_idToGeolocationMap.find(geolocationID);
+    if (it == m_idToGeolocationMap.end())
+        return;
+
+    Geolocation* geolocation = it->second;
+    geolocation->setIsAllowed(allowed);
+
+    m_idToGeolocationMap.remove(it);
+    m_geolocationToIDMap.remove(geolocation);
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h b/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h
new file mode 100644
index 0000000..5e37163
--- /dev/null
+++ b/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2011 Apple 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 INC. 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 INC. 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 GeolocationPermissionRequestManager_h
+#define GeolocationPermissionRequestManager_h
+
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+class Geolocation;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class GeolocationPermissionRequestManager {
+public:
+    explicit GeolocationPermissionRequestManager(WebPage*);
+
+    void startRequestForGeolocation(WebCore::Geolocation*);
+    void cancelRequestForGeolocation(WebCore::Geolocation*);
+
+    void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
+
+private:
+    typedef HashMap<uint64_t, WebCore::Geolocation*> IDToGeolocationMap;
+    typedef HashMap<WebCore::Geolocation*, uint64_t> GeolocationToIDMap;
+    IDToGeolocationMap m_idToGeolocationMap;
+    GeolocationToIDMap m_geolocationToIDMap;
+
+    WebPage* m_page;
+};
+
+} // namespace WebKit
+
+#endif // GeolocationPermissionRequestManager_h
diff --git a/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp b/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
index b2f8ac8..713ba71 100644
--- a/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
+++ b/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
@@ -30,6 +30,7 @@
 #include "WebProcess.h"
 
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
+#include <WebCore/Geolocation.h>
 #include <WebCore/GeolocationController.h>
 #include <WebCore/GeolocationError.h>
 #include <WebCore/GeolocationPosition.h>
diff --git a/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h b/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h
index 6ce6bd2..78fbd5a 100644
--- a/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h
+++ b/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h
@@ -29,6 +29,7 @@
 #include "MessageID.h"
 #include "WebGeolocationPosition.h"
 #include <wtf/HashSet.h>
+#include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 
 namespace CoreIPC {
@@ -36,6 +37,10 @@ class ArgumentDecoder;
 class Connection;
 }
 
+namespace WebCore {
+class Geolocation;
+}
+
 namespace WebKit {
 
 class WebProcess;
@@ -50,6 +55,8 @@ public:
     void registerWebPage(WebPage*);
     void unregisterWebPage(WebPage*);
 
+    void requestPermission(WebCore::Geolocation*);
+
     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 
 private:
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
index 3a1f941..8701022 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
@@ -28,13 +28,19 @@
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
 
 #include "WebGeolocationManager.h"
+#include "WebPage.h"
 #include "WebProcess.h"
+#include <WebCore/Geolocation.h>
 #include <WebCore/GeolocationPosition.h>
 
 using namespace WebCore;
 
 namespace WebKit {
 
+WebGeolocationClient::~WebGeolocationClient()
+{
+}
+
 void WebGeolocationClient::geolocationDestroyed()
 {
     WebProcess::shared().geolocationManager().unregisterWebPage(m_page);
@@ -61,14 +67,14 @@ GeolocationPosition* WebGeolocationClient::lastPosition()
     return 0;
 }
 
-void WebGeolocationClient::requestPermission(Geolocation*)
+void WebGeolocationClient::requestPermission(Geolocation* geolocation)
 {
-    // FIXME: Implement this.
+    m_page->geolocationPermissionRequestManager().startRequestForGeolocation(geolocation);
 }
 
-void WebGeolocationClient::cancelPermissionRequest(Geolocation*)
+void WebGeolocationClient::cancelPermissionRequest(Geolocation* geolocation)
 {
-    // FIXME: Implement this.
+    m_page->geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h b/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h
index d8c3709..e72124d 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h
@@ -41,6 +41,8 @@ public:
     {
     }
 
+    virtual ~WebGeolocationClient();
+
 private:
     virtual void geolocationDestroyed();
 
@@ -53,6 +55,7 @@ private:
     virtual void requestPermission(WebCore::Geolocation*);
     virtual void cancelPermissionRequest(WebCore::Geolocation*);
 
+
     WebPage* m_page;
 };
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 684df15..9710db5 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -140,6 +140,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     , m_nativeWindow(parameters.nativeWindow)
 #endif
     , m_findController(this)
+    , m_geolocationPermissionRequestManager(this)
     , m_pageID(pageID)
 {
     ASSERT(m_pageID);
@@ -1302,6 +1303,11 @@ void WebPage::didCancelForOpenPanel()
     m_activeOpenPanelResultListener = 0;
 }
 
+void WebPage::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
+{
+    m_geolocationPermissionRequestManager.didReceiveGeolocationPermissionDecision(geolocationID, allowed);
+}
+
 void WebPage::advanceToNextMisspelling(bool startBeforeSelection)
 {
     Frame* frame = m_page->focusController()->focusedOrMainFrame();
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index cbf7516..b8f65ec 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -29,6 +29,7 @@
 #include "APIObject.h"
 #include "DrawingArea.h"
 #include "FindController.h"
+#include "GeolocationPermissionRequestManager.h"
 #include "ImageOptions.h"
 #include "InjectedBundlePageContextMenuClient.h"
 #include "InjectedBundlePageEditorClient.h"
@@ -225,6 +226,7 @@ public:
     static const WebEvent* currentEvent();
 
     FindController& findController() { return m_findController; }
+    GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
 
     void pageDidScroll();
 #if ENABLE(TILED_BACKING_STORE)
@@ -384,6 +386,8 @@ private:
     void didChooseFilesForOpenPanel(const Vector<String>&);
     void didCancelForOpenPanel();
 
+    void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
+
     void advanceToNextMisspelling(bool startBeforeSelection);
     void changeSpellingToWord(const String& word);
     void unmarkAllMisspellings();
@@ -467,6 +471,7 @@ private:
     RefPtr<WebPopupMenu> m_activePopupMenu;
     RefPtr<WebContextMenu> m_contextMenu;
     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
+    GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
 
     SandboxExtensionTracker m_sandboxExtensionTracker;
     uint64_t m_pageID;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index d781ae1..25b8cc4 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -117,6 +117,9 @@ messages -> WebPage {
     SetSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled);
 #endif
 
+    # Geolocation
+    DidReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
+
     SetWindowResizerSize(WebCore::IntSize intersectsView)
 
     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 499b010..29414ba 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1258,6 +1258,14 @@
 				Name="Geolocation"
 				>
 				<File
+					RelativePath="..\WebProcess\Geolocation\GeolocationPermissionRequestManager.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\Geolocation\GeolocationPermissionRequestManager.h"
+					>
+				</File>
+				<File
 					RelativePath="..\WebProcess\Geolocation\WebGeolocationManager.cpp"
 					>
 				</File>
@@ -2031,6 +2039,22 @@
 				>
 			</File>
 			<File
+				RelativePath="..\UIProcess\GeolocationPermissionRequestManagerProxy.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\UIProcess\GeolocationPermissionRequestManagerProxy.h"
+				>
+			</File>
+			<File
+				RelativePath="..\UIProcess\GeolocationPermissionRequestProxy.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\UIProcess\GeolocationPermissionRequestProxy.h"
+				>
+			</File>
+			<File
 				RelativePath="..\UIProcess\LayerBackedDrawingAreaProxy.cpp"
 				>
 			</File>
@@ -2457,6 +2481,14 @@
 						>
 					</File>
 					<File
+						RelativePath="..\UIProcess\API\C\WKGeolocationPermissionRequest.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKGeolocationPermissionRequest.h"
+						>
+					</File>
+					<File
 						RelativePath="..\UIProcess\API\C\WKGeolocationPosition.cpp"
 						>
 					</File>
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index 30e19bf..9460ab5 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -49,6 +49,7 @@ all:
     xcopy /y /d "..\UIProcess\API\C\WKFrame.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKFramePolicyListener.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKGeolocationManager.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"
+    xcopy /y /d "..\UIProcess\API\C\WKGeolocationPermissionRequest.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKGeolocationPosition.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\c\WKInspector.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKNativeEvent.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list