[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

sfalken at apple.com sfalken at apple.com
Thu Apr 8 01:02:50 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit ac58796d379793badaef257d1234135b92a6dd0b
Author: sfalken at apple.com <sfalken at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 12 22:48:20 2010 +0000

    WebCore: Update all-in-one derived sources for Geolocation.
    
    Reviewed by Sam Weinig.
    
    * DerivedSources.cpp: Add JSCoordinates.cpp, JSGeolocation.cpp, JSGeoposition.cpp, JSPositionError.cpp
    
    WebKit/win: Add Geolocation interfaces in WebKit for Windows.
    
    Reviewed by Adam Roben, Sam Weinig.
    
    * ForEachCoClass.h: Added WebGeolocationPosition.
    * Interfaces/IWebError.idl:
    * Interfaces/IWebGeolocationPosition.idl: Added.
    * Interfaces/IWebGeolocationProvider.idl: Added.
    * Interfaces/IWebViewPrivate.idl:
    * Interfaces/WebKit.idl:
    * WebCoreSupport/WebGeolocationControllerClient.cpp: Added.
    (WebGeolocationControllerClient::WebGeolocationControllerClient):
    (WebGeolocationControllerClient::startUpdating):
    (WebGeolocationControllerClient::stopUpdating):
    (WebGeolocationControllerClient::lastPosition):
    * WebCoreSupport/WebGeolocationControllerClient.h: Added.
    * WebGeolocationPosition.cpp: Added IWebGeolocationPosition implementation.
    * WebGeolocationPosition.h: Added IWebGeolocationPosition implementation.
    * WebKit.vcproj/Interfaces.vcproj: Added IWebGeolocationPosition.idl, IWebGeolocationProvider.idl,
    relocated JavaScriptCoreAPITypes.idl, WebScrollbarTypes.idl
    * WebKit.vcproj/WebKit.vcproj: Added WebGeolocationPosition.h/.cpp, WebGeolocationControllerClient.h/cpp,
    * WebKitClassFactory.cpp: Add WebGeolocationPosition include.
    * WebView.cpp:
    (WebView::initWithFrame): Create WebGeolocationControllerClient if Geolocation is enabled.
    (WebView::setGeolocationProvider): Added Geolocation-specific method.
    (WebView::geolocationProvider): Added Geolocation-specific method.
    (WebView::geolocationDidChangePosition): Added Geolocation-specific method.
    (WebView::geolocationDidFailWithError): Added Geolocation-specific method.
    * WebView.h: Added setGeolocationProvider, geolocationProvider, geolocationDidChangePosition, geolocationDidFailWithError.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53165 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b76c73a..4afa023 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-12  Steve Falkenburg  <sfalken at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Update all-in-one derived sources for Geolocation.
+
+        * DerivedSources.cpp: Add JSCoordinates.cpp, JSGeolocation.cpp, JSGeoposition.cpp, JSPositionError.cpp
+
 2010-01-12  Nate Chapin  <japhet at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp
index e96b606..a88adef 100644
--- a/WebCore/DerivedSources.cpp
+++ b/WebCore/DerivedSources.cpp
@@ -44,6 +44,7 @@
 #include "JSComment.cpp"
 #include "JSCompositionEvent.cpp"
 #include "JSConsole.cpp"
+#include "JSCoordinates.cpp"
 #include "JSCounter.cpp"
 #include "JSCSSCharsetRule.cpp"
 #include "JSCSSFontFaceRule.cpp"
@@ -82,6 +83,8 @@
 #include "JSEventSource.cpp"
 #include "JSFile.cpp"
 #include "JSFileList.cpp"
+#include "JSGeolocation.cpp"
+#include "JSGeoposition.cpp"
 #include "JSHistory.cpp"
 #include "JSHTMLAllCollection.cpp"
 #include "JSHTMLAnchorElement.cpp"
@@ -182,6 +185,7 @@
 #include "JSPlugin.cpp"
 #include "JSPluginArray.cpp"
 #include "JSPopStateEvent.cpp"
+#include "JSPositionError.cpp"
 #include "JSProcessingInstruction.cpp"
 #include "JSProgressEvent.cpp"
 #include "JSRange.cpp"
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 9e3569e..723c1ea 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,35 @@
+2010-01-12  Steve Falkenburg  <sfalken at apple.com>
+
+        Reviewed by Adam Roben, Sam Weinig.
+
+        Add Geolocation interfaces in WebKit for Windows.
+
+        * ForEachCoClass.h: Added WebGeolocationPosition.
+        * Interfaces/IWebError.idl:
+        * Interfaces/IWebGeolocationPosition.idl: Added.
+        * Interfaces/IWebGeolocationProvider.idl: Added.
+        * Interfaces/IWebViewPrivate.idl:
+        * Interfaces/WebKit.idl:
+        * WebCoreSupport/WebGeolocationControllerClient.cpp: Added.
+        (WebGeolocationControllerClient::WebGeolocationControllerClient):
+        (WebGeolocationControllerClient::startUpdating):
+        (WebGeolocationControllerClient::stopUpdating):
+        (WebGeolocationControllerClient::lastPosition):
+        * WebCoreSupport/WebGeolocationControllerClient.h: Added.
+        * WebGeolocationPosition.cpp: Added IWebGeolocationPosition implementation.
+        * WebGeolocationPosition.h: Added IWebGeolocationPosition implementation.
+        * WebKit.vcproj/Interfaces.vcproj: Added IWebGeolocationPosition.idl, IWebGeolocationProvider.idl,
+        relocated JavaScriptCoreAPITypes.idl, WebScrollbarTypes.idl
+        * WebKit.vcproj/WebKit.vcproj: Added WebGeolocationPosition.h/.cpp, WebGeolocationControllerClient.h/cpp,        
+        * WebKitClassFactory.cpp: Add WebGeolocationPosition include.
+        * WebView.cpp:
+        (WebView::initWithFrame): Create WebGeolocationControllerClient if Geolocation is enabled.
+        (WebView::setGeolocationProvider): Added Geolocation-specific method.
+        (WebView::geolocationProvider): Added Geolocation-specific method.
+        (WebView::geolocationDidChangePosition): Added Geolocation-specific method.
+        (WebView::geolocationDidFailWithError): Added Geolocation-specific method.
+        * WebView.h: Added setGeolocationProvider, geolocationProvider, geolocationDidChangePosition, geolocationDidFailWithError.
+
 2010-01-11  Jon Honeycutt  <jhoneycutt at apple.com>
 
         MSAA: Accessibility role of <select multiple> elements is wrong
diff --git a/WebKit/win/ForEachCoClass.h b/WebKit/win/ForEachCoClass.h
index 39f8e32..76b5fea 100644
--- a/WebKit/win/ForEachCoClass.h
+++ b/WebKit/win/ForEachCoClass.h
@@ -64,6 +64,7 @@
     macro(WebCookieManager) \
     macro(WebWorkersPrivate) \
     macro(WebScriptWorld) \
+    macro(WebGeolocationPosition) \
     // end of macro
 
 // Everything below this point is deprecated. Please do not use.
diff --git a/WebKit/win/Interfaces/IWebError.idl b/WebKit/win/Interfaces/IWebError.idl
index 4353ac6..e4a4ae9 100644
--- a/WebKit/win/Interfaces/IWebError.idl
+++ b/WebKit/win/Interfaces/IWebError.idl
@@ -99,6 +99,15 @@ enum {
     WebKitErrorJavaUnavailable =                                202,
 };
 
+/*!
+    @enum
+    @abstract Geolocation errors
+    @constant WebKitErrorGeolocationLocationUnknown
+*/
+enum {
+    WebKitErrorGeolocationLocationUnknown  =                    300,
+};
+
 cpp_quote("#define WebKitErrorMIMETypeKey TEXT(\"WebKitErrorMIMETypeKey\")")
 cpp_quote("#define WebKitErrorPlugInNameKey TEXT(\"WebKitErrorPlugInNameKey\")")
 cpp_quote("#define WebKitErrorPlugInPageURLStringKey TEXT(\"WebKitErrorPlugInPageURLStringKey\")")
diff --git a/WebKit/win/Interfaces/IWebGeolocationPosition.idl b/WebKit/win/Interfaces/IWebGeolocationPosition.idl
new file mode 100644
index 0000000..c8f8eb4
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebGeolocationPosition.idl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+    object,
+    oleautomation,
+    uuid(8C92A6B9-4CBB-4626-A596-24C1B47D7CC7),
+    pointer_default(unique)
+]
+interface IWebGeolocationPosition : IUnknown
+{
+    HRESULT initWithTimestamp([in] double timestamp, [in] double latitude, [in] double longitude, [in] double accuracy);
+}
diff --git a/WebKit/win/Interfaces/IWebGeolocationProvider.idl b/WebKit/win/Interfaces/IWebGeolocationProvider.idl
new file mode 100644
index 0000000..9a8cb32
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebGeolocationProvider.idl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+interface IWebView;
+interface IWebGeolocationPosition;
+
+[
+    object,
+    oleautomation,
+    uuid(47F4CCF6-963D-4306-BE0B-8205C94672B5),
+    pointer_default(unique)
+]
+interface IWebGeolocationProvider : IUnknown
+{
+    HRESULT registerWebView([in] IWebView* webView);
+    HRESULT unregisterWebView([in] IWebView* webView);
+    HRESULT lastPosition([out, retval] IWebGeolocationPosition** lastPosition);
+}
diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl
index 1c8cea2..9b35963 100644
--- a/WebKit/win/Interfaces/IWebViewPrivate.idl
+++ b/WebKit/win/Interfaces/IWebViewPrivate.idl
@@ -219,4 +219,9 @@ interface IWebViewPrivate : IUnknown
     HRESULT isNodeHaltedPlugin([in] IDOMNode*, [retval, out] BOOL*);
     HRESULT restartHaltedPluginForNode([in] IDOMNode*);
     HRESULT hasPluginForNodeBeenHalted([in] IDOMNode*, [retval, out] BOOL*);
+
+    HRESULT setGeolocationProvider([in] IWebGeolocationProvider* locationProvider);
+    HRESULT geolocationProvider([out, retval] IWebGeolocationProvider** locationProvider);
+    HRESULT geolocationDidChangePosition([in] IWebGeolocationPosition* position);
+    HRESULT geolocationDidFailWithError([in] IWebError* error);
 }
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 058b6fc..dabb2d7 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -88,6 +88,8 @@ import "ocidl.idl";
 #include "IWebFrameLoadDelegatePrivate2.idl"
 #include "IWebFramePrivate.idl"
 #include "IWebFrameView.idl"
+#include "IWebGeolocationPosition.idl"
+#include "IWebGeolocationProvider.idl"
 #include "IWebHTMLRepresentation.idl"
 #include "IWebHTTPURLResponse.idl"
 #include "IWebHistory.idl"
@@ -284,5 +286,9 @@ library WebKit
     coclass WebSerializedJSValue {
         [default] interface IWebSerializedJSValue;
     }
-}
 
+    [uuid(67712611-83CF-4703-89FC-07A0E2A19C0D)]
+    coclass WebGeolocationPosition {
+        [default] interface IWebGeolocationPosition;
+    }
+}
diff --git a/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.cpp b/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.cpp
new file mode 100644
index 0000000..c3450a0
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2010 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 "config.h"
+#include "WebKitDLL.h"
+#include "WebGeolocationControllerClient.h"
+
+#include "WebGeolocationPosition.h"
+#include "WebView.h"
+
+using namespace WebCore;
+
+WebGeolocationControllerClient::WebGeolocationControllerClient(WebView *webView)
+    : m_webView(webView)
+{
+}
+
+void WebGeolocationControllerClient::startUpdating()
+{
+    COMPtr<IWebGeolocationProvider> provider;
+    if (FAILED(m_webView->geolocationProvider(&provider)))
+        return;
+    provider->registerWebView(m_webView.get());
+}
+
+void WebGeolocationControllerClient::stopUpdating()
+{
+    COMPtr<IWebGeolocationProvider> provider;
+    if (FAILED(m_webView->geolocationProvider(&provider)))
+        return;
+    provider->registerWebView(m_webView.get());
+}
+
+GeolocationPosition* WebGeolocationControllerClient::lastPosition()
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    COMPtr<IWebGeolocationProvider> provider;
+    if (FAILED(m_webView->geolocationProvider(&provider)))
+        return 0;
+    COMPtr<IWebGeolocationPosition> position;
+    if (FAILED(provider->lastPosition(&position)))
+        return 0;
+    return core(position.get());
+#else
+    return 0;
+#endif
+}
diff --git a/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h b/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h
new file mode 100644
index 0000000..19bc6f1
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebGeolocationControllerClient.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 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 WebGeolocationControllerClient_h
+#define WebGeolocationControllerClient_h
+
+#include "COMPtr.h"
+#include <WebCore/GeolocationControllerClient.h>
+
+namespace WebCore {
+    class GeolocationPosition;
+}
+
+class WebView;
+
+class WebGeolocationControllerClient : public WebCore::GeolocationControllerClient {
+public:
+    WebGeolocationControllerClient(WebView*);
+
+    virtual void startUpdating();
+    virtual void stopUpdating();
+    virtual WebCore::GeolocationPosition* lastPosition();
+
+private:
+    COMPtr<WebView> m_webView;
+};
+
+#endif // WebGeolocationControllerClient_h
diff --git a/WebKit/win/WebGeolocationPosition.cpp b/WebKit/win/WebGeolocationPosition.cpp
new file mode 100644
index 0000000..4d5e9c6
--- /dev/null
+++ b/WebKit/win/WebGeolocationPosition.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2010 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 "config.h"
+#include "WebKitDLL.h"
+#include "WebGeolocationPosition.h"
+#include <WebCore/COMPtr.h>
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#include <WebCore/GeolocationPosition.h>
+
+using namespace WebCore;
+#endif
+
+COMPtr<WebGeolocationPosition> WebGeolocationPosition::createInstance()
+{
+    return new WebGeolocationPosition;
+}
+
+WebGeolocationPosition::WebGeolocationPosition()
+    : m_refCount(0)
+{
+    gClassCount++;
+    gClassNameCount.add("WebGeolocationPosition");
+}
+
+WebGeolocationPosition::~WebGeolocationPosition()
+{
+    gClassCount--;
+    gClassNameCount.remove("WebGeolocationPosition");
+}
+
+HRESULT WebGeolocationPosition::QueryInterface(REFIID riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualIID(riid, __uuidof(WebGeolocationPosition)))
+        *ppvObject = this;
+    else if (IsEqualIID(riid, __uuidof(IUnknown)))
+        *ppvObject = static_cast<IWebGeolocationPosition*>(this);
+    else if (IsEqualIID(riid, __uuidof(IWebGeolocationPosition)))
+        *ppvObject = static_cast<IWebGeolocationPosition*>(this);
+    else
+        return E_NOINTERFACE;
+
+    AddRef();
+    return S_OK;
+}
+
+ULONG WebGeolocationPosition::AddRef()
+{
+    return ++m_refCount;
+}
+
+ULONG WebGeolocationPosition::Release()
+{
+    ULONG newRef = --m_refCount;
+    if (!newRef)
+        delete this;
+
+    return newRef;
+}
+
+HRESULT WebGeolocationPosition::initWithTimestamp(double timestamp, double latitude, double longitude, double accuracy)
+{
+    return E_FAIL;
+}
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+GeolocationPosition* core(IWebGeolocationPosition* position)
+{
+    if (!position)
+        return 0;
+
+    COMPtr<WebGeolocationPosition> webGeolocationPosition(Query, position);
+    if (!webGeolocationPosition)
+        return 0;
+
+    return webGeolocationPosition->impl();
+}
+#endif
diff --git a/WebKit/win/WebGeolocationPosition.h b/WebKit/win/WebGeolocationPosition.h
new file mode 100644
index 0000000..8160270
--- /dev/null
+++ b/WebKit/win/WebGeolocationPosition.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 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 WebGeolocationPosition_h
+#define WebGeolocationPosition_h
+
+#include "WebKit.h"
+#include <WebCore/COMPtr.h>
+
+namespace WebCore {
+    class GeolocationPosition;
+};
+
+class WebGeolocationPosition : public IWebGeolocationPosition {
+public:
+    static COMPtr<WebGeolocationPosition> createInstance();
+private:
+    WebGeolocationPosition();
+    ~WebGeolocationPosition();
+
+public:
+    // IUnknown
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
+
+    // IWebGeolocationPosition
+    virtual HRESULT STDMETHODCALLTYPE initWithTimestamp(double timestamp, double latitude, double longitude, double accuracy);
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    WebCore::GeolocationPosition* impl() const { return m_position.get(); }
+#endif
+
+private:
+    ULONG m_refCount;
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    RefPtr<WebCore::GeolocationPosition> m_position;
+#endif
+};
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+WebCore::GeolocationPosition* core(IWebGeolocationPosition*);
+#endif
+
+#endif // WebGeolocationPosition_h
diff --git a/WebKit/win/WebKit.vcproj/Interfaces.vcproj b/WebKit/win/WebKit.vcproj/Interfaces.vcproj
index ca9b2a4..299d652 100644
--- a/WebKit/win/WebKit.vcproj/Interfaces.vcproj
+++ b/WebKit/win/WebKit.vcproj/Interfaces.vcproj
@@ -764,6 +764,46 @@
 			</FileConfiguration>
 		</File>
 		<File
+			RelativePath="..\Interfaces\IWebGeolocationPosition.idl"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCMIDLTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCMIDLTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\Interfaces\IWebGeolocationProvider.idl"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCMIDLTool"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				ExcludedFromBuild="true"
+				>
+				<Tool
+					Name="VCMIDLTool"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
 			RelativePath="..\Interfaces\IWebHistory.idl"
 			>
 			<FileConfiguration
@@ -1644,47 +1684,47 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\Interfaces\WebKit.idl"
+			RelativePath="..\Interfaces\JavaScriptCoreAPITypes.idl"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
+				ExcludedFromBuild="true"
 				>
 				<Tool
 					Name="VCMIDLTool"
-					GenerateTypeLibrary="true"
 				/>
 			</FileConfiguration>
 			<FileConfiguration
 				Name="Release|Win32"
+				ExcludedFromBuild="true"
 				>
 				<Tool
 					Name="VCMIDLTool"
-					GenerateTypeLibrary="true"
 				/>
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\Interfaces\WebScrollbarTypes.idl"
+			RelativePath="..\Interfaces\WebKit.idl"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
-				ExcludedFromBuild="true"
 				>
 				<Tool
 					Name="VCMIDLTool"
+					GenerateTypeLibrary="true"
 				/>
 			</FileConfiguration>
 			<FileConfiguration
 				Name="Release|Win32"
-				ExcludedFromBuild="true"
 				>
 				<Tool
 					Name="VCMIDLTool"
+					GenerateTypeLibrary="true"
 				/>
 			</FileConfiguration>
 		</File>
-        <File
-			RelativePath="..\Interfaces\JavaScriptCoreAPITypes.idl"
+		<File
+			RelativePath="..\Interfaces\WebScrollbarTypes.idl"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj
index eee7b8a..be3710e 100644
--- a/WebKit/win/WebKit.vcproj/WebKit.vcproj
+++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj
@@ -666,6 +666,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\WebGeolocationPosition.h"
+				>
+			</File>
+			<File
 				RelativePath="..\WebHistory.h"
 				>
 			</File>
@@ -1078,6 +1082,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\WebGeolocationPosition.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\WebHistory.cpp"
 				>
 			</File>
@@ -1466,6 +1474,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\WebCoreSupport\WebGeolocationControllerClient.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\WebCoreSupport\WebGeolocationControllerClient.h"
+				>
+			</File>
+			<File
 				RelativePath="..\WebCoreSupport\WebInspectorClient.cpp"
 				>
 			</File>
diff --git a/WebKit/win/WebKitClassFactory.cpp b/WebKit/win/WebKitClassFactory.cpp
index b233a5c..3023bbb 100644
--- a/WebKit/win/WebKitClassFactory.cpp
+++ b/WebKit/win/WebKitClassFactory.cpp
@@ -37,6 +37,7 @@
 #include "WebDownload.h"
 #include "WebError.h"
 #include "WebFrame.h"
+#include "WebGeolocationPosition.h"
 #include "WebHistory.h"
 #include "WebHistoryItem.h"
 #include "WebIconDatabase.h"
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index bd7a32f..ff78f22 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -43,6 +43,8 @@
 #include "WebEditorClient.h"
 #include "WebElementPropertyBag.h"
 #include "WebFrame.h"
+#include "WebGeolocationControllerClient.h"
+#include "WebGeolocationPosition.h"
 #include "WebIconDatabase.h"
 #include "WebInspector.h"
 #include "WebInspectorClient.h"
@@ -123,6 +125,11 @@
 #include <WebCore/TypingCommand.h>
 #include <WebCore/WindowMessageBroadcaster.h>
 
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#include <WebCore/GeolocationController.h>
+#include <WebCore/GeolocationError.h>
+#endif
+
 #if PLATFORM(CG)
 #include <CoreGraphics/CGContext.h>
 #endif
@@ -2417,11 +2424,17 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
         Settings::setShouldPaintNativeControls(shouldPaintNativeControls);
 #endif
 
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    WebGeolocationControllerClient* geolocationControllerClient = new WebGeolocationControllerClient(this);
+#else
+    WebGeolocationControllerClient* geolocationControllerClient = 0;
+#endif
+
     BOOL useHighResolutionTimer;
     if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer)))
         Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer);
 
-    m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), 0);
+    m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient);
 
     BSTR localStoragePath;
     if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {
@@ -6062,6 +6075,57 @@ HRESULT WebView::hasPluginForNodeBeenHalted(IDOMNode* domNode, BOOL* result)
     return S_OK;
 }
 
+HRESULT STDMETHODCALLTYPE WebView::setGeolocationProvider(IWebGeolocationProvider* locationProvider)
+{
+    m_geolocationProvider = locationProvider;
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::geolocationProvider(IWebGeolocationProvider** locationProvider)
+{
+    if (!locationProvider)
+        return E_POINTER;
+
+    if (!m_geolocationProvider)
+        return E_FAIL;
+
+    return m_geolocationProvider.copyRefTo(locationProvider);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::geolocationDidChangePosition(IWebGeolocationPosition* position)
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    if (!m_page)
+        return E_FAIL;
+    m_page->geolocationController()->positionChanged(core(position));
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT STDMETHODCALLTYPE WebView::geolocationDidFailWithError(IWebError* error)
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    if (!m_page)
+        return E_FAIL;
+    if (!error)
+        return E_POINTER;
+
+    BSTR descriptionBSTR;
+    if (FAILED(error->localizedDescription(&descriptionBSTR)))
+        return E_FAIL;
+    String descriptionString(descriptionBSTR, SysStringLen(descriptionBSTR));
+    SysFreeString(descriptionBSTR);
+
+    RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, descriptionString);
+    m_page->geolocationController()->errorOccurred(geolocationError.get());
+    return S_OK;
+#else
+    return E_NOTIMPL;
+#endif
+}
+
 class EnumTextMatches : public IEnumTextMatches
 {
     long m_ref;
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
index 60c2de5..4327377 100644
--- a/WebKit/win/WebView.h
+++ b/WebKit/win/WebView.h
@@ -773,6 +773,11 @@ public:
     virtual HRESULT STDMETHODCALLTYPE restartHaltedPluginForNode(IDOMNode*);
     virtual HRESULT STDMETHODCALLTYPE hasPluginForNodeBeenHalted(IDOMNode*, BOOL*);
 
+    virtual HRESULT STDMETHODCALLTYPE setGeolocationProvider(IWebGeolocationProvider* locationProvider);
+    virtual HRESULT STDMETHODCALLTYPE geolocationProvider(IWebGeolocationProvider** locationProvider);
+    virtual HRESULT STDMETHODCALLTYPE geolocationDidChangePosition(IWebGeolocationPosition* position);
+    virtual HRESULT STDMETHODCALLTYPE geolocationDidFailWithError(IWebError* error);
+
     // WebView
     bool shouldUseEmbeddedView(const WebCore::String& mimeType) const;
 
@@ -944,6 +949,7 @@ protected:
     COMPtr<WebPreferences> m_preferences;
     COMPtr<WebInspector> m_webInspector;
     COMPtr<IWebPluginHalterDelegate> m_pluginHalterDelegate;
+    COMPtr<IWebGeolocationProvider> m_geolocationProvider;
 
     bool m_userAgentOverridden;
     bool m_useBackForwardList;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list