Title: [157701] trunk/Source/WebKit2
Revision
157701
Author
m...@apple.com
Date
2013-10-20 08:43:48 -0700 (Sun, 20 Oct 2013)

Log Message

[Cocoa] Loading progress API
https://bugs.webkit.org/show_bug.cgi?id=123069

Reviewed by Sam Weinig.

* UIProcess/API/mac/WKBrowsingContextController.h: Declared estimatedProgress property.
* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController estimatedProgress]): Added.
(didStartProgress): Added. Calls new delegate method
-browsingContextControllerDidStartProgress:.
(didChangeProgress): Added. Calls new delegate method
-browsingContextController:estimatedProgressChangedTo:.
(didFinishProgress): Added. Calls new delegate method
-browsingContextControllerDidFinishProgress:.
(setUpPageLoaderClient): Hook up new client functions.
* UIProcess/API/mac/WKBrowsingContextLoadDelegate.h: Declared new delegate methods.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (157700 => 157701)


--- trunk/Source/WebKit2/ChangeLog	2013-10-20 14:14:35 UTC (rev 157700)
+++ trunk/Source/WebKit2/ChangeLog	2013-10-20 15:43:48 UTC (rev 157701)
@@ -1,3 +1,22 @@
+2013-10-20  Dan Bernstein  <m...@apple.com>
+
+        [Cocoa] Loading progress API
+        https://bugs.webkit.org/show_bug.cgi?id=123069
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/API/mac/WKBrowsingContextController.h: Declared estimatedProgress property.
+        * UIProcess/API/mac/WKBrowsingContextController.mm:
+        (-[WKBrowsingContextController estimatedProgress]): Added.
+        (didStartProgress): Added. Calls new delegate method
+        -browsingContextControllerDidStartProgress:.
+        (didChangeProgress): Added. Calls new delegate method
+        -browsingContextController:estimatedProgressChangedTo:.
+        (didFinishProgress): Added. Calls new delegate method
+        -browsingContextControllerDidFinishProgress:.
+        (setUpPageLoaderClient): Hook up new client functions.
+        * UIProcess/API/mac/WKBrowsingContextLoadDelegate.h: Declared new delegate methods.
+
 2013-10-20  Thiago de Barros Lacerda  <thiago.lace...@openbossa.org>
 
         Removing "unused parameter" compiling warnings from WebKit2 and WebCore

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h (157700 => 157701)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h	2013-10-20 14:14:35 UTC (rev 157700)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h	2013-10-20 15:43:48 UTC (rev 157701)
@@ -102,6 +102,7 @@
 /* URL for a request that has been recieved, and is now being used. */
 @property(readonly) NSURL *committedURL;
 
+@property(readonly) double estimatedProgress;
 
 #pragma mark Active Document Introspection
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (157700 => 157701)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2013-10-20 14:14:35 UTC (rev 157700)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2013-10-20 15:43:48 UTC (rev 157701)
@@ -270,6 +270,11 @@
     return autoreleased(WKPageCopyCommittedURL(self._pageRef));
 }
 
+- (double)estimatedProgress
+{
+    return toImpl(self._pageRef)->estimatedProgress();
+}
+
 #pragma mark Active Document Introspection
 
 - (NSString *)title
@@ -451,6 +456,27 @@
     }
 }
 
+static void didStartProgress(WKPageRef page, const void* clientInfo)
+{
+    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
+    if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidStartProgress:)])
+        [browsingContext.loadDelegate browsingContextControllerDidStartProgress:browsingContext];
+}
+
+static void didChangeProgress(WKPageRef page, const void* clientInfo)
+{
+    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
+    if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextController:estimatedProgressChangedTo:)])
+        [browsingContext.loadDelegate browsingContextController:browsingContext estimatedProgressChangedTo:toImpl(page)->estimatedProgress()];
+}
+
+static void didFinishProgress(WKPageRef page, const void* clientInfo)
+{
+    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
+    if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidFinishProgress:)])
+        [browsingContext.loadDelegate browsingContextControllerDidFinishProgress:browsingContext];
+}
+
 static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext, WKPageRef pageRef)
 {
     WKPageLoaderClient loaderClient;
@@ -465,6 +491,10 @@
     loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
     loaderClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame;
 
+    loaderClient.didStartProgress = didStartProgress;
+    loaderClient.didChangeProgress = didChangeProgress;
+    loaderClient.didFinishProgress = didFinishProgress;
+
     WKPageSetPageLoaderClient(pageRef, &loaderClient);
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextLoadDelegate.h (157700 => 157701)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextLoadDelegate.h	2013-10-20 14:14:35 UTC (rev 157700)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextLoadDelegate.h	2013-10-20 15:43:48 UTC (rev 157701)
@@ -48,4 +48,8 @@
 /* Sent if the commited load fails. */
 - (void)browsingContextControllerDidFailLoad:(WKBrowsingContextController *)sender withError:(NSError *)error;
 
+- (void)browsingContextControllerDidStartProgress:(WKBrowsingContextController *)sender;
+- (void)browsingContextController:(WKBrowsingContextController *)sender estimatedProgressChangedTo:(double)estimatedProgress;
+- (void)browsingContextControllerDidFinishProgress:(WKBrowsingContextController *)sender;
+
 @end
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to