Commit 181d4157 authored by andersca@apple.com's avatar andersca@apple.com

More work on WKBrowsingContextHandle

https://bugs.webkit.org/show_bug.cgi?id=124060

Reviewed by Beth Dakin.

Implement -hash and -isEqual: and add -[WKWebProcessPlugInBrowserContextController handle].

* Shared/API/Cocoa/WKBrowsingContextHandle.mm:
(-[WKBrowsingContextHandle hash]):
(-[WKBrowsingContextHandle isEqual:]):
* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(decodeInvocation):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController mainFrameDocument]):
(-[WKWebProcessPlugInBrowserContextController selectedRange]):
(-[WKWebProcessPlugInBrowserContextController handle]):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 26c53408
2013-11-08 Anders Carlsson <andersca@apple.com>
More work on WKBrowsingContextHandle
https://bugs.webkit.org/show_bug.cgi?id=124060
Reviewed by Beth Dakin.
Implement -hash and -isEqual: and add -[WKWebProcessPlugInBrowserContextController handle].
* Shared/API/Cocoa/WKBrowsingContextHandle.mm:
(-[WKBrowsingContextHandle hash]):
(-[WKBrowsingContextHandle isEqual:]):
* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(decodeInvocation):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController mainFrameDocument]):
(-[WKWebProcessPlugInBrowserContextController selectedRange]):
(-[WKWebProcessPlugInBrowserContextController handle]):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2013-11-08 Anders Carlsson <andersca@apple.com>
Add A WKBrowsingContextHandle class
......
......@@ -40,6 +40,19 @@
return self;
}
- (NSUInteger)hash
{
return _pageID;
}
- (BOOL)isEqual:(id)object
{
if (![object isKindOfClass:[WKBrowsingContextHandle class]])
return NO;
return _pageID == static_cast<WKBrowsingContextHandle *>(object)->_pageID;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeInt64:_pageID forKey:@"pageID"];
......
......@@ -420,7 +420,7 @@ static NSInvocation *decodeInvocation(WKRemoteObjectDecoder *decoder)
[NSException raise:NSInvalidUnarchiveOperationException format:@"Invocation had no type signature"];
NSMethodSignature *remoteMethodSignature = [NSMethodSignature signatureWithObjCTypes:typeSignature.UTF8String];
if (![localMethodSignature isEqualTo:remoteMethodSignature])
if (![localMethodSignature isEqual:remoteMethodSignature])
[NSException raise:NSInvalidUnarchiveOperationException format:@"Local and remote method signatures are not equal for method \"%@\"", selectorString];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:localMethodSignature];
......
......@@ -25,12 +25,11 @@
#import "config.h"
#import "WKWebProcessPlugInBrowserContextController.h"
#import "WKWebProcessPlugInBrowserContextControllerInternal.h"
#import "WKWebProcessPlugInBrowserContextControllerPrivate.h"
#if WK_API_ENABLED
#import "WKBrowsingContextHandleInternal.h"
#import "WKBundleAPICast.h"
#import "WKBundlePage.h"
#import "WKBundlePagePrivate.h"
......@@ -40,13 +39,12 @@
#import <WebCore/Document.h>
#import <WebCore/Frame.h>
@interface WKWebProcessPlugInBrowserContextController () {
// Underlying WKBundlePageRef.
using namespace WebCore;
using namespace WebKit;
@implementation WKWebProcessPlugInBrowserContextController {
WKRetainPtr<WKBundlePageRef> _bundlePageRef;
}
@end
@implementation WKWebProcessPlugInBrowserContextController (Internal)
- (id)_initWithBundlePageRef:(WKBundlePageRef)bundlePageRef
{
......@@ -59,26 +57,22 @@
return self;
}
@end
@implementation WKWebProcessPlugInBrowserContextController
- (WKDOMDocument *)mainFrameDocument
{
WebCore::Frame* webCoreMainFrame = WebKit::toImpl(self._bundlePageRef)->mainFrame();
WebCore::Frame* webCoreMainFrame = toImpl(_bundlePageRef.get())->mainFrame();
if (!webCoreMainFrame)
return nil;
return WebKit::toWKDOMDocument(webCoreMainFrame->document());
return toWKDOMDocument(webCoreMainFrame->document());
}
- (WKDOMRange *)selectedRange
{
RefPtr<WebCore::Range> range = WebKit::toImpl(self._bundlePageRef)->currentSelectionAsRange();
RefPtr<WebCore::Range> range = toImpl(_bundlePageRef.get())->currentSelectionAsRange();
if (!range)
return nil;
return WebKit::toWKDOMRange(range.get());
return toWKDOMRange(range.get());
}
@end
......@@ -90,6 +84,11 @@
return _bundlePageRef.get();
}
- (WKBrowsingContextHandle *)handle
{
return [[[WKBrowsingContextHandle alloc] _initWithPageID:toImpl(_bundlePageRef.get())->pageID()] autorelease];
}
@end
#endif // WK_API_ENABLED
......@@ -23,12 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WKWebProcessPlugInBrowserContextController.h"
#import "WKWebProcessPlugInBrowserContextControllerPrivate.h"
#import "WKBase.h"
#if WK_API_ENABLED
@interface WKWebProcessPlugInBrowserContextController (Internal)
@interface WKWebProcessPlugInBrowserContextController ()
- (id)_initWithBundlePageRef:(WKBundlePageRef)bundlePageRef;
......
......@@ -27,9 +27,15 @@
#if WK_API_ENABLED
#import <WebKit2/WKBase.h>
@class WKBrowsingContextHandle;
@interface WKWebProcessPlugInBrowserContextController (Private)
@property(readonly) WKBundlePageRef _bundlePageRef;
@property (nonatomic, readonly) WKBundlePageRef _bundlePageRef;
@property (nonatomic, readonly) WKBrowsingContextHandle *handle;
@end
......
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