Changeset 158936 in webkit


Ignore:
Timestamp:
Nov 8, 2013 11:49:32 AM (10 years ago)
Author:
andersca@apple.com
Message:

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:
Location:
trunk/Source/WebKit2
Files:
5 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r158930 r158936  
     12013-11-08  Anders Carlsson  <andersca@apple.com>
     2
     3        Add A WKBrowsingContextHandle class
     4        https://bugs.webkit.org/show_bug.cgi?id=124058
     5
     6        Reviewed by Sam Weinig.
     7
     8        The WKBrowsingContextHandle class represents a browsing context and can be sent across process boundaries.
     9
     10        * Shared/API/Cocoa/WKBrowsingContextHandle.h: Added.
     11        * Shared/API/Cocoa/WKBrowsingContextHandle.mm: Added.
     12        (-[WKBrowsingContextHandle _initWithPageID:]):
     13        (-[WKBrowsingContextHandle encodeWithCoder:]):
     14        (-[WKBrowsingContextHandle initWithCoder:]):
     15        (+[WKBrowsingContextHandle supportsSecureCoding]):
     16        * Shared/API/Cocoa/WKBrowsingContextHandleInternal.h: Added.
     17        * UIProcess/API/mac/WKBrowsingContextController.mm:
     18        (-[WKBrowsingContextController handle]):
     19        * UIProcess/API/mac/WKBrowsingContextControllerInternal.h:
     20        * UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
     21        (NS_ENUM):
     22        * WebKit2.xcodeproj/project.pbxproj:
     23
    1242013-11-08  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebKit2/Shared/API/Cocoa/WKBrowsingContextHandle.h

    r158930 r158936  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import <WebKit2/WKBrowsingContextController.h>
     26#import <WebKit2/WKFoundation.h>
    2727
    28 @interface WKBrowsingContextController (Internal)
     28#if WK_API_ENABLED
    2929
    30 /* This should only be called from associate view. */
    31 - (id)_initWithPageRef:(WKPageRef)pageRef;
     30WK_API_CLASS
     31@interface WKBrowsingContextHandle : NSObject <NSSecureCoding>
     32@end
    3233
    33 /* Returns a WKBrowsingContextController associated with the WKPageRef. */
    34 + (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef;
    35 
    36 + (NSMutableSet *)customSchemes;
    37 
    38 @end
     34#endif
  • trunk/Source/WebKit2/Shared/API/Cocoa/WKBrowsingContextHandle.mm

    r158930 r158936  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import <WebKit2/WKBrowsingContextController.h>
     26#import "config.h"
     27#import "WKBrowsingContextHandleInternal.h"
    2728
    28 @interface WKBrowsingContextController (Internal)
     29#if WK_API_ENABLED
    2930
    30 /* This should only be called from associate view. */
    31 - (id)_initWithPageRef:(WKPageRef)pageRef;
     31@implementation WKBrowsingContextHandle
    3232
    33 /* Returns a WKBrowsingContextController associated with the WKPageRef. */
    34 + (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef;
     33- (id)_initWithPageID:(uint64_t)pageID
     34{
     35    if (!(self = [super init]))
     36        return nil;
    3537
    36 + (NSMutableSet *)customSchemes;
     38    _pageID = pageID;
     39
     40    return self;
     41}
     42
     43- (void)encodeWithCoder:(NSCoder *)coder
     44{
     45    [coder encodeInt64:_pageID forKey:@"pageID"];
     46}
     47
     48- (id)initWithCoder:(NSCoder *)coder
     49{
     50    if (!(self = [super init]))
     51        return nil;
     52
     53    _pageID = [coder decodeInt64ForKey:@"pageID"];
     54
     55    return self;
     56}
     57
     58+ (BOOL)supportsSecureCoding
     59{
     60    return YES;
     61}
    3762
    3863@end
     64
     65#endif // WK_API_ENABLED
  • trunk/Source/WebKit2/Shared/API/Cocoa/WKBrowsingContextHandleInternal.h

    r158930 r158936  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import <WebKit2/WKBrowsingContextController.h>
     26#import "WKBrowsingContextHandle.h"
    2727
    28 @interface WKBrowsingContextController (Internal)
     28@interface WKBrowsingContextHandle ()
    2929
    30 /* This should only be called from associate view. */
    31 - (id)_initWithPageRef:(WKPageRef)pageRef;
     30@property (nonatomic, readonly, getter = _pageID) uint64_t pageID;
    3231
    33 /* Returns a WKBrowsingContextController associated with the WKPageRef. */
    34 + (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef;
    35 
    36 + (NSMutableSet *)customSchemes;
     32- (id)_initWithPageID:(uint64_t)pageID;
    3733
    3834@end
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm

    r158799 r158936  
    2525
    2626#import "config.h"
    27 #import "WKBrowsingContextController.h"
    28 #import "WKBrowsingContextControllerPrivate.h"
    2927#import "WKBrowsingContextControllerInternal.h"
    3028
     
    5048#import <wtf/RetainPtr.h>
    5149
     50#import "WKBrowsingContextHandleInternal.h"
    5251#import "WKBrowsingContextLoadDelegate.h"
    5352#import "WKBrowsingContextPolicyDelegate.h"
     
    459458}
    460459
     460- (WKBrowsingContextHandle *)handle
     461{
     462    return [[[WKBrowsingContextHandle alloc] _initWithPageID:toImpl(self._pageRef)->pageID()] autorelease];
     463}
     464
    461465@end
    462466
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h

    r157681 r158936  
    2424 */
    2525
    26 #import <WebKit2/WKBrowsingContextController.h>
     26#import "WKBrowsingContextControllerPrivate.h"
    2727
    2828@interface WKBrowsingContextController (Internal)
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h

    r157681 r158936  
    2727#import <WebKit2/WKBase.h>
    2828
    29 enum {
     29typedef NS_ENUM(NSUInteger, WKBrowsingContextPaginationMode) {
    3030    WKPaginationModeUnpaginated,
    3131    WKPaginationModeLeftToRight,
     
    3434    WKPaginationModeBottomToTop,
    3535};
    36 typedef NSUInteger WKBrowsingContextPaginationMode;
     36
     37@class WKBrowsingContextHandle;
    3738
    3839@interface WKBrowsingContextController (Private)
    3940
    40 @property(readonly) WKPageRef _pageRef;
     41@property (readonly) WKPageRef _pageRef;
    4142
    4243@property WKBrowsingContextPaginationMode paginationMode;
     44
    4345// Whether the column-break-{before,after} properties are respected instead of the
    4446// page-break-{before,after} properties.
    4547@property BOOL paginationBehavesLikeColumns;
     48
    4649// Set to 0 to have the page length equal the view length.
    4750@property CGFloat pageLength;
    4851@property CGFloat gapBetweenPages;
    4952
    50 @property(readonly) NSUInteger pageCount;
     53@property (readonly) NSUInteger pageCount;
     54
     55#if WK_API_ENABLED
     56@property (nonatomic, readonly) WKBrowsingContextHandle *handle;
     57#endif
    5158
    5259@end
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r158819 r158936  
    267267                1AD3306E16B1D991004F60E7 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3306C16B1D991004F60E7 /* StorageAreaImpl.cpp */; };
    268268                1AD3306F16B1D991004F60E7 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD3306D16B1D991004F60E7 /* StorageAreaImpl.h */; };
     269                1AE00D4C182D6EB000087DD7 /* WKBrowsingContextHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */; };
     270                1AE00D4D182D6EB000087DD7 /* WKBrowsingContextHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */; };
     271                1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */; };
    269272                1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; };
    270273                1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4976611FF658E0048B464 /* NPJSObject.h */; };
     
    17511754                1AD3306C16B1D991004F60E7 /* StorageAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaImpl.cpp; sourceTree = "<group>"; };
    17521755                1AD3306D16B1D991004F60E7 /* StorageAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaImpl.h; sourceTree = "<group>"; };
     1756                1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBrowsingContextHandle.mm; sourceTree = "<group>"; };
     1757                1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandle.h; sourceTree = "<group>"; };
     1758                1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandleInternal.h; sourceTree = "<group>"; };
    17531759                1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; };
    17541760                1AE4976611FF658E0048B464 /* NPJSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObject.h; sourceTree = "<group>"; };
     
    37303736                        isa = PBXGroup;
    37313737                        children = (
     3738                                1AE00D4B182D6EB000087DD7 /* WKBrowsingContextHandle.h */,
     3739                                1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */,
     3740                                1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */,
    37323741                                37DFA6FF1810BB92001F4A9F /* WKFoundation.h */,
    37333742                                1A9E32991822E1CC00F5D04C /* WKRemoteObject.h */,
     
    56195628                                51FCB18917BBFE0300394CD8 /* SynchronousNetworkLoaderClient.h in Headers */,
    56205629                                BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */,
     5630                                1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */,
    56215631                                BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */,
    56225632                                BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */,
     
    58965906                                BC57450C1263B155006F0F12 /* WKBundleNodeHandlePrivate.h in Headers */,
    58975907                                BC20528111C94284008F3375 /* WKBundlePage.h in Headers */,
     5908                                1AE00D4D182D6EB000087DD7 /* WKBrowsingContextHandle.h in Headers */,
    58985909                                7CF47FF717275B71008ACB91 /* WKBundlePageBanner.h in Headers */,
    58995910                                7CF47FFF17276AE3008ACB91 /* WKBundlePageBannerMac.h in Headers */,
     
    67626773                                E1A31735134CEA80007C9A4F /* AttributedString.mm in Sources */,
    67636774                                512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
     6775                                1AE00D4C182D6EB000087DD7 /* WKBrowsingContextHandle.mm in Sources */,
    67646776                                512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
    67656777                                518E8EF816B2091C00E91429 /* AuthenticationManager.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.