<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162639] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162639">162639</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-01-23 14:01:23 -0800 (Thu, 23 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add API::PolicyClient base class
https://bugs.webkit.org/show_bug.cgi?id=127509

Reviewed by Tim Horton.

* UIProcess/API/APIPolicyClient.h: Copied from Source/WebKit2/UIProcess/WebPolicyClient.h.
(API::PolicyClient::~PolicyClient):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPagePolicyClient):
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(setUpPagePolicyClient):
(-[WKBrowsingContextController setPolicyDelegate:]):
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::createInspectorPage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setPolicyClient):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::unableToImplementPolicy):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPolicyClient.cpp:
(WebKit::WebPolicyClient::WebPolicyClient):
(WebKit::WebPolicyClient::decidePolicyForNavigationAction):
(WebKit::WebPolicyClient::decidePolicyForNewWindowAction):
(WebKit::WebPolicyClient::decidePolicyForResponse):
* UIProcess/WebPolicyClient.h:
* WebKit2.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagecpp">trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextControllermm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebInspectorProxycpp">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPolicyClientcpp">trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPolicyClienth">trunk/Source/WebKit2/UIProcess/WebPolicyClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIPolicyClienth">trunk/Source/WebKit2/UIProcess/API/APIPolicyClient.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2014-01-23  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Add API::PolicyClient base class
+        https://bugs.webkit.org/show_bug.cgi?id=127509
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/APIPolicyClient.h: Copied from Source/WebKit2/UIProcess/WebPolicyClient.h.
+        (API::PolicyClient::~PolicyClient):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPagePolicyClient):
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (setUpPagePolicyClient):
+        (-[WKBrowsingContextController setPolicyDelegate:]):
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::createInspectorPage):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setPolicyClient):
+        (WebKit::WebPageProxy::close):
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+        (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+        (WebKit::WebPageProxy::decidePolicyForResponse):
+        (WebKit::WebPageProxy::unableToImplementPolicy):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPolicyClient.cpp:
+        (WebKit::WebPolicyClient::WebPolicyClient):
+        (WebKit::WebPolicyClient::decidePolicyForNavigationAction):
+        (WebKit::WebPolicyClient::decidePolicyForNewWindowAction):
+        (WebKit::WebPolicyClient::decidePolicyForResponse):
+        * UIProcess/WebPolicyClient.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+
+2014-01-23  Anders Carlsson  &lt;andersca@apple.com&gt;
+
</ins><span class="cx">         Add init methods that create default configurations
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=127503
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIPolicyClienthfromrev162638trunkSourceWebKit2UIProcessWebPolicyClienth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/APIPolicyClient.h (from rev 162638, trunk/Source/WebKit2/UIProcess/WebPolicyClient.h) (0 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIPolicyClient.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIPolicyClient.h        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef APIPolicyClient_h
+#define APIPolicyClient_h
+
+#include &quot;WebEvent.h&quot;
+#include &lt;WebCore/FrameLoaderTypes.h&gt;
+#include &lt;wtf/Forward.h&gt;
+
+namespace WebCore {
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+}
+
+namespace WebKit {
+class WebPageProxy;
+class WebFrameProxy;
+class WebFramePolicyListenerProxy;
+}
+
+namespace API {
+class Object;
+
+class PolicyClient {
+public:
+    virtual ~PolicyClient() { }
+
+    virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebCore::NavigationType, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button, WebKit::WebFrameProxy* originatingFrame, const WebCore::ResourceRequest&amp; originalRequest, const WebCore::ResourceRequest&amp;, WebKit::WebFramePolicyListenerProxy*, API::Object* userData) = 0;
+    virtual void decidePolicyForNewWindowAction(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebCore::NavigationType, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button, const WebCore::ResourceRequest&amp;, const WTF::String&amp; frameName, WebKit::WebFramePolicyListenerProxy*, API::Object* userData) = 0;
+    virtual void decidePolicyForResponse(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceResponse&amp;, const WebCore::ResourceRequest&amp;, bool canShowMIMEType, WebKit::WebFramePolicyListenerProxy*, API::Object* userData) = 0;
+    virtual void unableToImplementPolicy(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceError&amp;, API::Object* userData) = 0;
+};
+
+} // namespace API
+
+#endif // APIPolicyClient_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include &quot;WKPluginInformation.h&quot;
</span><span class="cx"> #include &quot;WebBackForwardList.h&quot;
</span><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><ins>+#include &quot;WebPolicyClient.h&quot;
</ins><span class="cx"> #include &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #include &lt;WebCore/Page.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -672,7 +673,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase* wkClient)
</span><span class="cx"> {
</span><del>-    toImpl(pageRef)-&gt;initializePolicyClient(wkClient);
</del><ins>+    toImpl(pageRef)-&gt;setPolicyClient(std::make_unique&lt;WebPolicyClient&gt;(wkClient));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> #import &quot;WebCertificateInfo.h&quot;
</span><span class="cx"> #import &quot;WebContext.h&quot;
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><ins>+#import &quot;WebPolicyClient.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="lines">@@ -712,7 +713,7 @@
</span><span class="cx">             WKFramePolicyListenerUse(listener);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    page.initializePolicyClient(&amp;policyClient.base);
</del><ins>+    page.setPolicyClient(std::make_unique&lt;WebPolicyClient&gt;(&amp;policyClient.base));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id &lt;WKBrowsingContextLoadDelegate&gt;)loadDelegate
</span><span class="lines">@@ -742,7 +743,7 @@
</span><span class="cx">     if (policyDelegate)
</span><span class="cx">         setUpPagePolicyClient(self, *_page);
</span><span class="cx">     else
</span><del>-        _page-&gt;initializePolicyClient(nullptr);
</del><ins>+        _page-&gt;setPolicyClient(nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id &lt;WKBrowsingContextHistoryDelegate&gt;)historyDelegate
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;WebPageCreationParameters.h&quot;
</span><span class="cx"> #include &quot;WebPageGroup.h&quot;
</span><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><ins>+#include &quot;WebPolicyClient.h&quot;
</ins><span class="cx"> #include &quot;WebPreferences.h&quot;
</span><span class="cx"> #include &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #include &lt;WebCore/SchemeRegistry.h&gt;
</span><span class="lines">@@ -449,7 +450,7 @@
</span><span class="cx">         0, /* decidePolicyForResponse */
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    inspectorPage-&gt;initializePolicyClient(reinterpret_cast&lt;const WKPagePolicyClientBase*&gt;(&amp;policyClient));
</del><ins>+    inspectorPage-&gt;setPolicyClient(std::make_unique&lt;WebPolicyClient&gt;(&amp;policyClient.base));
</ins><span class="cx"> 
</span><span class="cx">     String url = inspectorPageURL();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -420,9 +420,9 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient-&gt;version &gt; 0), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::initializePolicyClient(const WKPagePolicyClientBase* policyClient)
</del><ins>+void WebPageProxy::setPolicyClient(std::unique_ptr&lt;API::PolicyClient&gt; policyClient)
</ins><span class="cx"> {
</span><del>-    m_policyClient.initialize(policyClient);
</del><ins>+    m_policyClient = std::move(policyClient);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::initializeFormClient(const WKPageFormClientBase* formClient)
</span><span class="lines">@@ -560,7 +560,7 @@
</span><span class="cx">     resetState();
</span><span class="cx"> 
</span><span class="cx">     m_loaderClient.initialize(0);
</span><del>-    m_policyClient.initialize(0);
</del><ins>+    m_policyClient = nullptr;
</ins><span class="cx">     m_formClient.initialize(0);
</span><span class="cx">     m_uiClient.initialize(0);
</span><span class="cx"> #if PLATFORM(EFL)
</span><span class="lines">@@ -2458,9 +2458,11 @@
</span><span class="cx"> 
</span><span class="cx">     m_inDecidePolicyForNavigationAction = true;
</span><span class="cx">     m_syncNavigationActionPolicyActionIsValid = false;
</span><del>-    
-    if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, originatingFrame, originalRequest, request, listener.get(), userData.get()))
</del><ins>+
+    if (!m_policyClient)
</ins><span class="cx">         listener-&gt;use();
</span><ins>+    else
+        m_policyClient-&gt;decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, originatingFrame, originalRequest, request, listener.get(), userData.get());
</ins><span class="cx"> 
</span><span class="cx">     m_inDecidePolicyForNavigationAction = false;
</span><span class="cx"> 
</span><span class="lines">@@ -2486,10 +2488,12 @@
</span><span class="cx">     NavigationType navigationType = static_cast&lt;NavigationType&gt;(opaqueNavigationType);
</span><span class="cx">     WebEvent::Modifiers modifiers = static_cast&lt;WebEvent::Modifiers&gt;(opaqueModifiers);
</span><span class="cx">     WebMouseEvent::Button mouseButton = static_cast&lt;WebMouseEvent::Button&gt;(opaqueMouseButton);
</span><ins>+    RefPtr&lt;WebFramePolicyListenerProxy&gt; listener = frame-&gt;setUpPolicyListenerProxy(listenerID);
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;WebFramePolicyListenerProxy&gt; listener = frame-&gt;setUpPolicyListenerProxy(listenerID);
-    if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
</del><ins>+    if (!m_policyClient)
</ins><span class="cx">         listener-&gt;use();
</span><ins>+    else
+        m_policyClient-&gt;decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceResponse&amp; response, const ResourceRequest&amp; request, bool canShowMIMEType, uint64_t listenerID, IPC::MessageDecoder&amp; decoder)
</span><span class="lines">@@ -2506,8 +2510,10 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebFramePolicyListenerProxy&gt; listener = frame-&gt;setUpPolicyListenerProxy(listenerID);
</span><span class="cx"> 
</span><del>-    if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, canShowMIMEType, listener.get(), userData.get()))
</del><ins>+    if (!m_policyClient)
</ins><span class="cx">         listener-&gt;use();
</span><ins>+    else
+        m_policyClient-&gt;decidePolicyForResponse(this, frame, response, request, canShowMIMEType, listener.get(), userData.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const ResourceResponse&amp; response, const ResourceRequest&amp; request, bool canShowMIMEType, uint64_t listenerID, IPC::MessageDecoder&amp; decoder, bool&amp; receivedPolicyAction, uint64_t&amp; policyAction, uint64_t&amp; downloadID)
</span><span class="lines">@@ -2541,7 +2547,8 @@
</span><span class="cx">     WebFrameProxy* frame = m_process-&gt;webFrame(frameID);
</span><span class="cx">     MESSAGE_CHECK(frame);
</span><span class="cx"> 
</span><del>-    m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
</del><ins>+    if (m_policyClient)
+        m_policyClient-&gt;unableToImplementPolicy(this, frame, error, userData.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FormClient
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define WebPageProxy_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><ins>+#include &quot;APIPolicyClient.h&quot;
</ins><span class="cx"> #include &quot;APISession.h&quot;
</span><span class="cx"> #include &quot;AutoCorrectionCallback.h&quot;
</span><span class="cx"> #include &quot;Connection.h&quot;
</span><span class="lines">@@ -57,7 +58,6 @@
</span><span class="cx"> #include &quot;WebPageCreationParameters.h&quot;
</span><span class="cx"> #include &lt;WebCore/AlternativeTextClient.h&gt; // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
</span><span class="cx"> #include &quot;WebPageProxyMessages.h&quot;
</span><del>-#include &quot;WebPolicyClient.h&quot;
</del><span class="cx"> #include &quot;WebPopupMenuProxy.h&quot;
</span><span class="cx"> #include &quot;WebUIClient.h&quot;
</span><span class="cx"> #include &lt;WebCore/Color.h&gt;
</span><span class="lines">@@ -368,7 +368,7 @@
</span><span class="cx">     void initializeFindMatchesClient(const WKPageFindMatchesClientBase*);
</span><span class="cx">     void initializeFormClient(const WKPageFormClientBase*);
</span><span class="cx">     void initializeLoaderClient(const WKPageLoaderClientBase*);
</span><del>-    void initializePolicyClient(const WKPagePolicyClientBase*);
</del><ins>+    void setPolicyClient(std::unique_ptr&lt;API::PolicyClient&gt;);
</ins><span class="cx">     void initializeUIClient(const WKPageUIClientBase*);
</span><span class="cx"> #if PLATFORM(EFL)
</span><span class="cx">     void initializeUIPopupMenuClient(const WKPageUIPopupMenuClientBase*);
</span><span class="lines">@@ -1164,7 +1164,7 @@
</span><span class="cx"> 
</span><span class="cx">     PageClient&amp; m_pageClient;
</span><span class="cx">     WebLoaderClient m_loaderClient;
</span><del>-    WebPolicyClient m_policyClient;
</del><ins>+    std::unique_ptr&lt;API::PolicyClient&gt; m_policyClient;
</ins><span class="cx">     WebFormClient m_formClient;
</span><span class="cx">     WebUIClient m_uiClient;
</span><span class="cx"> #if PLATFORM(EFL)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPolicyClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -29,16 +29,24 @@
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><span class="cx"> #include &quot;APIURLRequest.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><ins>+#include &quot;WebFramePolicyListenerProxy.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-bool WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, WebFrameProxy* originatingFrame, const ResourceRequest&amp; originalResourceRequest, const ResourceRequest&amp; resourceRequest, WebFramePolicyListenerProxy* listener, API::Object* userData)
</del><ins>+WebPolicyClient::WebPolicyClient(const WKPagePolicyClientBase* client)
</ins><span class="cx"> {
</span><del>-    if (!m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0 &amp;&amp; !m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1 &amp;&amp; !m_client.decidePolicyForNavigationAction)
-        return false;
</del><ins>+    initialize(client);
+}
</ins><span class="cx"> 
</span><ins>+void WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, WebFrameProxy* frame, WebCore::NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest&amp; originalResourceRequest, const WebCore::ResourceRequest&amp; resourceRequest, WebFramePolicyListenerProxy* listener, API::Object* userData)
+{
+    if (!m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0 &amp;&amp; !m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1 &amp;&amp; !m_client.decidePolicyForNavigationAction) {
+        listener-&gt;use();
+        return;
+    }
+
</ins><span class="cx">     RefPtr&lt;API::URLRequest&gt; originalRequest = API::URLRequest::create(originalResourceRequest);
</span><span class="cx">     RefPtr&lt;API::URLRequest&gt; request = API::URLRequest::create(resourceRequest);
</span><span class="cx"> 
</span><span class="lines">@@ -48,25 +56,26 @@
</span><span class="cx">         m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(originatingFrame), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.base.clientInfo);
</span><span class="cx">     else
</span><span class="cx">         m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(originatingFrame), toAPI(originalRequest.get()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.base.clientInfo);
</span><del>-
-    return true;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const ResourceRequest&amp; resourceRequest, const String&amp; frameName, WebFramePolicyListenerProxy* listener, API::Object* userData)
</del><ins>+void WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const ResourceRequest&amp; resourceRequest, const String&amp; frameName, WebFramePolicyListenerProxy* listener, API::Object* userData)
</ins><span class="cx"> {
</span><del>-    if (!m_client.decidePolicyForNewWindowAction)
-        return false;
</del><ins>+    if (!m_client.decidePolicyForNewWindowAction) {
+        listener-&gt;use();
+        return;
+    }
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;API::URLRequest&gt; request = API::URLRequest::create(resourceRequest);
</span><span class="cx"> 
</span><span class="cx">     m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(request.get()), toAPI(frameName.impl()), toAPI(listener), toAPI(userData), m_client.base.clientInfo);
</span><del>-    return true;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebPolicyClient::decidePolicyForResponse(WebPageProxy* page, WebFrameProxy* frame, const ResourceResponse&amp; resourceResponse, const ResourceRequest&amp; resourceRequest, bool canShowMIMEType, WebFramePolicyListenerProxy* listener, API::Object* userData)
</del><ins>+void WebPolicyClient::decidePolicyForResponse(WebPageProxy* page, WebFrameProxy* frame, const ResourceResponse&amp; resourceResponse, const ResourceRequest&amp; resourceRequest, bool canShowMIMEType, WebFramePolicyListenerProxy* listener, API::Object* userData)
</ins><span class="cx"> {
</span><del>-    if (!m_client.decidePolicyForResponse_deprecatedForUseWithV0 &amp;&amp; !m_client.decidePolicyForResponse)
-        return false;
</del><ins>+    if (m_client.decidePolicyForResponse_deprecatedForUseWithV0 &amp;&amp; !m_client.decidePolicyForResponse) {
+        listener-&gt;use();
+        return;
+    }
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;API::URLResponse&gt; response = API::URLResponse::create(resourceResponse);
</span><span class="cx">     RefPtr&lt;API::URLRequest&gt; request = API::URLRequest::create(resourceRequest);
</span><span class="lines">@@ -75,8 +84,6 @@
</span><span class="cx">         m_client.decidePolicyForResponse_deprecatedForUseWithV0(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.base.clientInfo);
</span><span class="cx">     else
</span><span class="cx">         m_client.decidePolicyForResponse(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), canShowMIMEType, toAPI(listener), toAPI(userData), m_client.base.clientInfo);
</span><del>-
-    return true;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPolicyClient::unableToImplementPolicy(WebPageProxy* page, WebFrameProxy* frame, const ResourceError&amp; error, API::Object* userData)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPolicyClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPolicyClient.h (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPolicyClient.h        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/UIProcess/WebPolicyClient.h        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define WebPolicyClient_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIClient.h&quot;
</span><ins>+#include &quot;APIPolicyClient.h&quot;
</ins><span class="cx"> #include &quot;WKPage.h&quot;
</span><span class="cx"> #include &quot;WKPagePolicyClientInternal.h&quot;
</span><span class="cx"> #include &quot;WebEvent.h&quot;
</span><span class="lines">@@ -41,24 +42,17 @@
</span><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-namespace WebCore {
-class ResourceError;
-class ResourceRequest;
-class ResourceResponse;
-}
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-class WebPageProxy;
-class WebFrameProxy;
-class WebFramePolicyListenerProxy;
-
-class WebPolicyClient : public API::Client&lt;WKPagePolicyClientBase&gt; {
</del><ins>+class WebPolicyClient final : public API::Client&lt;WKPagePolicyClientBase&gt;, public API::PolicyClient {
</ins><span class="cx"> public:
</span><del>-    bool decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest&amp; originalRequest, const WebCore::ResourceRequest&amp;, WebFramePolicyListenerProxy*, API::Object* userData);
-    bool decidePolicyForNewWindowAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&amp;, const String&amp; frameName, WebFramePolicyListenerProxy*, API::Object* userData);
-    bool decidePolicyForResponse(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceResponse&amp;, const WebCore::ResourceRequest&amp;, bool canShowMIMEType, WebFramePolicyListenerProxy*, API::Object* userData);
-    void unableToImplementPolicy(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&amp;, API::Object* userData);
</del><ins>+    explicit WebPolicyClient(const WKPagePolicyClientBase*);
+
+private:
+    virtual void decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest&amp; originalRequest, const WebCore::ResourceRequest&amp;, WebFramePolicyListenerProxy*, API::Object* userData) override;
+    virtual void decidePolicyForNewWindowAction(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebCore::NavigationType, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button, const WebCore::ResourceRequest&amp;, const String&amp; frameName, WebKit::WebFramePolicyListenerProxy*, API::Object* userData) override;
+    virtual void decidePolicyForResponse(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceResponse&amp;, const WebCore::ResourceRequest&amp;, bool canShowMIMEType, WebFramePolicyListenerProxy*, API::Object* userData) override;
+    virtual void unableToImplementPolicy(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&amp;, API::Object* userData) override;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (162638 => 162639)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-01-23 21:27:23 UTC (rev 162638)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-01-23 22:01:23 UTC (rev 162639)
</span><span class="lines">@@ -343,6 +343,7 @@
</span><span class="cx">                 1AF05D8714688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF05D8514688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h */; };
</span><span class="cx">                 1AF1AC6B1651759E00C17D7F /* RemoteLayerTreeTransaction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF1AC691651759E00C17D7F /* RemoteLayerTreeTransaction.mm */; };
</span><span class="cx">                 1AF1AC6C1651759E00C17D7F /* RemoteLayerTreeTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF1AC6A1651759E00C17D7F /* RemoteLayerTreeTransaction.h */; };
</span><ins>+                1AFDD3151891B54000153970 /* APIPolicyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFDD3141891B54000153970 /* APIPolicyClient.h */; };
</ins><span class="cx">                 1AFF49001833DE78009AB15A /* WKDeprecatedFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFF48FE1833DE78009AB15A /* WKDeprecatedFunctions.cpp */; };
</span><span class="cx">                 1C8E25A81270E3BB00BC7BD0 /* WebInspectorFrontendClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E256B1270DE3800BC7BD0 /* WebInspectorFrontendClient.cpp */; };
</span><span class="cx">                 1C8E25A91270E3BC00BC7BD0 /* WebInspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E256A1270DE3800BC7BD0 /* WebInspectorFrontendClient.h */; };
</span><span class="lines">@@ -1983,6 +1984,7 @@
</span><span class="cx">                 1AF05D8514688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiledCoreAnimationDrawingAreaProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AF1AC691651759E00C17D7F /* RemoteLayerTreeTransaction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeTransaction.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AF1AC6A1651759E00C17D7F /* RemoteLayerTreeTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeTransaction.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                1AFDD3141891B54000153970 /* APIPolicyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIPolicyClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1AFF48FE1833DE78009AB15A /* WKDeprecatedFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKDeprecatedFunctions.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1BB417C912C00CCA002BE67B /* TextCheckerCompletion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCheckerCompletion.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1C77C1951288A872006A742F /* WebInspectorProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebInspectorProxy.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5005,6 +5007,7 @@
</span><span class="cx">                                 37C4C08318149C2A003688B9 /* Cocoa */,
</span><span class="cx">                                 BC8A501311765F4500757573 /* cpp */,
</span><span class="cx">                                 BC111B47112F616900337BAB /* mac */,
</span><ins>+                                1AFDD3141891B54000153970 /* APIPolicyClient.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = API;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -6623,6 +6626,7 @@
</span><span class="cx">                                 37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */,
</span><span class="cx">                                 BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */,
</span><span class="cx">                                 BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */,
</span><ins>+                                1AFDD3151891B54000153970 /* APIPolicyClient.h in Headers */,
</ins><span class="cx">                                 BCB9F6A51123DD0D00A137E0 /* WKFramePolicyListener.h in Headers */,
</span><span class="cx">                                 E1AEA22F14687BDB00804569 /* WKFullKeyboardAccessWatcher.h in Headers */,
</span><span class="cx">                                 CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */,
</span></span></pre>
</div>
</div>

</body>
</html>