Changeset 80479 in webkit


Ignore:
Timestamp:
Mar 7, 2011 11:05:24 AM (13 years ago)
Author:
weinig@apple.com
Message:

2011-03-07 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.

Add unableToImplementPolicy callback for WebKit2 policy client
<rdar://problem/9071902>
https://bugs.webkit.org/show_bug.cgi?id=55884

  • UIProcess/API/C/WKPage.h:
  • UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::unableToImplementPolicy):
  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/WebPolicyClient.cpp: (WebKit::WebPolicyClient::unableToImplementPolicy):
  • UIProcess/WebPolicyClient.h:
  • WebProcess/InjectedBundle/API/c/WKBundlePage.h:
  • WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp: (WebKit::InjectedBundlePagePolicyClient::unableToImplementPolicy):
  • WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h:
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchUnableToImplementPolicy): Pipe unableToImplementPolicy through both the bundle and the main WebKit2 API.

2011-03-07 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.

Add unableToImplementPolicy callback for WebKit2 policy client
<rdar://problem/9071902>
https://bugs.webkit.org/show_bug.cgi?id=55884

  • MiniBrowser/mac/BrowserWindowController.m: (-[BrowserWindowController awakeFromNib]): Update policy client initialization struct for new member.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r80475 r80479  
     12011-03-07  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Add unableToImplementPolicy callback for WebKit2 policy client
     6        <rdar://problem/9071902>
     7        https://bugs.webkit.org/show_bug.cgi?id=55884
     8
     9        * UIProcess/API/C/WKPage.h:
     10        * UIProcess/WebPageProxy.cpp:
     11        (WebKit::WebPageProxy::unableToImplementPolicy):
     12        * UIProcess/WebPageProxy.h:
     13        * UIProcess/WebPageProxy.messages.in:
     14        * UIProcess/WebPolicyClient.cpp:
     15        (WebKit::WebPolicyClient::unableToImplementPolicy):
     16        * UIProcess/WebPolicyClient.h:
     17        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     18        * WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp:
     19        (WebKit::InjectedBundlePagePolicyClient::unableToImplementPolicy):
     20        * WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h:
     21        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     22        (WebKit::WebFrameLoaderClient::dispatchUnableToImplementPolicy):
     23        Pipe unableToImplementPolicy through both the bundle and the main WebKit2 API.
     24
    1252011-03-07  Sam Weinig  <sam@webkit.org>
    226
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.h

    r80475 r80479  
    103103typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
    104104typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
     105typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
    105106
    106107struct WKPagePolicyClient {
     
    110111    WKPageDecidePolicyForNewWindowActionCallback                        decidePolicyForNewWindowAction;
    111112    WKPageDecidePolicyForResponseCallback                               decidePolicyForResponse;
     113    WKPageUnableToImplementPolicyCallback                               unableToImplementPolicy;
    112114};
    113115typedef struct WKPagePolicyClient WKPagePolicyClient;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r80475 r80479  
    16891689}
    16901690
     1691void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
     1692{
     1693    RefPtr<APIObject> userData;
     1694    WebContextUserMessageDecoder messageDecoder(userData, context());
     1695    if (!arguments->decode(messageDecoder))
     1696        return;
     1697   
     1698    WebFrameProxy* frame = process()->webFrame(frameID);
     1699    MESSAGE_CHECK(frame);
     1700
     1701    m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
     1702}
     1703
    16911704// FormClient
    16921705
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r80475 r80479  
    503503    void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
    504504    void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
     505    void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder* arguments);
    505506
    506507    void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r80475 r80479  
    7070    DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
    7171    DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
     72    UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
    7273
    7374    # Progress messages
  • trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp

    r80475 r80479  
    2727#include "WebPolicyClient.h"
    2828
     29#include "APIObject.h"
    2930#include "WKAPICast.h"
    3031#include "WebURLRequest.h"
     
    6869}
    6970
     71void WebPolicyClient::unableToImplementPolicy(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData)
     72{
     73    if (!m_client.unableToImplementPolicy)
     74        return;
     75
     76    m_client.unableToImplementPolicy(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
     77}
     78
    7079} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/WebPolicyClient.h

    r80475 r80479  
    2828
    2929#include "APIClient.h"
    30 #include "APIObject.h"
    3130#include "WKPage.h"
    3231#include "WebEvent.h"
     
    3534
    3635namespace WebCore {
     36    class ResourceError;
    3737    class ResourceRequest;
    3838    class ResourceResponse;
     
    4141namespace WebKit {
    4242
     43class APIObject;
    4344class WebPageProxy;
    4445class WebFrameProxy;
     
    5051    bool decidePolicyForNewWindowAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, const String& frameName, WebFramePolicyListenerProxy*, APIObject* userData);
    5152    bool decidePolicyForResponse(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData);
     53    void unableToImplementPolicy(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject* userData);
    5254};
    5355
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r80475 r80479  
    121121typedef uint32_t WKBundlePagePolicyAction;
    122122
    123    
    124123// Policy Client
    125124typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForNavigationActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
    126125typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForNewWindowActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKStringRef frameName, WKTypeRef* userData, const void* clientInfo);
    127 typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForResponseCallback)(WKBundlePageRef page, WKBundleFrameRef frame,  WKURLResponseRef response, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
     126typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForResponseCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
     127typedef void (*WKBundlePageUnableToImplementPolicyCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void* clientInfo);
    128128
    129129struct WKBundlePagePolicyClient {
     
    133133    WKBundlePageDecidePolicyForNewWindowActionCallback                  decidePolicyForNewWindowAction;
    134134    WKBundlePageDecidePolicyForResponseCallback                         decidePolicyForResponse;
     135    WKBundlePageUnableToImplementPolicyCallback                         unableToImplementPolicy;
    135136};
    136137typedef struct WKBundlePagePolicyClient WKBundlePagePolicyClient;
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp

    r80475 r80479  
    2828
    2929#include "WKBundleAPICast.h"
     30#include "WebError.h"
    3031#include "WebURLRequest.h"
    3132
     
    7475}
    7576
     77void InjectedBundlePagePolicyClient::unableToImplementPolicy(WebPage* page, WebFrame* frame, const WebCore::ResourceError& error, RefPtr<APIObject>& userData)
     78{
     79    if (!m_client.unableToImplementPolicy)
     80        return;
     81
     82    WKTypeRef userDataToPass = 0;
     83    m_client.unableToImplementPolicy(toAPI(page), toAPI(frame), toAPI(error), &userDataToPass, m_client.clientInfo);
     84    userData = adoptRef(toImpl(userDataToPass));
     85}
     86
    7687} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h

    r80475 r80479  
    3333
    3434namespace WebCore {
     35    class ResourceError;
    3536    class ResourceRequest;
    3637    class ResourceResponse;
     
    4849    WKBundlePagePolicyAction decidePolicyForNewWindowAction(WebPage*, WebFrame*, InjectedBundleNavigationAction*, const WebCore::ResourceRequest&, const String& frameName, RefPtr<APIObject>& userData);
    4950    WKBundlePagePolicyAction decidePolicyForResponse(WebPage*, WebFrame*, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, RefPtr<APIObject>& userData);
     51    void unableToImplementPolicy(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData);
    5052};
    5153
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r80475 r80479  
    674674}
    675675
    676 void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
    677 {
    678     notImplemented();
     676void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError& error)
     677{
     678    WebPage* webPage = m_frame->page();
     679    if (!webPage)
     680        return;
     681
     682    RefPtr<APIObject> userData;
     683
     684    // Notify the bundle client.
     685    webPage->injectedBundlePolicyClient().unableToImplementPolicy(webPage, m_frame, error, userData);
     686
     687    // Notify the UIProcess.
     688    webPage->send(Messages::WebPageProxy::UnableToImplementPolicy(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get())));
    679689}
    680690
  • trunk/Tools/ChangeLog

    r80475 r80479  
     12011-03-07  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Add unableToImplementPolicy callback for WebKit2 policy client
     6        <rdar://problem/9071902>
     7        https://bugs.webkit.org/show_bug.cgi?id=55884
     8
     9        * MiniBrowser/mac/BrowserWindowController.m:
     10        (-[BrowserWindowController awakeFromNib]):
     11        Update policy client initialization struct for new member.
     12
    1132011-03-07  Sam Weinig  <sam@webkit.org>
    214
  • trunk/Tools/MiniBrowser/mac/BrowserWindowController.m

    r80475 r80479  
    608608        decidePolicyForNavigationAction,
    609609        decidePolicyForNewWindowAction,
    610         decidePolicyForResponse
     610        decidePolicyForResponse,
     611        0           /* unableToImplementPolicy */
    611612    };
    612613    WKPageSetPagePolicyClient(_webView.pageRef, &policyClient);
Note: See TracChangeset for help on using the changeset viewer.