Commit 563f8c86 authored by andersca@apple.com's avatar andersca@apple.com

Add A WKBrowsingContextHandle class

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

Reviewed by Sam Weinig.

The WKBrowsingContextHandle class represents a browsing context and can be sent across process boundaries.

* Shared/API/Cocoa/WKBrowsingContextHandle.h: Added.
* Shared/API/Cocoa/WKBrowsingContextHandle.mm: Added.
(-[WKBrowsingContextHandle _initWithPageID:]):
(-[WKBrowsingContextHandle encodeWithCoder:]):
(-[WKBrowsingContextHandle initWithCoder:]):
(+[WKBrowsingContextHandle supportsSecureCoding]):
* Shared/API/Cocoa/WKBrowsingContextHandleInternal.h: Added.
* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController handle]):
* UIProcess/API/mac/WKBrowsingContextControllerInternal.h:
* UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
(NS_ENUM):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 123c7261
2013-11-08 Anders Carlsson <andersca@apple.com>
Add A WKBrowsingContextHandle class
https://bugs.webkit.org/show_bug.cgi?id=124058
Reviewed by Sam Weinig.
The WKBrowsingContextHandle class represents a browsing context and can be sent across process boundaries.
* Shared/API/Cocoa/WKBrowsingContextHandle.h: Added.
* Shared/API/Cocoa/WKBrowsingContextHandle.mm: Added.
(-[WKBrowsingContextHandle _initWithPageID:]):
(-[WKBrowsingContextHandle encodeWithCoder:]):
(-[WKBrowsingContextHandle initWithCoder:]):
(+[WKBrowsingContextHandle supportsSecureCoding]):
* Shared/API/Cocoa/WKBrowsingContextHandleInternal.h: Added.
* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController handle]):
* UIProcess/API/mac/WKBrowsingContextControllerInternal.h:
* UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
(NS_ENUM):
* WebKit2.xcodeproj/project.pbxproj:
2013-11-08 Anders Carlsson <andersca@apple.com>
Add WKRemoteObjectRegistry to WKConnection
......
/*
* Copyright (C) 2013 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 <WebKit2/WKFoundation.h>
#if WK_API_ENABLED
WK_API_CLASS
@interface WKBrowsingContextHandle : NSObject <NSSecureCoding>
@end
#endif
/*
* Copyright (C) 2013 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 "config.h"
#import "WKBrowsingContextHandleInternal.h"
#if WK_API_ENABLED
@implementation WKBrowsingContextHandle
- (id)_initWithPageID:(uint64_t)pageID
{
if (!(self = [super init]))
return nil;
_pageID = pageID;
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeInt64:_pageID forKey:@"pageID"];
}
- (id)initWithCoder:(NSCoder *)coder
{
if (!(self = [super init]))
return nil;
_pageID = [coder decodeInt64ForKey:@"pageID"];
return self;
}
+ (BOOL)supportsSecureCoding
{
return YES;
}
@end
#endif // WK_API_ENABLED
/*
* Copyright (C) 2013 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 "WKBrowsingContextHandle.h"
@interface WKBrowsingContextHandle ()
@property (nonatomic, readonly, getter = _pageID) uint64_t pageID;
- (id)_initWithPageID:(uint64_t)pageID;
@end
......@@ -24,8 +24,6 @@
*/
#import "config.h"
#import "WKBrowsingContextController.h"
#import "WKBrowsingContextControllerPrivate.h"
#import "WKBrowsingContextControllerInternal.h"
#import "ObjCObjectGraph.h"
......@@ -49,6 +47,7 @@
#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/RetainPtr.h>
#import "WKBrowsingContextHandleInternal.h"
#import "WKBrowsingContextLoadDelegate.h"
#import "WKBrowsingContextPolicyDelegate.h"
......@@ -458,6 +457,11 @@ static void releaseNSData(unsigned char*, const void* data)
return WKPageGetPageCount(self._pageRef);
}
- (WKBrowsingContextHandle *)handle
{
return [[[WKBrowsingContextHandle alloc] _initWithPageID:toImpl(self._pageRef)->pageID()] autorelease];
}
@end
@implementation WKBrowsingContextController (Internal)
......
......@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <WebKit2/WKBrowsingContextController.h>
#import "WKBrowsingContextControllerPrivate.h"
@interface WKBrowsingContextController (Internal)
......
......@@ -26,27 +26,34 @@
#import <WebKit2/WKBrowsingContextController.h>
#import <WebKit2/WKBase.h>
enum {
typedef NS_ENUM(NSUInteger, WKBrowsingContextPaginationMode) {
WKPaginationModeUnpaginated,
WKPaginationModeLeftToRight,
WKPaginationModeRightToLeft,
WKPaginationModeTopToBottom,
WKPaginationModeBottomToTop,
};
typedef NSUInteger WKBrowsingContextPaginationMode;
@class WKBrowsingContextHandle;
@interface WKBrowsingContextController (Private)
@property(readonly) WKPageRef _pageRef;
@property (readonly) WKPageRef _pageRef;
@property WKBrowsingContextPaginationMode paginationMode;
// Whether the column-break-{before,after} properties are respected instead of the
// page-break-{before,after} properties.
@property BOOL paginationBehavesLikeColumns;
// Set to 0 to have the page length equal the view length.
@property CGFloat pageLength;
@property CGFloat gapBetweenPages;
@property(readonly) NSUInteger pageCount;
@property (readonly) NSUInteger pageCount;
#if WK_API_ENABLED
@property (nonatomic, readonly) WKBrowsingContextHandle *handle;
#endif
@end
......@@ -266,6 +266,9 @@
1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */; };
1AD3306E16B1D991004F60E7 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3306C16B1D991004F60E7 /* StorageAreaImpl.cpp */; };
1AD3306F16B1D991004F60E7 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD3306D16B1D991004F60E7 /* StorageAreaImpl.h */; };
1AE00D4C182D6EB000087DD7 /* WKBrowsingContextHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */; };
1AE00D4D182D6EB000087DD7 /* WKBrowsingContextHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */; };
1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */; };
1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; };
1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4976611FF658E0048B464 /* NPJSObject.h */; };
1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4976711FF658E0048B464 /* NPJSObject.cpp */; };
......@@ -1750,6 +1753,9 @@
1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxyMap.h; sourceTree = "<group>"; };
1AD3306C16B1D991004F60E7 /* StorageAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaImpl.cpp; sourceTree = "<group>"; };
1AD3306D16B1D991004F60E7 /* StorageAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaImpl.h; sourceTree = "<group>"; };
1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBrowsingContextHandle.mm; sourceTree = "<group>"; };
1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandle.h; sourceTree = "<group>"; };
1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandleInternal.h; sourceTree = "<group>"; };
1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; };
1AE4976611FF658E0048B464 /* NPJSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObject.h; sourceTree = "<group>"; };
1AE4976711FF658E0048B464 /* NPJSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPJSObject.cpp; sourceTree = "<group>"; };
......@@ -3729,6 +3735,9 @@
37DFA6FE1810BB2D001F4A9F /* Cocoa */ = {
isa = PBXGroup;
children = (
1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */,
1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */,
1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */,
37DFA6FF1810BB92001F4A9F /* WKFoundation.h */,
1A9E32991822E1CC00F5D04C /* WKRemoteObject.h */,
1A9E32981822E1CC00F5D04C /* WKRemoteObject.mm */,
......@@ -5618,6 +5627,7 @@
E19582D3153CBFD700B60875 /* PDFKitImports.h in Headers */,
51FCB18917BBFE0300394CD8 /* SynchronousNetworkLoaderClient.h in Headers */,
BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */,
1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */,
BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */,
BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */,
1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */,
......@@ -5895,6 +5905,7 @@
BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */,
BC57450C1263B155006F0F12 /* WKBundleNodeHandlePrivate.h in Headers */,
BC20528111C94284008F3375 /* WKBundlePage.h in Headers */,
1AE00D4D182D6EB000087DD7 /* WKBrowsingContextHandle.h in Headers */,
7CF47FF717275B71008ACB91 /* WKBundlePageBanner.h in Headers */,
7CF47FFF17276AE3008ACB91 /* WKBundlePageBannerMac.h in Headers */,
BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */,
......@@ -6761,6 +6772,7 @@
BCEE966C112FAF57006BCC24 /* Attachment.cpp in Sources */,
E1A31735134CEA80007C9A4F /* AttributedString.mm in Sources */,
512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
1AE00D4C182D6EB000087DD7 /* WKBrowsingContextHandle.mm in Sources */,
512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
518E8EF816B2091C00E91429 /* AuthenticationManager.cpp in Sources */,
518E8EFB16B2091C00E91429 /* AuthenticationManager.mac.mm in Sources */,
......
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