<!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>[166720] 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/166720">166720</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-04-03 09:03:46 -0700 (Thu, 03 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename UIClient.{h, mm} to UIDelegate.{h, mm}.

Rubber-stamped by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/Cocoa/UIDelegate.h: Renamed from Source/WebKit2/UIProcess/Cocoa/UIClient.h.
* UIProcess/Cocoa/UIDelegate.mm: Renamed from Source/WebKit2/UIProcess/Cocoa/UIClient.mm.
* WebKit2.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegateh">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegatemm">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIClienth">trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIClientmm">trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (166719 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-04-03 15:46:05 UTC (rev 166719)
+++ trunk/Source/WebKit2/ChangeLog        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-04-03  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Rename UIClient.{h, mm} to UIDelegate.{h, mm}.
+
+        Rubber-stamped by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        * UIProcess/Cocoa/UIDelegate.h: Renamed from Source/WebKit2/UIProcess/Cocoa/UIClient.h.
+        * UIProcess/Cocoa/UIDelegate.mm: Renamed from Source/WebKit2/UIProcess/Cocoa/UIClient.mm.
+        * WebKit2.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2014-04-03  Andrzej Badowski  &lt;a.badowski@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Replacing zoom functionality of MiniBrowser from scale_set to page_zoom_set.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (166719 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-04-03 15:46:05 UTC (rev 166719)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> #import &quot;RemoteLayerTreeTransaction.h&quot;
</span><span class="cx"> #import &quot;RemoteObjectRegistry.h&quot;
</span><span class="cx"> #import &quot;RemoteObjectRegistryMessages.h&quot;
</span><del>-#import &quot;UIClient.h&quot;
</del><ins>+#import &quot;UIDelegate.h&quot;
</ins><span class="cx"> #import &quot;ViewGestureController.h&quot;
</span><span class="cx"> #import &quot;WKBackForwardListInternal.h&quot;
</span><span class="cx"> #import &quot;WKBackForwardListItemInternal.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIClienth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.h (166719 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.h        2014-04-03 15:46:05 UTC (rev 166719)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.h        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-/*
- * 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 UIClient_h
-#define UIClient_h
-
-#import &quot;WKFoundation.h&quot;
-
-#if WK_API_ENABLED
-
-#import &quot;APIUIClient.h&quot;
-#import &quot;WeakObjCPtr.h&quot;
-#import &lt;wtf/RetainPtr.h&gt;
-
-@class _WKActivatedElementInfo;
-@class WKWebView;
-@protocol WKUIDelegate;
-
-namespace WebKit {
-
-class UIClient : public API::UIClient {
-public:
-    explicit UIClient(WKWebView *);
-    ~UIClient();
-
-    RetainPtr&lt;id &lt;WKUIDelegate&gt; &gt; delegate();
-    void setDelegate(id &lt;WKUIDelegate&gt;);
-
-    NSArray *actionsForElement(_WKActivatedElementInfo *, NSArray *defaultActions);
-
-private:
-    // API::UIClient
-    virtual PassRefPtr&lt;WebKit::WebPageProxy&gt; createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&amp;, const WebCore::WindowFeatures&amp;, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button) override;
-    virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void ()&gt; completionHandler) override;
-    virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void (bool)&gt; completionHandler) override;
-    virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&amp;, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void (const WTF::String&amp;)&gt; completionHandler) override;
-
-    WKWebView *m_webView;
-    WeakObjCPtr&lt;id &lt;WKUIDelegate&gt; &gt; m_delegate;
-
-    struct {
-        bool webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures : 1;
-        bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1;
-        bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
-        bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
-#if PLATFORM(IOS)
-        bool webViewActionsForElementDefaultActions : 1;
-#endif
-    } m_delegateMethods;
-};
-
-} // namespace WebKit
-
-#endif // WK_API_ENABLED
-
-#endif // UIClient_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIClientmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.mm (166719 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.mm        2014-04-03 15:46:05 UTC (rev 166719)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.mm        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -1,168 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#import &quot;config.h&quot;
-#import &quot;UIClient.h&quot;
-
-#if WK_API_ENABLED
-
-#import &quot;WKFrameInfoInternal.h&quot;
-#import &quot;WKNavigationActionInternal.h&quot;
-#import &quot;WKWebViewConfigurationInternal.h&quot;
-#import &quot;WKWebViewInternal.h&quot;
-#import &quot;WKWindowFeaturesInternal.h&quot;
-#import &quot;WKUIDelegatePrivate.h&quot;
-
-namespace WebKit {
-
-UIClient::UIClient(WKWebView *webView)
-    : m_webView(webView)
-{
-}
-
-UIClient::~UIClient()
-{
-}
-
-RetainPtr&lt;id &lt;WKUIDelegate&gt; &gt; UIClient::delegate()
-{
-    return m_delegate.get();
-}
-
-void UIClient::setDelegate(id &lt;WKUIDelegate&gt; delegate)
-{
-    m_delegate = delegate;
-
-    m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures = [delegate respondsToSelector:@selector(webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:)];
-    m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)];
-    m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
-    m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
-#if PLATFORM(IOS)
-    m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
-#endif
-}
-
-NSArray *UIClient::actionsForElement(_WKActivatedElementInfo *elementInfo, NSArray *defaultActions)
-{
-#if PLATFORM(IOS)
-    if (!m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler)
-        return defaultActions;
-
-    auto delegate = m_delegate.get();
-    if (!delegate)
-        return defaultActions;
-
-    return [(id &lt;WKUIDelegatePrivate&gt;)delegate _webView:m_webView actionsForElement:elementInfo defaultActions:defaultActions];
-#endif
-    return defaultActions;
-}
-
-PassRefPtr&lt;WebKit::WebPageProxy&gt; UIClient::createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy* initiatingFrame, const WebCore::ResourceRequest&amp; request, const WebCore::WindowFeatures&amp; windowFeatures, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button)
-{
-    if (!m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures)
-        return nullptr;
-
-    auto delegate = m_delegate.get();
-    if (!delegate)
-        return nullptr;
-
-    auto configuration = adoptNS([m_webView-&gt;_configuration copy]);
-    [configuration _setRelatedWebView:m_webView];
-
-    auto navigationAction = adoptNS([[WKNavigationAction alloc] init]);
-
-    // FIXME: Set a real navigation type.
-    [navigationAction setSourceFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*initiatingFrame]).get()];
-    [navigationAction setNavigationType:WKNavigationTypeOther];
-    [navigationAction setRequest:request.nsURLRequest(WebCore::DoNotUpdateHTTPBody)];
-
-    RetainPtr&lt;WKWebView&gt; webView = [delegate.get() webView:m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:navigationAction.get() windowFeatures:adoptNS([[WKWindowFeatures alloc] _initWithWindowFeatures:windowFeatures]).get()];
-
-    if (!webView)
-        return nullptr;
-
-    if ([webView-&gt;_configuration _relatedWebView] != m_webView)
-        [NSException raise:NSInternalInconsistencyException format:@&quot;Returned WKWebView was not created with the given configuration.&quot;];
-
-    return webView-&gt;_page.get();
-}
-
-void UIClient::runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&amp; message, WebKit::WebFrameProxy* webFrameProxy, std::function&lt;void ()&gt; completionHandler)
-{
-    if (!m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler) {
-        completionHandler();
-        return;
-    }
-
-    auto delegate = m_delegate.get();
-    if (!delegate) {
-        completionHandler();
-        return;
-    }
-
-    [delegate webView:m_webView runJavaScriptAlertPanelWithMessage:message initiatedByFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() completionHandler:[completionHandler] {
-        completionHandler();
-    }];
-}
-
-void UIClient::runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&amp; message, WebKit::WebFrameProxy* webFrameProxy, std::function&lt;void (bool)&gt; completionHandler)
-{
-    if (!m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler) {
-        completionHandler(false);
-        return;
-    }
-
-    auto delegate = m_delegate.get();
-    if (!delegate) {
-        completionHandler(false);
-        return;
-    }
-
-    [delegate webView:m_webView runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() completionHandler:[completionHandler](BOOL result) {
-        completionHandler(result);
-    }];
-}
-
-void UIClient::runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&amp; message, const WTF::String&amp; defaultValue, WebKit::WebFrameProxy* webFrameProxy, std::function&lt;void (const WTF::String&amp;)&gt; completionHandler)
-{
-    if (!m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler) {
-        completionHandler(String());
-        return;
-    }
-
-    auto delegate = m_delegate.get();
-    if (!delegate) {
-        completionHandler(String());
-        return;
-    }
-
-    [delegate webView:m_webView runJavaScriptTextInputPanelWithPrompt:message defaultText:defaultValue initiatedByFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() completionHandler:[completionHandler](NSString *result) {
-        completionHandler(result);
-    }];
-}
-
-} // namespace WebKit
-
-#endif // WK_API_ENABLED
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegatehfromrev166719trunkSourceWebKit2UIProcessCocoaUIClienth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (from rev 166719, trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.h) (0 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -0,0 +1,78 @@
</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 UIClient_h
+#define UIClient_h
+
+#import &quot;WKFoundation.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;APIUIClient.h&quot;
+#import &quot;WeakObjCPtr.h&quot;
+#import &lt;wtf/RetainPtr.h&gt;
+
+@class _WKActivatedElementInfo;
+@class WKWebView;
+@protocol WKUIDelegate;
+
+namespace WebKit {
+
+class UIClient : public API::UIClient {
+public:
+    explicit UIClient(WKWebView *);
+    ~UIClient();
+
+    RetainPtr&lt;id &lt;WKUIDelegate&gt; &gt; delegate();
+    void setDelegate(id &lt;WKUIDelegate&gt;);
+
+    NSArray *actionsForElement(_WKActivatedElementInfo *, NSArray *defaultActions);
+
+private:
+    // API::UIClient
+    virtual PassRefPtr&lt;WebKit::WebPageProxy&gt; createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&amp;, const WebCore::WindowFeatures&amp;, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button) override;
+    virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void ()&gt; completionHandler) override;
+    virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void (bool)&gt; completionHandler) override;
+    virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&amp;, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void (const WTF::String&amp;)&gt; completionHandler) override;
+
+    WKWebView *m_webView;
+    WeakObjCPtr&lt;id &lt;WKUIDelegate&gt; &gt; m_delegate;
+
+    struct {
+        bool webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures : 1;
+        bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1;
+        bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
+        bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
+#if PLATFORM(IOS)
+        bool webViewActionsForElementDefaultActions : 1;
+#endif
+    } m_delegateMethods;
+};
+
+} // namespace WebKit
+
+#endif // WK_API_ENABLED
+
+#endif // UIClient_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegatemmfromrev166719trunkSourceWebKit2UIProcessCocoaUIClientmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (from rev 166719, trunk/Source/WebKit2/UIProcess/Cocoa/UIClient.mm) (0 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -0,0 +1,168 @@
</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.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;UIDelegate.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;WKFrameInfoInternal.h&quot;
+#import &quot;WKNavigationActionInternal.h&quot;
+#import &quot;WKWebViewConfigurationInternal.h&quot;
+#import &quot;WKWebViewInternal.h&quot;
+#import &quot;WKWindowFeaturesInternal.h&quot;
+#import &quot;WKUIDelegatePrivate.h&quot;
+
+namespace WebKit {
+
+UIClient::UIClient(WKWebView *webView)
+    : m_webView(webView)
+{
+}
+
+UIClient::~UIClient()
+{
+}
+
+RetainPtr&lt;id &lt;WKUIDelegate&gt; &gt; UIClient::delegate()
+{
+    return m_delegate.get();
+}
+
+void UIClient::setDelegate(id &lt;WKUIDelegate&gt; delegate)
+{
+    m_delegate = delegate;
+
+    m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures = [delegate respondsToSelector:@selector(webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:)];
+    m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)];
+    m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
+    m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
+#if PLATFORM(IOS)
+    m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
+#endif
+}
+
+NSArray *UIClient::actionsForElement(_WKActivatedElementInfo *elementInfo, NSArray *defaultActions)
+{
+#if PLATFORM(IOS)
+    if (!m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler)
+        return defaultActions;
+
+    auto delegate = m_delegate.get();
+    if (!delegate)
+        return defaultActions;
+
+    return [(id &lt;WKUIDelegatePrivate&gt;)delegate _webView:m_webView actionsForElement:elementInfo defaultActions:defaultActions];
+#endif
+    return defaultActions;
+}
+
+PassRefPtr&lt;WebKit::WebPageProxy&gt; UIClient::createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy* initiatingFrame, const WebCore::ResourceRequest&amp; request, const WebCore::WindowFeatures&amp; windowFeatures, WebKit::WebEvent::Modifiers, WebKit::WebMouseEvent::Button)
+{
+    if (!m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures)
+        return nullptr;
+
+    auto delegate = m_delegate.get();
+    if (!delegate)
+        return nullptr;
+
+    auto configuration = adoptNS([m_webView-&gt;_configuration copy]);
+    [configuration _setRelatedWebView:m_webView];
+
+    auto navigationAction = adoptNS([[WKNavigationAction alloc] init]);
+
+    // FIXME: Set a real navigation type.
+    [navigationAction setSourceFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*initiatingFrame]).get()];
+    [navigationAction setNavigationType:WKNavigationTypeOther];
+    [navigationAction setRequest:request.nsURLRequest(WebCore::DoNotUpdateHTTPBody)];
+
+    RetainPtr&lt;WKWebView&gt; webView = [delegate.get() webView:m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:navigationAction.get() windowFeatures:adoptNS([[WKWindowFeatures alloc] _initWithWindowFeatures:windowFeatures]).get()];
+
+    if (!webView)
+        return nullptr;
+
+    if ([webView-&gt;_configuration _relatedWebView] != m_webView)
+        [NSException raise:NSInternalInconsistencyException format:@&quot;Returned WKWebView was not created with the given configuration.&quot;];
+
+    return webView-&gt;_page.get();
+}
+
+void UIClient::runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&amp; message, WebKit::WebFrameProxy* webFrameProxy, std::function&lt;void ()&gt; completionHandler)
+{
+    if (!m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler) {
+        completionHandler();
+        return;
+    }
+
+    auto delegate = m_delegate.get();
+    if (!delegate) {
+        completionHandler();
+        return;
+    }
+
+    [delegate webView:m_webView runJavaScriptAlertPanelWithMessage:message initiatedByFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() completionHandler:[completionHandler] {
+        completionHandler();
+    }];
+}
+
+void UIClient::runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&amp; message, WebKit::WebFrameProxy* webFrameProxy, std::function&lt;void (bool)&gt; completionHandler)
+{
+    if (!m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler) {
+        completionHandler(false);
+        return;
+    }
+
+    auto delegate = m_delegate.get();
+    if (!delegate) {
+        completionHandler(false);
+        return;
+    }
+
+    [delegate webView:m_webView runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() completionHandler:[completionHandler](BOOL result) {
+        completionHandler(result);
+    }];
+}
+
+void UIClient::runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&amp; message, const WTF::String&amp; defaultValue, WebKit::WebFrameProxy* webFrameProxy, std::function&lt;void (const WTF::String&amp;)&gt; completionHandler)
+{
+    if (!m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler) {
+        completionHandler(String());
+        return;
+    }
+
+    auto delegate = m_delegate.get();
+    if (!delegate) {
+        completionHandler(String());
+        return;
+    }
+
+    [delegate webView:m_webView runJavaScriptTextInputPanelWithPrompt:message defaultText:defaultValue initiatedByFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() completionHandler:[completionHandler](NSString *result) {
+        completionHandler(result);
+    }];
+}
+
+} // namespace WebKit
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (166719 => 166720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-04-03 15:46:05 UTC (rev 166719)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-04-03 16:03:46 UTC (rev 166720)
</span><span class="lines">@@ -435,8 +435,8 @@
</span><span class="cx">                 1AFDD3151891B54000153970 /* APIPolicyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFDD3141891B54000153970 /* APIPolicyClient.h */; };
</span><span class="cx">                 1AFDD3171891C94700153970 /* WKPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFDD3161891C94700153970 /* WKPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 1AFDD3191891CA1200153970 /* WKPreferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFDD3181891CA1200153970 /* WKPreferences.mm */; };
</span><del>-                1AFE436518B6C081009C7A48 /* UIClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFE436318B6C081009C7A48 /* UIClient.mm */; };
-                1AFE436618B6C081009C7A48 /* UIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE436418B6C081009C7A48 /* UIClient.h */; };
</del><ins>+                1AFE436518B6C081009C7A48 /* UIDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFE436318B6C081009C7A48 /* UIDelegate.mm */; };
+                1AFE436618B6C081009C7A48 /* UIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE436418B6C081009C7A48 /* UIDelegate.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">@@ -2220,8 +2220,8 @@
</span><span class="cx">                 1AFDD3141891B54000153970 /* APIPolicyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIPolicyClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AFDD3161891C94700153970 /* WKPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferences.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AFDD3181891CA1200153970 /* WKPreferences.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPreferences.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1AFE436318B6C081009C7A48 /* UIClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIClient.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
-                1AFE436418B6C081009C7A48 /* UIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                1AFE436318B6C081009C7A48 /* UIDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIDelegate.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AFE436418B6C081009C7A48 /* UIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDelegate.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">@@ -4261,8 +4261,8 @@
</span><span class="cx">                                 0F0C365918C0555800F607D7 /* LayerRepresentation.h */,
</span><span class="cx">                                 1ABC3DF41899E437004F0626 /* NavigationState.h */,
</span><span class="cx">                                 1ABC3DF31899E437004F0626 /* NavigationState.mm */,
</span><del>-                                1AFE436418B6C081009C7A48 /* UIClient.h */,
-                                1AFE436318B6C081009C7A48 /* UIClient.mm */,
</del><ins>+                                1AFE436418B6C081009C7A48 /* UIDelegate.h */,
+                                1AFE436318B6C081009C7A48 /* UIDelegate.mm */,
</ins><span class="cx">                                 2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */,
</span><span class="cx">                                 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */,
</span><span class="cx">                                 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */,
</span><span class="lines">@@ -6868,7 +6868,7 @@
</span><span class="cx">                                 7CD622781739D863005BD7FF /* PluginSandboxProfile.h in Headers */,
</span><span class="cx">                                 1AAB037A185A7C6A00EDF501 /* MessageSender.h in Headers */,
</span><span class="cx">                                 1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */,
</span><del>-                                1AFE436618B6C081009C7A48 /* UIClient.h in Headers */,
</del><ins>+                                1AFE436618B6C081009C7A48 /* UIDelegate.h in Headers */,
</ins><span class="cx">                                 E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */,
</span><span class="cx">                                 BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */,
</span><span class="cx">                                 BC597075116591D000551FCA /* ProcessModel.h in Headers */,
</span><span class="lines">@@ -8178,7 +8178,7 @@
</span><span class="cx">                                 1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */,
</span><span class="cx">                                 BC8147AA12F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp in Sources */,
</span><span class="cx">                                 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */,
</span><del>-                                1AFE436518B6C081009C7A48 /* UIClient.mm in Sources */,
</del><ins>+                                1AFE436518B6C081009C7A48 /* UIDelegate.mm in Sources */,
</ins><span class="cx">                                 BCA8C6AF11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp in Sources */,
</span><span class="cx">                                 0F5947A3187B3B7D00437857 /* RemoteScrollingCoordinatorTransaction.cpp in Sources */,
</span><span class="cx">                                 BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>