Commit d633d844 authored by weinig@apple.com's avatar weinig@apple.com

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
parent 3fc0b2c0
2009-12-18 Sam Weinig <sam@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@apple.com>
Build fix. Disable debug variants of WebKit frameworks.
......
......@@ -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;
};
......
2009-12-18 Sam Weinig <sam@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@webkit.org>
Reviewed by Adam Barth.
......
......@@ -53,6 +53,10 @@
#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];
......
......@@ -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;
......
/*
* 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;
}
@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;
};
/*
* 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
}
/*
* 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.
*/
@class WebGeolocationPositionInternal;
@interface WebGeolocationPosition : NSObject
{
WebGeolocationPositionInternal *_internal;
}
- (id)initWithTimestamp:(double)timestamp latitude:(double)latitude longitude:(double)longitude accuracy:(double)accuracy;
@end
/*
* 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
@interface WebGeolocationPositionInternal : NSObject
#if ENABLE(CLIENT_BASED_GEOLOCATION)
{
@public
RefPtr<GeolocationPosition> _position;
}
- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition;
#endif
@end
@implementation WebGeolocationPositionInternal
#if ENABLE(CLIENT_BASED_GEOLOCATION)
- (id)initWithCoreGeolocationPosition:(PassRefPtr<GeolocationPosition>)coreGeolocationPosition
{
self = [super init];
if (!self)
return nil;
_position = coreGeolocationPosition;
return self;
}
#endif
@end
@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;
}
@end
/*
* 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
......@@ -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
@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
}
@end
#ifdef BUILDING_ON_LEOPARD
static IMP originalRecursivelyRemoveMailAttributesImp;
......
......@@ -43,6 +43,7 @@ namespace WebCore {
@class WebPreferences;
@class WebTextCompletionController;
@protocol WebFormDelegate;
@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
......@@ -43,6 +43,7 @@
@class NSError;
@class WebFrame;
@class WebGeolocationPosition;
@class WebInspector;
@class WebPreferences;
@class WebScriptWorld;
......@@ -573,6 +574,20 @@ Could be worth adding to the API.
- (BOOL)_selectionIsAll;
@end
@protocol WebGeolocationProvider <NSObject>
- (void)registerWebView:(WebView *)webView;
- (void)unregisterWebView:(WebView *)webView;
- (WebGeolocationPosition *)lastPosition;
@end
@interface WebView (WebViewGeolocation)
- (void)_setGeolocationProvider:(id<WebGeolocationProvider>)locationProvider;
- (id<WebGeolocationProvider>)_geolocationProvider;
- (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
- (void)_geolocationDidFailWithError:(NSError *)error;
@end
@interface NSObject (WebFrameLoadDelegatePrivate)
- (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment