<!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>[160227] trunk/Source</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/160227">160227</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2013-12-06 10:21:05 -0800 (Fri, 06 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] Add load delegate methods for responding to authentication challenges
https://bugs.webkit.org/show_bug.cgi?id=125333

Reviewed by Darin Adler.

Source/WebCore: 

* WebCore.exp.in: Exported core(NSURLCredential *).

Source/WebKit2: 

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject): Allocate a WKNSURLAuthenticationChallenge if the object is an
AuthenticationChallengeProxy.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(canAuthenticateAgainstProtectionSpaceInFrame): Implemented this WKPageLoaderClient callback
by calling the load delegate.
(didReceiveAuthenticationChallengeInFrame): Ditto.
(setUpPageLoaderClient): Set the above callbacks in the client structure.

* UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: Added. Declares two new
delegate methods.

* UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h: Added.
(WebKit::wrapper): Added. Returns an AuthenticationChallengeProxy’s wrapper as an
NSURLAuthenticationChallenge.
* UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: Added.
(-[WKNSURLAuthenticationChallenge _web_createTarget]): Override this WKObject method to
return a copy of the challenge with the sender set to a shared instance of
WKNSURLAuthenticationChallengeSender.
(-[WKNSURLAuthenticationChallenge _web_authenticationChallengeProxy]): Added. Returns the
wrapped object.
(-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Added. Calls
AuthenticationDecisionListener::cancel.
(-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
Added. Calls AuthenticationDecisionListener::useCredential, passing nullptr.
(-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Added.
Calls AuthenticationDecisionListener::useCredential, passing the credential.

* WebKit2.xcodeproj/project.pbxproj: Added references to new files.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaAPIObjectmm">trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextControllermm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.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="#trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextLoadDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNSURLAuthenticationChallengeh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNSURLAuthenticationChallengemm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160226 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-06 18:13:29 UTC (rev 160226)
+++ trunk/Source/WebCore/ChangeLog        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2013-12-06  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        [Cocoa] Add load delegate methods for responding to authentication challenges
+        https://bugs.webkit.org/show_bug.cgi?id=125333
+
+        Reviewed by Darin Adler.
+
+        * WebCore.exp.in: Exported core(NSURLCredential *).
+
</ins><span class="cx"> 2013-12-06  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename {adjust, paint}SearchFieldDecoration, {adjust, paint}SearchFieldResultsDecoration
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (160226 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2013-12-06 18:13:29 UTC (rev 160226)
+++ trunk/Source/WebCore/WebCore.exp.in        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -985,6 +985,7 @@
</span><span class="cx"> __ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeENS0_19RoundedRectStrategyE
</span><span class="cx"> __ZN7WebCore4PathC1Ev
</span><span class="cx"> __ZN7WebCore4PathD1Ev
</span><ins>+__ZN7WebCore4coreEP15NSURLCredential
</ins><span class="cx"> __ZN7WebCore4coreEP20NSURLProtectionSpace
</span><span class="cx"> __ZN7WebCore4coreEP28NSURLAuthenticationChallenge
</span><span class="cx"> __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (160226 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-12-06 18:13:29 UTC (rev 160226)
+++ trunk/Source/WebKit2/ChangeLog        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2013-12-06  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        [Cocoa] Add load delegate methods for responding to authentication challenges
+        https://bugs.webkit.org/show_bug.cgi?id=125333
+
+        Reviewed by Darin Adler.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject): Allocate a WKNSURLAuthenticationChallenge if the object is an
+        AuthenticationChallengeProxy.
+
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (canAuthenticateAgainstProtectionSpaceInFrame): Implemented this WKPageLoaderClient callback
+        by calling the load delegate.
+        (didReceiveAuthenticationChallengeInFrame): Ditto.
+        (setUpPageLoaderClient): Set the above callbacks in the client structure.
+
+        * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: Added. Declares two new
+        delegate methods.
+
+        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h: Added.
+        (WebKit::wrapper): Added. Returns an AuthenticationChallengeProxy’s wrapper as an
+        NSURLAuthenticationChallenge.
+        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: Added.
+        (-[WKNSURLAuthenticationChallenge _web_createTarget]): Override this WKObject method to
+        return a copy of the challenge with the sender set to a shared instance of
+        WKNSURLAuthenticationChallengeSender.
+        (-[WKNSURLAuthenticationChallenge _web_authenticationChallengeProxy]): Added. Returns the
+        wrapped object.
+        (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Added. Calls
+        AuthenticationDecisionListener::cancel.
+        (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
+        Added. Calls AuthenticationDecisionListener::useCredential, passing nullptr.
+        (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Added.
+        Calls AuthenticationDecisionListener::useCredential, passing the credential.
+
+        * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
+
</ins><span class="cx"> 2013-12-05  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Introduce IMAGE_TYPE_CASTS, and use it
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (160226 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2013-12-06 18:13:29 UTC (rev 160226)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import &quot;WKNSError.h&quot;
</span><span class="cx"> #import &quot;WKNSString.h&quot;
</span><span class="cx"> #import &quot;WKNSURL.h&quot;
</span><ins>+#import &quot;WKNSURLAuthenticationChallenge.h&quot;
</ins><span class="cx"> #import &quot;WKNSURLProtectionSpace.h&quot;
</span><span class="cx"> #import &quot;WKNavigationDataInternal.h&quot;
</span><span class="cx"> #import &quot;WKProcessGroupInternal.h&quot;
</span><span class="lines">@@ -66,6 +67,10 @@
</span><span class="cx">         wrapper = [WKNSArray alloc];
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+    case Type::AuthenticationChallenge:
+        wrapper = NSAllocateObject([WKNSURLAuthenticationChallenge self], size, nullptr);
+        break;
+
</ins><span class="cx">     case Type::BackForwardList:
</span><span class="cx">         wrapper = [WKBackForwardList alloc];
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm (160226 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm        2013-12-06 18:13:29 UTC (rev 160226)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -37,7 +37,9 @@
</span><span class="cx"> #import &quot;WKFramePolicyListener.h&quot;
</span><span class="cx"> #import &quot;WKNSArray.h&quot;
</span><span class="cx"> #import &quot;WKNSError.h&quot;
</span><ins>+#import &quot;WKNSURLAuthenticationChallenge.h&quot;
</ins><span class="cx"> #import &quot;WKNSURLExtras.h&quot;
</span><ins>+#import &quot;WKNSURLProtectionSpace.h&quot;
</ins><span class="cx"> #import &quot;WKRetainPtr.h&quot;
</span><span class="cx"> #import &quot;WKURLRequestNS.h&quot;
</span><span class="cx"> #import &quot;WKURLResponseNS.h&quot;
</span><span class="lines">@@ -47,7 +49,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WKBrowsingContextGroupInternal.h&quot;
</span><span class="cx"> #import &quot;WKBrowsingContextHandleInternal.h&quot;
</span><del>-#import &quot;WKBrowsingContextLoadDelegate.h&quot;
</del><ins>+#import &quot;WKBrowsingContextLoadDelegatePrivate.h&quot;
</ins><span class="cx"> #import &quot;WKBrowsingContextPolicyDelegate.h&quot;
</span><span class="cx"> #import &quot;WKProcessGroupInternal.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -439,6 +441,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool canAuthenticateAgainstProtectionSpaceInFrame(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo)
+{
+    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
+    auto loadDelegate = browsingContext-&gt;_loadDelegate.get();
+
+    if ([loadDelegate respondsToSelector:@selector(browsingContextController:canAuthenticateAgainstProtectionSpace:)])
+        return [(id &lt;WKBrowsingContextLoadDelegatePrivate&gt;)loadDelegate browsingContextController:browsingContext canAuthenticateAgainstProtectionSpace:wrapper(*toImpl(protectionSpace))];
+
+    return false;
+}
+
+static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
+{
+    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
+    auto loadDelegate = browsingContext-&gt;_loadDelegate.get();
+
+    if ([loadDelegate respondsToSelector:@selector(browsingContextController:didReceiveAuthenticationChallenge:)])
+        [(id &lt;WKBrowsingContextLoadDelegatePrivate&gt;)loadDelegate browsingContextController:browsingContext didReceiveAuthenticationChallenge:wrapper(*toImpl(authenticationChallenge))];
+}
+
</ins><span class="cx"> static void didStartProgress(WKPageRef page, const void* clientInfo)
</span><span class="cx"> {
</span><span class="cx">     WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
</span><span class="lines">@@ -493,6 +515,9 @@
</span><span class="cx">     loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
</span><span class="cx">     loaderClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame;
</span><span class="cx"> 
</span><ins>+    loaderClient.canAuthenticateAgainstProtectionSpaceInFrame = canAuthenticateAgainstProtectionSpaceInFrame;
+    loaderClient.didReceiveAuthenticationChallengeInFrame = didReceiveAuthenticationChallengeInFrame;
+
</ins><span class="cx">     loaderClient.didStartProgress = didStartProgress;
</span><span class="cx">     loaderClient.didChangeProgress = didChangeProgress;
</span><span class="cx">     loaderClient.didFinishProgress = didFinishProgress;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKBrowsingContextLoadDelegatePrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h (0 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+/*
+ * Copyright (C) 2013 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 &lt;WebKit2/WKBrowsingContextLoadDelegate.h&gt;
+
+@protocol WKBrowsingContextLoadDelegatePrivate &lt;WKBrowsingContextLoadDelegate&gt;
+@optional
+
+- (BOOL)browsingContextController:(WKBrowsingContextController *)sender canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
+- (void)browsingContextController:(WKBrowsingContextController *)sender didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
+
+@end
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNSURLAuthenticationChallengeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h (0 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2013 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;WKFoundation.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;AuthenticationChallengeProxy.h&quot;
+#import &quot;WKObject.h&quot;
+
+namespace WebKit {
+
+inline NSURLAuthenticationChallenge *wrapper(AuthenticationChallengeProxy&amp; challenge)
+{
+    ASSERT([challenge.wrapper() isKindOfClass:[NSURLAuthenticationChallenge self]]);
+    return (NSURLAuthenticationChallenge *)challenge.wrapper();
+}
+
+}
+
+@interface WKNSURLAuthenticationChallenge : WKObject
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNSURLAuthenticationChallengemm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (0 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+/*
+ * Copyright (C) 2013 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;WKNSURLAuthenticationChallenge.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;AuthenticationDecisionListener.h&quot;
+#import &quot;WebCertificateInfo.h&quot;
+#import &quot;WebCredential.h&quot;
+#import &lt;WebCore/AuthenticationMac.h&gt;
+
+using namespace WebCore;
+using namespace WebKit;
+
+@interface WKNSURLAuthenticationChallengeSender : NSObject &lt;NSURLAuthenticationChallengeSender&gt;
+@end
+
+@implementation WKNSURLAuthenticationChallenge
+
+- (NSObject *)_web_createTarget
+{
+    AuthenticationChallengeProxy&amp; challenge = *reinterpret_cast&lt;AuthenticationChallengeProxy*&gt;(&amp;self._apiObject);
+
+    static dispatch_once_t token;
+    static WKNSURLAuthenticationChallengeSender *sender;
+    dispatch_once(&amp;token, ^{
+        sender = [[WKNSURLAuthenticationChallengeSender alloc] init];
+    });
+
+    return [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:mac(challenge.core()) sender:sender];
+}
+
+- (AuthenticationChallengeProxy&amp;)_web_authenticationChallengeProxy
+{
+    return *reinterpret_cast&lt;AuthenticationChallengeProxy*&gt;(&amp;self._apiObject);
+}
+
+@end
+
+@implementation WKNSURLAuthenticationChallengeSender
+
+- (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    if ([challenge class] != [WKNSURLAuthenticationChallenge class])
+        [NSException raise:NSInvalidArgumentException format:@&quot;The challenge was not sent by the receiver.&quot;];
+
+    AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
+    webChallenge.listener()-&gt;cancel();
+}
+
+- (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    if ([challenge class] != [WKNSURLAuthenticationChallenge class])
+        [NSException raise:NSInvalidArgumentException format:@&quot;The challenge was not sent by the receiver.&quot;];
+
+    AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
+    webChallenge.listener()-&gt;useCredential(nullptr);
+}
+
+- (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    if ([challenge class] != [WKNSURLAuthenticationChallenge class])
+        [NSException raise:NSInvalidArgumentException format:@&quot;The challenge was not sent by the receiver.&quot;];
+
+    AuthenticationChallengeProxy&amp; webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
+
+    webChallenge.listener()-&gt;useCredential(WebCredential::create(core(credential)).get());
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (160226 => 160227)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2013-12-06 18:13:29 UTC (rev 160226)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2013-12-06 18:21:05 UTC (rev 160227)
</span><span class="lines">@@ -475,6 +475,9 @@
</span><span class="cx">                 37DFA7001810BB92001F4A9F /* WKFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 37DFA6FF1810BB92001F4A9F /* WKFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 37F90DE31376560E0051CF68 /* HTTPCookieAcceptPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F638954F133BEF38008941D5 /* HTTPCookieAcceptPolicy.h */; };
</span><ins>+                37FC19471850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                37FC194A18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */; };
+                37FC194B18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */; };
</ins><span class="cx">                 3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */; };
</span><span class="cx">                 3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BB15893F630090FF62 /* WebColorChooser.h */; };
</span><span class="cx">                 3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BF158940D80090FF62 /* WebColorPicker.h */; };
</span><span class="lines">@@ -2017,6 +2020,9 @@
</span><span class="cx">                 37D0B5C71845232700F6CE7D /* WKErrorRecoveryAttempting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKErrorRecoveryAttempting.m; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37DFA6FF1810BB92001F4A9F /* WKFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFoundation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextLoadDelegatePrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLAuthenticationChallenge.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLAuthenticationChallenge.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebColorChooser.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3F87B9BB15893F630090FF62 /* WebColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorChooser.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3F87B9BF158940D80090FF62 /* WebColorPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPicker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3793,6 +3799,7 @@
</span><span class="cx">                                 BCBAACF0145232480053F82F /* WKBrowsingContextGroupPrivate.h */,
</span><span class="cx">                                 370F34A61829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h */,
</span><span class="cx">                                 BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */,
</span><ins>+                                37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */,
</ins><span class="cx">                                 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */,
</span><span class="cx">                                 BCA284D51492F2C7001F9042 /* WKConnection.h */,
</span><span class="cx">                                 BCA284D41492F2C7001F9042 /* WKConnection.mm */,
</span><span class="lines">@@ -3802,6 +3809,8 @@
</span><span class="cx">                                 370F34A11829BE1E009027C8 /* WKNavigationData.h */,
</span><span class="cx">                                 370F34A01829BE1E009027C8 /* WKNavigationData.mm */,
</span><span class="cx">                                 370F34A41829BEA3009027C8 /* WKNavigationDataInternal.h */,
</span><ins>+                                37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */,
+                                37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */,
</ins><span class="cx">                                 BCBAACE5145225C90053F82F /* WKProcessGroup.h */,
</span><span class="cx">                                 BCBAACE6145225CA0053F82F /* WKProcessGroup.mm */,
</span><span class="cx">                                 7C1FB3BF1846AEFC001A03D8 /* WKProcessGroupInternal.h */,
</span><span class="lines">@@ -5843,6 +5852,7 @@
</span><span class="cx">                                 BC72BA1E11E64907001EB4EA /* WebBackForwardList.h in Headers */,
</span><span class="cx">                                 518D2CAE12D5153B003BB93B /* WebBackForwardListItem.h in Headers */,
</span><span class="cx">                                 BC72B9FB11E6476B001EB4EA /* WebBackForwardListProxy.h in Headers */,
</span><ins>+                                37FC194B18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h in Headers */,
</ins><span class="cx">                                 BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */,
</span><span class="cx">                                 BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */,
</span><span class="cx">                                 515E773418402D510007203F /* UniqueIDBDatabaseIdentifier.h in Headers */,
</span><span class="lines">@@ -6102,6 +6112,7 @@
</span><span class="cx">                                 BC54CC1212D674EE005C67B0 /* WKGeolocationManager.h in Headers */,
</span><span class="cx">                                 BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */,
</span><span class="cx">                                 BC0E619812D6CD120012A72A /* WKGeolocationPosition.h in Headers */,
</span><ins>+                                37FC19471850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h in Headers */,
</ins><span class="cx">                                 BCC8B374125FB69000DE46A4 /* WKGeometry.h in Headers */,
</span><span class="cx">                                 B62E7312143047B00069EC35 /* WKHitTestResult.h in Headers */,
</span><span class="cx">                                 5110AE0D133C16CB0072717A /* WKIconDatabase.h in Headers */,
</span><span class="lines">@@ -7047,6 +7058,7 @@
</span><span class="cx">                                 5163199416289A6000E22F00 /* NetworkProcessMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */,
</span><span class="cx">                                 5179556D162877B100FA43B6 /* NetworkProcessProxy.cpp in Sources */,
</span><ins>+                                37FC194A18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm in Sources */,
</ins><span class="cx">                                 516319921628980A00E22F00 /* NetworkProcessProxyMac.mm in Sources */,
</span><span class="cx">                                 513A163C163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 51FD18B51651FBAD00DBE1CE /* NetworkResourceLoader.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>