Title: [97882] trunk/Source/WebKit2
Revision
97882
Author
[email protected]
Date
2011-10-19 15:03:41 -0700 (Wed, 19 Oct 2011)

Log Message

Add skeleton of an Objective-C WebKit2 API
https://bugs.webkit.org/show_bug.cgi?id=70438

Reviewed by Anders Carlsson.

Adds WKBrowsingContextController (WKPageRef wrapper) and WKProcessCluster
(WKContextRef wrapper) as initial files of an Objective-C WebKit2 API. Also,
hook them up so that you can get a WKBrowsingContextController from the WKView
and you can create a WKView associated with a WKProcessCluster. These names are
not final, and this work is mainly about getting the wrapper lifetimes worked
out.

* UIProcess/API/mac/WKBrowsingContextController.h: Added.
* UIProcess/API/mac/WKBrowsingContextController.mm: Added.
(-[WKBrowsingContextController dealloc]):
(-[WKBrowsingContextController pageRef]):
(-[WKBrowsingContextController loadRequest:]):
(-[WKBrowsingContextController loadFileURL:restrictToFilesWithin:]):
(-[WKBrowsingContextController stopLoading]):
(-[WKBrowsingContextController reload]):
(-[WKBrowsingContextController reloadFromOrigin]):
(-[WKBrowsingContextController goForward]):
(-[WKBrowsingContextController canGoForward]):
(-[WKBrowsingContextController goBack]):
(-[WKBrowsingContextController canGoBack]):
(-[WKBrowsingContextController initWithPageRef:]):
* UIProcess/API/mac/WKBrowsingContextControllerInternal.h: Added.
Add wrapper for WKPageRef.

* UIProcess/API/mac/WKProcessCluster.h: Added.
* UIProcess/API/mac/WKProcessCluster.mm: Added.
(-[WKProcessCluster init]):
(-[WKProcessCluster initWithInjectedBundleURL:]):
(-[WKProcessCluster dealloc]):
(-[WKProcessCluster contextRef]):
* UIProcess/API/mac/WKProcessClusterInternal.h: Added.
Add wrapper for WKContextRef.

* UIProcess/API/mac/WKView.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:processCluster:]):
Add new init method which takes a WKProcessCluster.

(-[WKView browsingContextController]):
Add accessor for the WKBrowsingContextController. This works by lazily creating
the wrapper and caching it in the view itself.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (97881 => 97882)


--- trunk/Source/WebKit2/ChangeLog	2011-10-19 21:54:38 UTC (rev 97881)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-19 22:03:41 UTC (rev 97882)
@@ -1,3 +1,55 @@
+2011-10-19  Sam Weinig  <[email protected]>
+
+        Add skeleton of an Objective-C WebKit2 API
+        https://bugs.webkit.org/show_bug.cgi?id=70438
+
+        Reviewed by Anders Carlsson.
+
+        Adds WKBrowsingContextController (WKPageRef wrapper) and WKProcessCluster
+        (WKContextRef wrapper) as initial files of an Objective-C WebKit2 API. Also,
+        hook them up so that you can get a WKBrowsingContextController from the WKView
+        and you can create a WKView associated with a WKProcessCluster. These names are
+        not final, and this work is mainly about getting the wrapper lifetimes worked
+        out.
+
+        * UIProcess/API/mac/WKBrowsingContextController.h: Added.
+        * UIProcess/API/mac/WKBrowsingContextController.mm: Added.
+        (-[WKBrowsingContextController dealloc]):
+        (-[WKBrowsingContextController pageRef]):
+        (-[WKBrowsingContextController loadRequest:]):
+        (-[WKBrowsingContextController loadFileURL:restrictToFilesWithin:]):
+        (-[WKBrowsingContextController stopLoading]):
+        (-[WKBrowsingContextController reload]):
+        (-[WKBrowsingContextController reloadFromOrigin]):
+        (-[WKBrowsingContextController goForward]):
+        (-[WKBrowsingContextController canGoForward]):
+        (-[WKBrowsingContextController goBack]):
+        (-[WKBrowsingContextController canGoBack]):
+        (-[WKBrowsingContextController initWithPageRef:]):
+        * UIProcess/API/mac/WKBrowsingContextControllerInternal.h: Added.
+        Add wrapper for WKPageRef.
+
+        * UIProcess/API/mac/WKProcessCluster.h: Added.
+        * UIProcess/API/mac/WKProcessCluster.mm: Added.
+        (-[WKProcessCluster init]):
+        (-[WKProcessCluster initWithInjectedBundleURL:]):
+        (-[WKProcessCluster dealloc]):
+        (-[WKProcessCluster contextRef]):
+        * UIProcess/API/mac/WKProcessClusterInternal.h: Added.
+        Add wrapper for WKContextRef.
+
+        * UIProcess/API/mac/WKView.h:
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:processCluster:]):
+        Add new init method which takes a WKProcessCluster.
+
+        (-[WKView browsingContextController]):
+        Add accessor for the WKBrowsingContextController. This works by lazily creating
+        the wrapper and caching it in the view itself.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
 2011-10-19  Caio Marcelo de Oliveira Filho  <[email protected]>
 
         [Qt] [WK2] Rename files and classes to follow conventions

Added: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h (0 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h	2011-10-19 22:03:41 UTC (rev 97882)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2011 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 <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKBrowsingContextControllerData;
+
+WK_EXPORT
+@interface WKBrowsingContextController : NSObject
+{
+    WKBrowsingContextControllerData *_data;
+}
+
+#pragma mark Loading
+
+/* Load a request. This is only valid for requests of non-file: URLs. Passing a
+   file: URL will throw an exception. */
+- (void)loadRequest:(NSURLRequest *)request;
+
+/* Load a file: URL. Opens the sandbox only for files within allowedDirectory.
+    - Passing a non-file: URL to either parameter will yeild an exception.
+    - Passing nil as the allowedDirectory will open the entire file-system for
+      reading. 
+*/
+- (void)loadFileURL:(NSURL *)URL restrictToFilesWithin:(NSURL *)allowedDirectory;
+
+/* Stops the load associated with the active URL. */
+- (void)stopLoading;
+
+/* Reload the currently active URL. */
+- (void)reload;
+
+/* Reload the currently active URL, bypassing caches. */
+- (void)reloadFromOrigin;
+
+
+#pragma mark Back/Forward
+
+/* Go to the next page in the back/forward list. */
+- (void)goForward;
+
+/* Returns whether there is a next page in the back/forward list. */
+- (BOOL)canGoForward;
+
+/* Go to the previous page in the back/forward list. */
+- (void)goBack;
+
+/* Returns whether there is a previous page in the back/forward list. */
+- (BOOL)canGoBack;
+
+@end

Added: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (0 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2011-10-19 22:03:41 UTC (rev 97882)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2011 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 "WKBrowsingContextController.h"
+#import "WKBrowsingContextControllerInternal.h"
+
+#import "WKPage.h"
+#import "WKRetainPtr.h"
+#import "WKURLRequest.h"
+#import "WKURLRequestNS.h"
+
+@interface WKBrowsingContextControllerData : NSObject {
+@public
+    WKRetainPtr<WKPageRef> _pageRef;
+}
+@end
+
+@implementation WKBrowsingContextControllerData
+@end
+
+@implementation WKBrowsingContextController
+
+- (void)dealloc
+{
+    [_data release];
+    [super dealloc];
+}
+
+- (WKPageRef)pageRef
+{
+    return _data->_pageRef.get();
+}
+
+#pragma mark Loading
+
+- (void)loadRequest:(NSURLRequest *)request
+{
+    WKRetainPtr<WKURLRequestRef> wkRequest = adoptWK(WKURLRequestCreateWithNSURLRequest(request));
+    WKPageLoadURLRequest(self.pageRef, wkRequest.get());
+}
+
+- (void)loadFileURL:(NSURL *)URL restrictToFilesWithin:(NSURL *)allowedDirectory
+{
+    /* FIXME: Implement. */
+}
+
+- (void)stopLoading
+{
+    WKPageStopLoading(self.pageRef);
+}
+
+- (void)reload
+{
+    WKPageReload(self.pageRef);
+}
+
+- (void)reloadFromOrigin
+{
+    WKPageReloadFromOrigin(self.pageRef);
+}
+
+#pragma mark Back/Forward
+
+- (void)goForward
+{
+    WKPageGoForward(self.pageRef);
+}
+
+- (BOOL)canGoForward
+{
+    return WKPageCanGoForward(self.pageRef);
+}
+
+- (void)goBack
+{
+    WKPageGoBack(self.pageRef);
+}
+
+- (BOOL)canGoBack
+{
+    return WKPageCanGoBack(self.pageRef);
+}
+
+@end
+
+
+@implementation WKBrowsingContextController (Internal)
+
+/* This should only be called from associate view. */
+
+- (id)initWithPageRef:(WKPageRef)pageRef
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _data = [[WKBrowsingContextControllerData alloc] init];
+    _data->_pageRef = pageRef;
+
+    return self;
+}
+
+@end

Added: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h (0 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h	2011-10-19 22:03:41 UTC (rev 97882)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 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/WKBrowsingContextController.h>
+
+@interface WKBrowsingContextController (Internal)
+
+/* This should only be called from associate view. */
+- (id)initWithPageRef:(WKPageRef)pageRef;
+
+@end

Added: trunk/Source/WebKit2/UIProcess/API/mac/WKProcessCluster.h (0 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKProcessCluster.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKProcessCluster.h	2011-10-19 22:03:41 UTC (rev 97882)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011 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 <Foundation/Foundation.h>
+#import <WebKit2/WKBase.h>
+
+@class WKProcessClusterData;
+
+WK_EXPORT
+@interface WKProcessCluster : NSObject
+{
+    WKProcessClusterData *_data;
+}
+
+- (id)init;
+- (id)initWithInjectedBundleURL:(NSURL *)bundleURL;
+
+@end

Added: trunk/Source/WebKit2/UIProcess/API/mac/WKProcessCluster.mm (0 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKProcessCluster.mm	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKProcessCluster.mm	2011-10-19 22:03:41 UTC (rev 97882)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2011 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 "WKProcessCluster.h"
+#import "WKProcessClusterInternal.h"
+
+#import "WKContext.h"
+#import "WKRetainPtr.h"
+#import "WKStringCF.h"
+
+@interface WKProcessClusterData : NSObject {
+@public
+    WKRetainPtr<WKContextRef> _contextRef;
+}
+@end
+
+@implementation WKProcessClusterData
+@end
+
+@implementation WKProcessCluster
+
+- (id)init
+{
+    return [self initWithInjectedBundleURL:nil];
+}
+
+- (id)initWithInjectedBundleURL:(NSURL *)bundleURL
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _data = [[WKProcessClusterData alloc] init];
+    
+    if (bundleURL) {
+        WKRetainPtr<WKStringRef> bundleURLString = adoptWK(WKStringCreateWithCFString((CFStringRef)[bundleURL absoluteString]));
+        _data->_contextRef = adoptWK(WKContextCreateWithInjectedBundlePath(bundleURLString.get()));
+    } else
+        _data->_contextRef = adoptWK(WKContextCreate());
+
+    return self;
+}
+
+- (void)dealloc
+{
+    [_data release];
+    [super dealloc];
+}
+
+@end
+
+@implementation WKProcessCluster (Internal)
+
+- (WKContextRef)contextRef
+{
+    return _data->_contextRef.get();
+}
+
+@end
+
+

Added: trunk/Source/WebKit2/UIProcess/API/mac/WKProcessClusterInternal.h (0 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKProcessClusterInternal.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKProcessClusterInternal.h	2011-10-19 22:03:41 UTC (rev 97882)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2011 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/WKProcessCluster.h>
+
+@interface WKProcessCluster (Internal)
+
+@property(readonly) WKContextRef contextRef;
+
+@end

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.h (97881 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.h	2011-10-19 21:54:38 UTC (rev 97881)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.h	2011-10-19 22:03:41 UTC (rev 97882)
@@ -26,6 +26,8 @@
 #import <Cocoa/Cocoa.h>
 #import <WebKit2/WKBase.h>
 
+@class WKBrowsingContextController;
+@class WKProcessCluster;
 @class WKViewData;
 
 WK_EXPORT
@@ -34,6 +36,10 @@
     unsigned _unused;
 }
 
+- (id)initWithFrame:(NSRect)frame processCluster:(WKProcessCluster *)processCluster;
+
+@property(readonly) WKBrowsingContextController *browsingContextController;
+
 @property BOOL drawsBackground;
 @property BOOL drawsTransparentBackground;
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (97881 => 97882)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-10-19 21:54:38 UTC (rev 97881)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-10-19 22:03:41 UTC (rev 97882)
@@ -61,10 +61,10 @@
 #import <WebCore/ColorMac.h>
 #import <WebCore/DragController.h>
 #import <WebCore/DragData.h>
-#import <WebCore/LocalizedStrings.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/IntRect.h>
 #import <WebCore/KeyboardEvent.h>
+#import <WebCore/LocalizedStrings.h>
 #import <WebCore/PlatformMouseEvent.h>
 #import <WebCore/PlatformScreen.h>
 #import <WebCore/Region.h>
@@ -72,6 +72,11 @@
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
 
+/* API internals. */
+#import "WKProcessClusterInternal.h"
+#import "WKBrowsingContextControllerInternal.h"
+
+
 @interface NSApplication (WKNSApplicationDetails)
 - (void)speakString:(NSString *)string;
 - (void)_setCurrentEvent:(NSEvent *)event;
@@ -120,6 +125,9 @@
 @public
     OwnPtr<PageClientImpl> _pageClient;
     RefPtr<WebPageProxy> _page;
+    
+    // Cache of the associated WKBrowsingContextController.
+    RetainPtr<WKBrowsingContextController> _browsingContextController;
 
     // For ToolTips.
     NSToolTipTag _lastToolTipTag;
@@ -175,6 +183,10 @@
 }
 @end
 
+@implementation WKViewData
+@end
+
+
 @interface WKResponderChainSink : NSResponder {
     NSResponder *_lastResponderInChain;
     bool _didReceiveUnhandledCommand;
@@ -184,11 +196,18 @@
 - (bool)didReceiveUnhandledCommand;
 @end
 
-@implementation WKViewData
-@end
-
 @implementation WKView
 
+- (id)initWithFrame:(NSRect)frame
+{
+    return [self initWithFrame:frame contextRef:toAPI(WebContext::sharedProcessContext())];
+}
+
+- (id)initWithFrame:(NSRect)frame processCluster:(WKProcessCluster *)processCluster
+{
+    return [self initWithFrame:frame contextRef:processCluster.contextRef];
+}
+
 - (void)dealloc
 {
     _data->_page->close();
@@ -203,6 +222,13 @@
     [super dealloc];
 }
 
+- (WKBrowsingContextController *)browsingContextController
+{
+    if (!_data->_browsingContextController)
+        _data->_browsingContextController.adoptNS([[WKBrowsingContextController alloc] initWithPageRef:[self pageRef]]);
+    return _data->_browsingContextController.get();
+}
+
 - (void)setDrawsBackground:(BOOL)drawsBackground
 {
     _data->_page->setDrawsBackground(drawsBackground);
@@ -2547,11 +2573,6 @@
 
 @implementation WKView (Private)
 
-- (id)initWithFrame:(NSRect)frame
-{
-    return [self initWithFrame:frame contextRef:toAPI(WebContext::sharedProcessContext())];
-}
-
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef
 {   
     return [self initWithFrame:frame contextRef:contextRef pageGroupRef:nil];

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (97881 => 97882)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-10-19 21:54:38 UTC (rev 97881)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-10-19 22:03:41 UTC (rev 97882)
@@ -686,6 +686,12 @@
 		BCB9F6A61123DD0D00A137E0 /* WKFramePolicyListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */; };
 		BCB9F8AF1124E07700A137E0 /* WebPolicyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9F8AD1124E07700A137E0 /* WebPolicyClient.cpp */; };
 		BCB9F8B01124E07700A137E0 /* WebPolicyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9F8AE1124E07700A137E0 /* WebPolicyClient.h */; };
+		BCBAAC72144E61990053F82F /* WKBrowsingContextController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBAAC6D144E61920053F82F /* WKBrowsingContextController.mm */; };
+		BCBAAC73144E619E0053F82F /* WKBrowsingContextController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAC6C144E61910053F82F /* WKBrowsingContextController.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BCBAAC74144E61A50053F82F /* WKBrowsingContextControllerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAC6E144E61920053F82F /* WKBrowsingContextControllerInternal.h */; settings = {ATTRIBUTES = (); }; };
+		BCBAAC77144E6CB40053F82F /* WKProcessCluster.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAC75144E6CB20053F82F /* WKProcessCluster.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BCBAAC78144E6CB40053F82F /* WKProcessCluster.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBAAC76144E6CB20053F82F /* WKProcessCluster.mm */; };
+		BCBAAC7B144E70590053F82F /* WKProcessClusterInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAC79144E70560053F82F /* WKProcessClusterInternal.h */; };
 		BCBCB0CB1215E32100DE59CA /* ImmutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */; };
 		BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */; };
 		BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBD3912125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp */; };
@@ -1642,6 +1648,12 @@
 		BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFramePolicyListener.cpp; sourceTree = "<group>"; };
 		BCB9F8AD1124E07700A137E0 /* WebPolicyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPolicyClient.cpp; sourceTree = "<group>"; };
 		BCB9F8AE1124E07700A137E0 /* WebPolicyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPolicyClient.h; sourceTree = "<group>"; };
+		BCBAAC6C144E61910053F82F /* WKBrowsingContextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextController.h; sourceTree = "<group>"; };
+		BCBAAC6D144E61920053F82F /* WKBrowsingContextController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBrowsingContextController.mm; sourceTree = "<group>"; };
+		BCBAAC6E144E61920053F82F /* WKBrowsingContextControllerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextControllerInternal.h; sourceTree = "<group>"; };
+		BCBAAC75144E6CB20053F82F /* WKProcessCluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessCluster.h; sourceTree = "<group>"; };
+		BCBAAC76144E6CB20053F82F /* WKProcessCluster.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKProcessCluster.mm; sourceTree = "<group>"; };
+		BCBAAC79144E70560053F82F /* WKProcessClusterInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessClusterInternal.h; sourceTree = "<group>"; };
 		BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmutableDictionary.h; sourceTree = "<group>"; };
 		BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImmutableDictionary.cpp; sourceTree = "<group>"; };
 		BCBD38FA125BAB9A00D2C29F /* WebPageProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPageProxy.messages.in; sourceTree = "<group>"; };
@@ -2910,8 +2922,15 @@
 			isa = PBXGroup;
 			children = (
 				BCBAAC58144E38B90053F82F /* WKView Details */,
+				BCBAAC6C144E61910053F82F /* WKBrowsingContextController.h */,
+				BCBAAC6D144E61920053F82F /* WKBrowsingContextController.mm */,
+				BCBAAC6E144E61920053F82F /* WKBrowsingContextControllerInternal.h */,
+				BCBAAC75144E6CB20053F82F /* WKProcessCluster.h */,
+				BCBAAC76144E6CB20053F82F /* WKProcessCluster.mm */,
+				BCBAAC79144E70560053F82F /* WKProcessClusterInternal.h */,
 				BC8699B2116AADAA002A925B /* WKView.h */,
 				BC8699B3116AADAA002A925B /* WKView.mm */,
+				BC8699B4116AADAA002A925B /* WKViewInternal.h */,
 				BFA6179E12F0B99D0033E0CA /* WKViewPrivate.h */,
 			);
 			path = mac;
@@ -3178,7 +3197,6 @@
 				E134F01912EA5D99004EC58D /* WKPrintingView.mm */,
 				1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */,
 				1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */,
-				BC8699B4116AADAA002A925B /* WKViewInternal.h */,
 			);
 			name = "WKView Details";
 			sourceTree = "<group>";
@@ -3890,6 +3908,10 @@
 				7801C09A142290C400FAF9AF /* WebHitTestResult.h in Headers */,
 				0F174AA3142A4CB70039250F /* WebGeometry.h in Headers */,
 				B62E7312143047B00069EC35 /* WKHitTestResult.h in Headers */,
+				BCBAAC73144E619E0053F82F /* WKBrowsingContextController.h in Headers */,
+				BCBAAC74144E61A50053F82F /* WKBrowsingContextControllerInternal.h in Headers */,
+				BCBAAC77144E6CB40053F82F /* WKProcessCluster.h in Headers */,
+				BCBAAC7B144E70590053F82F /* WKProcessClusterInternal.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -4579,6 +4601,8 @@
 				E199875E142C045400BB2DE7 /* BuiltInPDFView.cpp in Sources */,
 				0F174AA7142AAC610039250F /* WKGeometry.cpp in Sources */,
 				B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */,
+				BCBAAC72144E61990053F82F /* WKBrowsingContextController.mm in Sources */,
+				BCBAAC78144E6CB40053F82F /* WKProcessCluster.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to