Changeset 185653 in webkit


Ignore:
Timestamp:
Jun 17, 2015 9:18:04 AM (9 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] Expose UIDelegate::UIClient::close via WKUIDelegate
https://bugs.webkit.org/show_bug.cgi?id=145957

Reviewed by Darin Adler.

Source/WebKit2:

  • UIProcess/API/Cocoa/WKUIDelegate.h: Added -webViewDidClose: to the protocol.
  • UIProcess/Cocoa/UIDelegate.h: Added a webViewDidClose boolean to the delegate methods struct.
  • UIProcess/Cocoa/UIDelegate.mm:

(WebKit::UIDelegate::setDelegate): Initialize the webViewDidClose boolean.
(WebKit::UIDelegate::UIClient::close): Changed to call the new delegate method. Left behind
code that calls the old private method if it’s implemented.

Tools:

  • TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:

(-[OpenAndCloseWindowUIDelegate webViewDidClose:]): Renamed from -_webViewClose:.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185651 r185653  
     12015-06-17  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Expose UIDelegate::UIClient::close via WKUIDelegate
     4        https://bugs.webkit.org/show_bug.cgi?id=145957
     5
     6        Reviewed by Darin Adler.
     7
     8        * UIProcess/API/Cocoa/WKUIDelegate.h: Added -webViewDidClose: to the protocol.
     9        * UIProcess/Cocoa/UIDelegate.h: Added a webViewDidClose boolean to the delegate methods struct.
     10        * UIProcess/Cocoa/UIDelegate.mm:
     11        (WebKit::UIDelegate::setDelegate): Initialize the webViewDidClose boolean.
     12        (WebKit::UIDelegate::UIClient::close): Changed to call the new delegate method. Left behind
     13        code that calls the old private method if it’s implemented.
     14
    1152015-06-17  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h

    r183070 r185653  
    5858- (WK_NULLABLE WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures;
    5959
     60/*! @abstract Notifies your app that the DOM window object's close() method completed successfully.
     61  @param webView The web view invoking the delegate method.
     62  @discussion Your app should remove the web view from the view hierarchy and update
     63  the UI as needed, such as by closing the containing browser tab or window.
     64  */
     65- (void)webViewDidClose:(WKWebView *)webView;
     66
    6067/*! @abstract Displays a JavaScript alert panel.
    6168 @param webView The web view invoking the delegate method.
  • trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h

    r177639 r185653  
    8989        bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1;
    9090        bool webViewPrintFrame : 1;
     91        bool webViewDidClose : 1;
    9192        bool webViewClose : 1;
    9293        bool webViewFullscreenMayReturnToInline : 1;
  • trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm

    r179328 r185653  
    7272    m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)];
    7373    m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)];
     74    m_delegateMethods.webViewDidClose = [delegate respondsToSelector:@selector(webViewDidClose:)];
    7475    m_delegateMethods.webViewClose = [delegate respondsToSelector:@selector(_webViewClose:)];
    7576    m_delegateMethods.webViewFullscreenMayReturnToInline = [delegate respondsToSelector:@selector(_webViewFullscreenMayReturnToInline:)];
     
    233234void UIDelegate::UIClient::close(WebKit::WebPageProxy*)
    234235{
    235     if (!m_uiDelegate.m_delegateMethods.webViewClose)
    236         return;
    237 
    238     auto delegate = m_uiDelegate.m_delegate.get();
    239     if (!delegate)
    240         return;
    241 
    242     [(id <WKUIDelegatePrivate>)delegate _webViewClose:m_uiDelegate.m_webView];
     236    if (m_uiDelegate.m_delegateMethods.webViewClose) {
     237        auto delegate = m_uiDelegate.m_delegate.get();
     238        if (!delegate)
     239            return;
     240
     241        [(id <WKUIDelegatePrivate>)delegate _webViewClose:m_uiDelegate.m_webView];
     242        return;
     243    }
     244
     245    if (!m_uiDelegate.m_delegateMethods.webViewDidClose)
     246        return;
     247
     248    auto delegate = m_uiDelegate.m_delegate.get();
     249    if (!delegate)
     250        return;
     251
     252    [delegate webViewDidClose:m_uiDelegate.m_webView];
    243253}
    244254
  • trunk/Tools/ChangeLog

    r185609 r185653  
     12015-06-17  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Expose UIDelegate::UIClient::close via WKUIDelegate
     4        https://bugs.webkit.org/show_bug.cgi?id=145957
     5
     6        Reviewed by Darin Adler.
     7
     8        * TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:
     9        (-[OpenAndCloseWindowUIDelegate webViewDidClose:]): Renamed from -_webViewClose:.
     10
    1112015-06-15  Chris Fleizach  <cfleizach@apple.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm

    r173851 r185653  
    4646@implementation OpenAndCloseWindowUIDelegate
    4747
    48 - (void)_webViewClose:(WKWebView *)webView
     48- (void)webViewDidClose:(WKWebView *)webView
    4949{
    5050    EXPECT_EQ(openedWebView, webView);
Note: See TracChangeset for help on using the changeset viewer.