Title: [98270] trunk/Source/WebKit2
- Revision
- 98270
- Author
- [email protected]
- Date
- 2011-10-24 12:55:26 -0700 (Mon, 24 Oct 2011)
Log Message
Add URL getters for the WKBrowsingContextController
https://bugs.webkit.org/show_bug.cgi?id=70752
Reviewed by Anders Carlsson.
* UIProcess/API/mac/WKBrowsingContextController.h:
* UIProcess/API/mac/WKBrowsingContextController.mm:
(autoreleased):
Added helpers for autoreleasing.
(-[WKBrowsingContextController activeURL]):
Added buy not implemented yet.
(-[WKBrowsingContextController pendingURL]):
(-[WKBrowsingContextController provisionalURL]):
(-[WKBrowsingContextController commitedURL]):
(-[WKBrowsingContextController unreachableURL]):
Added getters.
(-[WKBrowsingContextController title]):
Convert to new autoreleased helper.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (98269 => 98270)
--- trunk/Source/WebKit2/ChangeLog 2011-10-24 19:53:07 UTC (rev 98269)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-24 19:55:26 UTC (rev 98270)
@@ -1,5 +1,29 @@
2011-10-24 Sam Weinig <[email protected]>
+ Add URL getters for the WKBrowsingContextController
+ https://bugs.webkit.org/show_bug.cgi?id=70752
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/API/mac/WKBrowsingContextController.h:
+ * UIProcess/API/mac/WKBrowsingContextController.mm:
+ (autoreleased):
+ Added helpers for autoreleasing.
+
+ (-[WKBrowsingContextController activeURL]):
+ Added buy not implemented yet.
+
+ (-[WKBrowsingContextController pendingURL]):
+ (-[WKBrowsingContextController provisionalURL]):
+ (-[WKBrowsingContextController commitedURL]):
+ (-[WKBrowsingContextController unreachableURL]):
+ Added getters.
+
+ (-[WKBrowsingContextController title]):
+ Convert to new autoreleased helper.
+
+2011-10-24 Sam Weinig <[email protected]>
+
Add zoom and title support to Objective-C WebKit2 API
https://bugs.webkit.org/show_bug.cgi?id=70744
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h (98269 => 98270)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h 2011-10-24 19:53:07 UTC (rev 98269)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h 2011-10-24 19:55:26 UTC (rev 98270)
@@ -72,6 +72,24 @@
@property(readonly) BOOL canGoBack;
+#pragma mark Active Load Introspection
+
+/* URL for the active load. This is the URL that should be shown in user interface. */
+@property(readonly) NSURL *activeURL;
+
+/* URL that has been requested to load by the user, but not yet sent. */
+@property(readonly) NSURL *pendingURL;
+
+/* URL for a request that has been sent, but no response has been recieved yet. */
+@property(readonly) NSURL *provisionalURL;
+
+/* URL for a request that has been recieved, and is now being used. */
+@property(readonly) NSURL *commitedURL;
+
+/* URL for a request that had an error, whose error page is now showing. */
+@property(readonly) NSURL *unreachableURL;
+
+
#pragma mark Active Document Introspection
/* Title of the document associated with the active load. */
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (98269 => 98270)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm 2011-10-24 19:53:07 UTC (rev 98269)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm 2011-10-24 19:55:26 UTC (rev 98270)
@@ -27,12 +27,28 @@
#import "WKBrowsingContextController.h"
#import "WKBrowsingContextControllerInternal.h"
+#import "WKFrame.h"
#import "WKPage.h"
#import "WKRetainPtr.h"
+#import "WKStringCF.h"
+#import "WKURLCF.h"
#import "WKURLRequest.h"
#import "WKURLRequestNS.h"
-#import "WKStringCF.h"
+
+static inline NSString *autoreleased(WKStringRef string)
+{
+ WKRetainPtr<WKStringRef> wkString = adoptWK(string);
+ return [(NSString *)WKStringCopyCFString(kCFAllocatorDefault, wkString.get()) autorelease];
+}
+
+static inline NSURL *autoreleased(WKURLRef url)
+{
+ WKRetainPtr<WKURLRef> wkURL = adoptWK(url);
+ return [(NSURL *)WKURLCopyCFURL(kCFAllocatorDefault, wkURL.get()) autorelease];
+}
+
+
@interface WKBrowsingContextControllerData : NSObject {
@public
WKRetainPtr<WKPageRef> _pageRef;
@@ -105,12 +121,41 @@
return WKPageCanGoBack(self.pageRef);
}
+
+#pragma mark Active Load Introspection
+
+- (NSURL *)activeURL
+{
+ /* FIXME: Implement. */
+ return nil;
+}
+
+- (NSURL *)pendingURL
+{
+ return autoreleased(WKPageCopyPendingAPIRequestURL(self.pageRef));
+}
+
+- (NSURL *)provisionalURL
+{
+ return autoreleased(WKFrameCopyProvisionalURL(WKPageGetMainFrame(self.pageRef)));
+}
+
+- (NSURL *)commitedURL
+{
+ return autoreleased(WKFrameCopyURL(WKPageGetMainFrame(self.pageRef)));
+}
+
+- (NSURL *)unreachableURL
+{
+ return autoreleased(WKFrameCopyUnreachableURL(WKPageGetMainFrame(self.pageRef)));
+}
+
+
#pragma mark Active Document Introspection
- (NSString *)title
{
- WKRetainPtr<WKStringRef> wkTitle = adoptWK(WKPageCopyTitle(self.pageRef));
- return [(NSString *)WKStringCopyCFString(kCFAllocatorDefault, wkTitle.get()) autorelease];
+ return autoreleased(WKPageCopyTitle(self.pageRef));
}
#pragma mark Zoom
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes