Changeset 157701 in webkit


Ignore:
Timestamp:
Oct 20, 2013, 8:43:48 AM (11 years ago)
Author:
mitz@apple.com
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.
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r157700 r157701  
     12013-10-20  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Loading progress API
     4        https://bugs.webkit.org/show_bug.cgi?id=123069
     5
     6        Reviewed by Sam Weinig.
     7
     8        * UIProcess/API/mac/WKBrowsingContextController.h: Declared estimatedProgress property.
     9        * UIProcess/API/mac/WKBrowsingContextController.mm:
     10        (-[WKBrowsingContextController estimatedProgress]): Added.
     11        (didStartProgress): Added. Calls new delegate method
     12        -browsingContextControllerDidStartProgress:.
     13        (didChangeProgress): Added. Calls new delegate method
     14        -browsingContextController:estimatedProgressChangedTo:.
     15        (didFinishProgress): Added. Calls new delegate method
     16        -browsingContextControllerDidFinishProgress:.
     17        (setUpPageLoaderClient): Hook up new client functions.
     18        * UIProcess/API/mac/WKBrowsingContextLoadDelegate.h: Declared new delegate methods.
     19
    1202013-10-20  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
    221
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h

    r157681 r157701  
    103103@property(readonly) NSURL *committedURL;
    104104
     105@property(readonly) double estimatedProgress;
    105106
    106107#pragma mark Active Document Introspection
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm

    r157681 r157701  
    271271}
    272272
     273- (double)estimatedProgress
     274{
     275    return toImpl(self._pageRef)->estimatedProgress();
     276}
     277
    273278#pragma mark Active Document Introspection
    274279
     
    452457}
    453458
     459static void didStartProgress(WKPageRef page, const void* clientInfo)
     460{
     461    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
     462    if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidStartProgress:)])
     463        [browsingContext.loadDelegate browsingContextControllerDidStartProgress:browsingContext];
     464}
     465
     466static void didChangeProgress(WKPageRef page, const void* clientInfo)
     467{
     468    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
     469    if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextController:estimatedProgressChangedTo:)])
     470        [browsingContext.loadDelegate browsingContextController:browsingContext estimatedProgressChangedTo:toImpl(page)->estimatedProgress()];
     471}
     472
     473static void didFinishProgress(WKPageRef page, const void* clientInfo)
     474{
     475    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
     476    if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidFinishProgress:)])
     477        [browsingContext.loadDelegate browsingContextControllerDidFinishProgress:browsingContext];
     478}
     479
    454480static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext, WKPageRef pageRef)
    455481{
     
    466492    loaderClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame;
    467493
     494    loaderClient.didStartProgress = didStartProgress;
     495    loaderClient.didChangeProgress = didChangeProgress;
     496    loaderClient.didFinishProgress = didFinishProgress;
     497
    468498    WKPageSetPageLoaderClient(pageRef, &loaderClient);
    469499}
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextLoadDelegate.h

    r155770 r157701  
    4949- (void)browsingContextControllerDidFailLoad:(WKBrowsingContextController *)sender withError:(NSError *)error;
    5050
     51- (void)browsingContextControllerDidStartProgress:(WKBrowsingContextController *)sender;
     52- (void)browsingContextController:(WKBrowsingContextController *)sender estimatedProgressChangedTo:(double)estimatedProgress;
     53- (void)browsingContextControllerDidFinishProgress:(WKBrowsingContextController *)sender;
     54
    5155@end
Note: See TracChangeset for help on using the changeset viewer.