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

weinig at apple.com weinig at apple.com
Thu Apr 8 00:43:13 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d633d844b8cbe7c486477db99477808445a93a8d
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 19 01:56:45 2009 +0000

    Add Mac WebKit side of the client based geolocation provider.
    
    Reviewed by Dan Bernstein.
    
    WebKit:
    
    * WebKit.xcodeproj/project.pbxproj:
    
    WebKit/mac:
    
    * Misc/WebKitErrors.m:
    (registerErrors): Add Geolocation errors.
    * Misc/WebKitErrorsPrivate.h:
    * WebCoreSupport/WebGeolocationControllerClient.h: Added.
    (WebGeolocationControllerClient::webView):
    * WebCoreSupport/WebGeolocationControllerClient.mm: Added.
    (WebGeolocationControllerClient::WebGeolocationControllerClient):
    (WebGeolocationControllerClient::startUpdating):
    (WebGeolocationControllerClient::stopUpdating):
    (WebGeolocationControllerClient::lastPosition):
    Add implementation of the WebGeolocationControllerClient.
    
    * WebView/WebGeolocationPosition.h: Added.
    * WebView/WebGeolocationPosition.mm: Added.
    (-[WebGeolocationPositionInternal initWithCoreGeolocationPosition:]):
    (core):
    (-[WebGeolocationPosition initWithTimestamp:latitude:longitude:accuracy:]):
    * WebView/WebGeolocationPositionInternal.h: Added.
    Add an Objective-C wrapper for GeolocationPosition.
    
    * WebView/WebView.mm:
    (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): Set the GeolocationControllerClient.
    (-[WebView _setGeolocationProvider:]): Set the GeolocationProvider
    (-[WebView _geolocationProvider]): Return the GeolocationProvider.
    (-[WebView _geolocationDidChangePosition:]): Notify WebCore that the position changed.
    (-[WebView _geolocationDidFailWithError:]): Notify WebCore that an error occured.
    * WebView/WebViewData.h:
    * WebView/WebViewPrivate.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52368 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 8a94b1c..a269c24 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-18  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Add Mac WebKit side of the client based geolocation provider.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2009-12-16  Mark Rowe  <mrowe at apple.com>
 
         Build fix.  Disable debug variants of WebKit frameworks.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index d4bd625..d658b0d 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -332,6 +332,11 @@
 		BC2E464E0FD8A96800A9D9DE /* WebViewData.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */; };
 		BC542C420FD7766F00D8AB5D /* WebDelegateImplementationCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */; };
 		BC542C430FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC542C410FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm */; };
+		BC7F884B10C8775A00D6133D /* WebGeolocationControllerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F884910C8775A00D6133D /* WebGeolocationControllerClient.h */; };
+		BC7F884C10C8775A00D6133D /* WebGeolocationControllerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC7F884A10C8775A00D6133D /* WebGeolocationControllerClient.mm */; };
+		BC7F889E10C9D30C00D6133D /* WebGeolocationPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F889C10C9D30C00D6133D /* WebGeolocationPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		BC7F889F10C9D30C00D6133D /* WebGeolocationPosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC7F889D10C9D30C00D6133D /* WebGeolocationPosition.mm */; };
+		BC7F88A510C9D88B00D6133D /* WebGeolocationPositionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F88A410C9D88B00D6133D /* WebGeolocationPositionInternal.h */; };
 		BC97E7E210963D260010D361 /* WebViewEventHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC97E7E110963D260010D361 /* WebViewEventHandling.mm */; };
 		C0167BF80D7F5DD00028696E /* WebScriptDebugger.h in Headers */ = {isa = PBXBuildFile; fileRef = C0167BF60D7F5DD00028696E /* WebScriptDebugger.h */; };
 		C0167BF90D7F5DD00028696E /* WebScriptDebugger.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0167BF70D7F5DD00028696E /* WebScriptDebugger.mm */; };
@@ -610,6 +615,11 @@
 		BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewData.mm; sourceTree = "<group>"; };
 		BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDelegateImplementationCaching.h; sourceTree = "<group>"; };
 		BC542C410FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDelegateImplementationCaching.mm; sourceTree = "<group>"; };
+		BC7F884910C8775A00D6133D /* WebGeolocationControllerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationControllerClient.h; sourceTree = "<group>"; };
+		BC7F884A10C8775A00D6133D /* WebGeolocationControllerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGeolocationControllerClient.mm; sourceTree = "<group>"; };
+		BC7F889C10C9D30C00D6133D /* WebGeolocationPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationPosition.h; sourceTree = "<group>"; };
+		BC7F889D10C9D30C00D6133D /* WebGeolocationPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGeolocationPosition.mm; sourceTree = "<group>"; };
+		BC7F88A410C9D88B00D6133D /* WebGeolocationPositionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationPositionInternal.h; sourceTree = "<group>"; };
 		BC97E7E110963D260010D361 /* WebViewEventHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewEventHandling.mm; sourceTree = "<group>"; };
 		BE4FBECB0653DF47005EDE15 /* WebEditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebEditingDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		BE6DC39904C62C4E004D0EF6 /* WebNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSURLExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -1115,6 +1125,9 @@
 				51A8B52F04282B5900CA2D3A /* WebFrameView.mm */,
 				51A8B53204282BD200CA2D3A /* WebFrameViewInternal.h */,
 				93C6F14507920B93002449CD /* WebFrameViewPrivate.h */,
+				BC7F88A410C9D88B00D6133D /* WebGeolocationPositionInternal.h */,
+				BC7F889C10C9D30C00D6133D /* WebGeolocationPosition.h */,
+				BC7F889D10C9D30C00D6133D /* WebGeolocationPosition.mm */,
 				5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */,
 				5185F62710712B97007AA393 /* WebNavigationData.mm */,
 				5185F62510712B80007AA393 /* WebNavigationData.h */,
@@ -1205,6 +1218,8 @@
 				B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
 				B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
 				51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */,
+				BC7F884910C8775A00D6133D /* WebGeolocationControllerClient.h */,
+				BC7F884A10C8775A00D6133D /* WebGeolocationControllerClient.mm */,
 				14D8252D0AF955090004F057 /* WebChromeClient.h */,
 				14D8252E0AF955090004F057 /* WebChromeClient.mm */,
 				065AD5A10B0C32C7005A2B1D /* WebContextMenuClient.h */,
@@ -1524,6 +1539,9 @@
 				C0B1F7EA10AC8E3100C925D9 /* WebScriptWorldInternal.h in Headers */,
 				C0B88E8B10A08F3D00FBB3F5 /* WebFrameLoadDelegatePrivate.h in Headers */,
 				BC26C69E10B743F400B687ED /* WebSerializedJSValue.h in Headers */,
+				BC7F884B10C8775A00D6133D /* WebGeolocationControllerClient.h in Headers */,
+				BC7F889E10C9D30C00D6133D /* WebGeolocationPosition.h in Headers */,
+				BC7F88A510C9D88B00D6133D /* WebGeolocationPositionInternal.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1865,6 +1883,8 @@
 				BC97E7E210963D260010D361 /* WebViewEventHandling.mm in Sources */,
 				C0B1F7E910AC8E3100C925D9 /* WebScriptWorld.mm in Sources */,
 				BC26C6A510B7447A00B687ED /* WebSerializedJSValue.mm in Sources */,
+				BC7F884C10C8775A00D6133D /* WebGeolocationControllerClient.mm in Sources */,
+				BC7F889F10C9D30C00D6133D /* WebGeolocationPosition.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index eca90d8..108fe5c 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,38 @@
+2009-12-18  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Add Mac WebKit side of the client based geolocation provider.
+
+        * Misc/WebKitErrors.m:
+        (registerErrors): Add Geolocation errors.
+        * Misc/WebKitErrorsPrivate.h:
+        * WebCoreSupport/WebGeolocationControllerClient.h: Added.
+        (WebGeolocationControllerClient::webView):
+        * WebCoreSupport/WebGeolocationControllerClient.mm: Added.
+        (WebGeolocationControllerClient::WebGeolocationControllerClient):
+        (WebGeolocationControllerClient::startUpdating):
+        (WebGeolocationControllerClient::stopUpdating):
+        (WebGeolocationControllerClient::lastPosition):
+        Add implementation of the WebGeolocationControllerClient.
+
+        * WebView/WebGeolocationPosition.h: Added.
+        * WebView/WebGeolocationPosition.mm: Added.
+        (-[WebGeolocationPositionInternal initWithCoreGeolocationPosition:]):
+        (core):
+        (-[WebGeolocationPosition initWithTimestamp:latitude:longitude:accuracy:]):
+        * WebView/WebGeolocationPositionInternal.h: Added.
+        Add an Objective-C wrapper for GeolocationPosition.
+ 
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): Set the GeolocationControllerClient.
+        (-[WebView _setGeolocationProvider:]): Set the GeolocationProvider
+        (-[WebView _geolocationProvider]): Return the GeolocationProvider.
+        (-[WebView _geolocationDidChangePosition:]): Notify WebCore that the position changed.
+        (-[WebView _geolocationDidFailWithError:]): Notify WebCore that an error occured.
+        * WebView/WebViewData.h:
+        * WebView/WebViewPrivate.h:
+
 2009-12-18  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/WebKit/mac/Misc/WebKitErrors.m b/WebKit/mac/Misc/WebKitErrors.m
index ec42dc9..09aa907 100644
--- a/WebKit/mac/Misc/WebKitErrors.m
+++ b/WebKit/mac/Misc/WebKitErrors.m
@@ -53,6 +53,10 @@ NSString * const WebKitErrorPlugInPageURLStringKey =    @"WebKitErrorPlugInPageU
 #define WebKitErrorDescriptionPlugInCancelledConnection UI_STRING("Plug-in cancelled", "WebKitErrorPlugInCancelledConnection description")
 #define WebKitErrorDescriptionPlugInWillHandleLoad UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description")
 
+// Geolocations errors
+
+#define WebKitErrorDescriptionGeolocationLocationUnknown UI_STRING("The current location cannot be found.", "WebKitErrorGeolocationLocationUnknown description")
+
 static pthread_once_t registerErrorsControl = PTHREAD_ONCE_INIT;
 static void registerErrors(void);
 
@@ -161,6 +165,9 @@ static void registerErrors()
         WebKitErrorDescriptionJavaUnavailable,                      [NSNumber numberWithInt: WebKitErrorJavaUnavailable],
         WebKitErrorDescriptionPlugInCancelledConnection,            [NSNumber numberWithInt: WebKitErrorPlugInCancelledConnection],
         WebKitErrorDescriptionPlugInWillHandleLoad,                 [NSNumber numberWithInt: WebKitErrorPlugInWillHandleLoad],
+
+        // Geolocation errors
+        WebKitErrorDescriptionGeolocationLocationUnknown,           [NSNumber numberWithInt: WebKitErrorGeolocationLocationUnknown],
         nil];
 
     [NSError _webkit_addErrorsWithCodesAndDescriptions:dict inDomain:WebKitErrorDomain];
diff --git a/WebKit/mac/Misc/WebKitErrorsPrivate.h b/WebKit/mac/Misc/WebKitErrorsPrivate.h
index 6a98c4e..eee50a0 100644
--- a/WebKit/mac/Misc/WebKitErrorsPrivate.h
+++ b/WebKit/mac/Misc/WebKitErrorsPrivate.h
@@ -41,6 +41,15 @@ enum {
     WebKitErrorCannotUseRestrictedPort =                        103,
 };
 
+/*!
+    @enum
+    @abstract Geolocation errors
+    @constant WebKitErrorGeolocationLocationUnknown
+*/
+enum {
+    WebKitErrorGeolocationLocationUnknown  =                    300,
+};
+
 @interface NSError (WebKitExtras)
 + (NSError *)_webKitErrorWithCode:(int)code failingURL:(NSString *)URL;
 + (NSError *)_webKitErrorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL;
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h b/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h
new file mode 100644
index 0000000..89944f0
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#import <WebCore/GeolocationControllerClient.h>
+
+namespace WebCore {
+    class GeolocationPosition;
+}
+
+ at class WebView;
+
+class WebGeolocationControllerClient : public WebCore::GeolocationControllerClient {
+public:
+    WebGeolocationControllerClient(WebView *);
+    WebView *webView() { return m_webView; }
+
+    void startUpdating();
+    void stopUpdating();
+
+    WebCore::GeolocationPosition* lastPosition();
+
+private:
+    WebView *m_webView;
+};
diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.mm b/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.mm
new file mode 100644
index 0000000..3291418
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebGeolocationControllerClient.mm
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#import "WebGeolocationControllerClient.h"
+
+#import "WebGeolocationPositionInternal.h"
+#import "WebViewInternal.h"
+
+using namespace WebCore;
+
+WebGeolocationControllerClient::WebGeolocationControllerClient(WebView *webView)
+    : m_webView(webView)
+{
+}
+
+void WebGeolocationControllerClient::startUpdating()
+{
+    [[m_webView _geolocationProvider] registerWebView:m_webView];
+}
+
+void WebGeolocationControllerClient::stopUpdating()
+{
+    [[m_webView _geolocationProvider] unregisterWebView:m_webView];
+}
+
+GeolocationPosition* WebGeolocationControllerClient::lastPosition()
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    return core([[m_webView _geolocationProvider] lastPosition]);
+#else
+    return 0;
+#endif
+}
diff --git a/WebKit/mac/WebView/WebGeolocationPosition.h b/WebKit/mac/WebView/WebGeolocationPosition.h
new file mode 100644
index 0000000..99348b4
--- /dev/null
+++ b/WebKit/mac/WebView/WebGeolocationPosition.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+ at class WebGeolocationPositionInternal;
+
+ at interface WebGeolocationPosition : NSObject
+{
+    WebGeolocationPositionInternal *_internal;
+}
+
+- (id)initWithTimestamp:(double)timestamp latitude:(double)latitude longitude:(double)longitude accuracy:(double)accuracy;
+
+ at end
diff --git a/WebKit/mac/WebView/WebGeolocationPosition.mm b/WebKit/mac/WebView/WebGeolocationPosition.mm
new file mode 100644
index 0000000..46f62c1
--- /dev/null
+++ b/WebKit/mac/WebView/WebGeolocationPosition.mm
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#import "WebGeolocationPosition.h"
+
+#import "WebGeolocationPositionInternal.h"
+#import <wtf/PassRefPtr.h>
+#import <wtf/RefPtr.h>
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#import <WebCore/GeolocationPosition.h>
+
+using namespace WebCore;
+#endif
+
+ at interface WebGeolocationPositionInternal : NSObject
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+{
+ at public
+    RefPtr<GeolocationPosition> _position;
+}
+
+- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition;
+#endif
+ at end
+
+ at implementation WebGeolocationPositionInternal
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    _position = coreGeolocationPosition;
+    return self;
+}
+#endif
+
+ at end
+
+ at implementation WebGeolocationPosition
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+GeolocationPosition* core(WebGeolocationPosition *position)
+{
+    return position ? position->_internal->_position.get() : 0;
+}
+#endif
+
+- (id)initWithTimestamp:(double)timestamp latitude:(double)latitude longitude:(double)longitude accuracy:(double)accuracy
+{
+    self = [super init];
+    if (!self)
+        return nil;
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    _internal = [[WebGeolocationPositionInternal alloc] initWithCoreGeolocationPosition:GeolocationPosition::create(timestamp, latitude, longitude, accuracy)];
+#else
+    _internal = [[WebGeolocationPositionInternal alloc] init];
+#endif
+    return self;
+}
+
+ at end
diff --git a/WebKit/mac/WebView/WebGeolocationPositionInternal.h b/WebKit/mac/WebView/WebGeolocationPositionInternal.h
new file mode 100644
index 0000000..27f8a39
--- /dev/null
+++ b/WebKit/mac/WebView/WebGeolocationPositionInternal.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#import "WebGeolocationPosition.h"
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+namespace WebCore {
+    class GeolocationPosition;
+}
+
+WebCore::GeolocationPosition* core(WebGeolocationPosition *);
+
+#endif
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 8300231..faafc25 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -56,6 +56,8 @@
 #import "WebFormDelegatePrivate.h"
 #import "WebFrameInternal.h"
 #import "WebFrameViewInternal.h"
+#import "WebGeolocationControllerClient.h"
+#import "WebGeolocationPositionInternal.h"
 #import "WebHTMLRepresentation.h"
 #import "WebHTMLViewInternal.h"
 #import "WebHistoryItemInternal.h"
@@ -163,6 +165,11 @@
 #import <WebKit/WebDashboardRegion.h>
 #endif
 
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#import <WebCore/GeolocationController.h>
+#import <WebCore/GeolocationError.h>
+#endif
+
 @interface NSSpellChecker (WebNSSpellCheckerDetails)
 - (void)_preflightChosenSpellServer;
 @end
@@ -608,7 +615,7 @@ static bool runningTigerMail()
         didOneTimeInitialization = true;
     }
 
-    _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), 0);
+    _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), new WebGeolocationControllerClient(self));
 
     _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
 
@@ -5578,6 +5585,41 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi
 
 @end
 
+ at implementation WebView (WebViewGeolocation)
+
+- (void)_setGeolocationProvider:(id<WebGeolocationProvider>)geolocationProvider
+{
+    if (_private)
+        _private->_geolocationProvider = geolocationProvider;
+}
+
+- (id<WebGeolocationProvider>)_geolocationProvider
+{
+    if (_private)
+        return _private->_geolocationProvider;
+    return nil;
+}
+
+- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    if (_private && _private->page)
+        _private->page->geolocationController()->positionChanged(core(position));
+#endif
+}
+
+- (void)_geolocationDidFailWithError:(NSError *)error
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+    if (_private && _private->page) {
+        RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, [error localizedDescription]);
+        _private->page->geolocationController()->errorOccurred(geolocatioError.get());
+    }
+#endif
+}
+
+ at end
+
 #ifdef BUILDING_ON_LEOPARD
 
 static IMP originalRecursivelyRemoveMailAttributesImp;
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index 37024c7..b0569a2 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -43,6 +43,7 @@ namespace WebCore {
 @class WebPreferences;
 @class WebTextCompletionController;
 @protocol WebFormDelegate;
+ at protocol WebGeolocationProvider;
 #if ENABLE(VIDEO)
 @class WebVideoFullscreenController;
 #endif
@@ -165,5 +166,7 @@ extern int pluginDatabaseClientCount;
 #if ENABLE(VIDEO)
     WebVideoFullscreenController *fullscreenController;
 #endif
+
+    id<WebGeolocationProvider> _geolocationProvider;
 }
 @end
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 0622d4c..ee7ec4b 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -43,6 +43,7 @@
 
 @class NSError;
 @class WebFrame;
+ at class WebGeolocationPosition;
 @class WebInspector;
 @class WebPreferences;
 @class WebScriptWorld;
@@ -573,6 +574,20 @@ Could be worth adding to the API.
 - (BOOL)_selectionIsAll;
 @end
 
+ at protocol WebGeolocationProvider <NSObject>
+- (void)registerWebView:(WebView *)webView;
+- (void)unregisterWebView:(WebView *)webView;
+- (WebGeolocationPosition *)lastPosition;
+ at end
+
+ at interface WebView (WebViewGeolocation)
+- (void)_setGeolocationProvider:(id<WebGeolocationProvider>)locationProvider;
+- (id<WebGeolocationProvider>)_geolocationProvider;
+
+- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
+- (void)_geolocationDidFailWithError:(NSError *)error;
+ at end
+
 @interface NSObject (WebFrameLoadDelegatePrivate)
 - (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list