<!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>[170330] trunk</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/170330">170330</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-06-23 16:15:10 -0700 (Mon, 23 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add SPI for Injected Bundle to provide user agent for a given URL.
https://bugs.webkit.org/show_bug.cgi?id=133562

Patch by Grant Kennell &lt;gkennell@apple.com&gt; on 2014-06-23
Reviewed by Sam Weinig.

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
  Added delegate method to WebProcess PluIn protocol to provide UserAgent per URL.
* WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
  Added new typedef for function pointer for this new delegate call.
  Added new version (V8) of bundle loader client struct containing
  a function pointer of that new type.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(userAgentForURL): Makes delegate call with the new method.
(setUpPageLoaderClient): Sets the struct's new function pointer to the new method.
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::userAgentForURL):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::userAgent):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::userAgent): Began using the new API to ask for user agent
  instead of simply returning what had been stored.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::userAgent): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInLoadDelegateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageLoaderClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllermm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageLoaderClientcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageLoaderClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-06-23  Grant Kennell  &lt;gkennell@apple.com&gt;
+
+        Add SPI for Injected Bundle to provide user agent for a given URL.
+        https://bugs.webkit.org/show_bug.cgi?id=133562
+
+        Reviewed by Sam Weinig.
+
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: 
+          Added delegate method to WebProcess PluIn protocol to provide UserAgent per URL.
+        * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
+          Added new typedef for function pointer for this new delegate call.
+          Added new version (V8) of bundle loader client struct containing
+          a function pointer of that new type.
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+        (userAgentForURL): Makes delegate call with the new method.
+        (setUpPageLoaderClient): Sets the struct's new function pointer to the new method.
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        (WebKit::InjectedBundlePageLoaderClient::userAgentForURL):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::userAgent):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::userAgent): Began using the new API to ask for user agent
+          instead of simply returning what had been stored.
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::userAgent): Deleted.
+
</ins><span class="cx"> 2014-06-23  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r170324.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInLoadDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -57,4 +57,6 @@
</span><span class="cx"> - (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame didFinishLoadForResource:(uint64_t)resource;
</span><span class="cx"> - (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame didFailLoadForResource:(uint64_t)resource error:(NSError *)error;
</span><span class="cx"> 
</span><ins>+- (NSString *)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame userAgentForURL:(NSURL *)url;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> typedef void (*WKBundlePageWillLoadURLRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo);
</span><span class="cx"> typedef void (*WKBundlePageWillLoadDataRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo);
</span><span class="cx"> typedef void (*WKBundlePageWillDestroyFrame)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
</span><ins>+typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo);
</ins><span class="cx"> 
</span><span class="cx"> typedef struct WKBundlePageLoaderClientBase {
</span><span class="cx">     int                                                                     version;
</span><span class="lines">@@ -406,7 +407,65 @@
</span><span class="cx">     WKBundlePageWillDestroyFrame                                            willDestroyFrame;
</span><span class="cx"> } WKBundlePageLoaderClientV7;
</span><span class="cx"> 
</span><del>-enum { kWKBundlePageLoaderClientCurrentVersion WK_ENUM_DEPRECATED(&quot;Use an explicit version number instead&quot;) = 7 };
</del><ins>+typedef struct WKBundlePageLoaderClientV8 {
+    WKBundlePageLoaderClientBase                                            base;
+    
+    // Version 0.
+    WKBundlePageDidStartProvisionalLoadForFrameCallback                     didStartProvisionalLoadForFrame;
+    WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback  didReceiveServerRedirectForProvisionalLoadForFrame;
+    WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback             didFailProvisionalLoadWithErrorForFrame;
+    WKBundlePageDidCommitLoadForFrameCallback                               didCommitLoadForFrame;
+    WKBundlePageDidFinishDocumentLoadForFrameCallback                       didFinishDocumentLoadForFrame;
+    WKBundlePageDidFinishLoadForFrameCallback                               didFinishLoadForFrame;
+    WKBundlePageDidFailLoadWithErrorForFrameCallback                        didFailLoadWithErrorForFrame;
+    WKBundlePageDidSameDocumentNavigationForFrameCallback                   didSameDocumentNavigationForFrame;
+    WKBundlePageDidReceiveTitleForFrameCallback                             didReceiveTitleForFrame;
+    WKBundlePageDidFirstLayoutForFrameCallback                              didFirstLayoutForFrame;
+    WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback              didFirstVisuallyNonEmptyLayoutForFrame;
+    WKBundlePageDidRemoveFrameFromHierarchyCallback                         didRemoveFrameFromHierarchy;
+    WKBundlePageDidDisplayInsecureContentForFrameCallback                   didDisplayInsecureContentForFrame;
+    WKBundlePageDidRunInsecureContentForFrameCallback                       didRunInsecureContentForFrame;
+    WKBundlePageDidClearWindowObjectForFrameCallback                        didClearWindowObjectForFrame;
+    WKBundlePageDidCancelClientRedirectForFrameCallback                     didCancelClientRedirectForFrame;
+    WKBundlePageWillPerformClientRedirectForFrameCallback                   willPerformClientRedirectForFrame;
+    WKBundlePageDidHandleOnloadEventsForFrameCallback                       didHandleOnloadEventsForFrame;
+    
+    // Version 1.
+    WKBundlePageDidLayoutForFrameCallback                                   didLayoutForFrame;
+    void *                                                                  didNewFirstVisuallyNonEmptyLayout_unavailable;
+    WKBundlePageDidDetectXSSForFrameCallback                                didDetectXSSForFrame;
+    WKBundlePageShouldGoToBackForwardListItemCallback                       shouldGoToBackForwardListItem;
+    WKBundlePageGlobalObjectIsAvailableForFrameCallback                     globalObjectIsAvailableForFrame;
+    WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback    willDisconnectDOMWindowExtensionFromGlobalObject;
+    WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback        didReconnectDOMWindowExtensionToGlobalObject;
+    WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback        willDestroyGlobalObjectForDOMWindowExtension;
+    
+    // Version 2
+    WKBundlePageDidFinishProgressCallback                                   didFinishProgress;
+    WKBundlePageShouldForceUniversalAccessFromLocalURLCallback              shouldForceUniversalAccessFromLocalURL;
+    
+    // Version 3
+    void *                                                                  didReceiveIntentForFrame_unavailable;
+    void *                                                                  registerIntentServiceForFrame_unavailable;
+    
+    // Version 4
+    WKBundlePageDidLayoutCallback                                           didLayout;
+    
+    // Version 5
+    WKBundlePageFeaturesUsedInPageCallback                                  featuresUsedInPage;
+    
+    // Version 6
+    WKBundlePageWillLoadURLRequestCallback                                  willLoadURLRequest;
+    WKBundlePageWillLoadDataRequestCallback                                 willLoadDataRequest;
+    
+    // Version 7
+    WKBundlePageWillDestroyFrame                                            willDestroyFrame;
+    
+    // Version 8
+    WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
+} WKBundlePageLoaderClientV8;
+
+enum { kWKBundlePageLoaderClientCurrentVersion WK_ENUM_DEPRECATED(&quot;Use an explicit version number instead&quot;) = 8 };
</ins><span class="cx"> typedef struct WKBundlePageLoaderClient {
</span><span class="cx">     int                                                                     version;
</span><span class="cx">     const void *                                                            clientInfo;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -38,9 +38,12 @@
</span><span class="cx"> #import &quot;WKDOMInternals.h&quot;
</span><span class="cx"> #import &quot;WKNSDictionary.h&quot;
</span><span class="cx"> #import &quot;WKNSError.h&quot;
</span><ins>+#import &quot;WKNSString.h&quot;
+#import &quot;WKNSURL.h&quot;
</ins><span class="cx"> #import &quot;WKNSURLRequest.h&quot;
</span><span class="cx"> #import &quot;WKRenderingProgressEventsInternal.h&quot;
</span><span class="cx"> #import &quot;WKRetainPtr.h&quot;
</span><ins>+#import &quot;WKStringCF.h&quot;
</ins><span class="cx"> #import &quot;WKURLRequestNS.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPluginFrameInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebProcessPlugInInternal.h&quot;
</span><span class="lines">@@ -176,12 +179,31 @@
</span><span class="cx">     if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didHandleOnloadEventsForFrame:)])
</span><span class="cx">         [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didHandleOnloadEventsForFrame:wrapper(*toImpl(frame))];
</span><span class="cx"> }
</span><ins>+
+static WKStringRef userAgentForURL(WKBundleFrameRef frame, WKURLRef url, const void* clientInfo)
+{
+    WKWebProcessPlugInBrowserContextController *pluginContextController = (WKWebProcessPlugInBrowserContextController *)clientInfo;
+    auto loadDelegate = pluginContextController-&gt;_loadDelegate.get();
+    
+    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:frame:userAgentForURL:)]) {
+        WKWebProcessPlugInFrame *newFrame = wrapper(*toImpl(frame));
+        NSString *string = [loadDelegate webProcessPlugInBrowserContextController:pluginContextController frame:newFrame userAgentForURL:wrapper(*toImpl(url))];
+        if (!string)
+            return nullptr;
+
+        WKStringRef wkString = WKStringCreateWithCFString((CFStringRef)string);
+        return wkString;
+    }
+    
+    return nullptr;
+}
+
</ins><span class="cx"> static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebPage&amp; page)
</span><span class="cx"> {
</span><del>-    WKBundlePageLoaderClientV7 client;
</del><ins>+    WKBundlePageLoaderClientV8 client;
</ins><span class="cx">     memset(&amp;client, 0, sizeof(client));
</span><span class="cx"> 
</span><del>-    client.base.version = 7;
</del><ins>+    client.base.version = 8;
</ins><span class="cx">     client.base.clientInfo = contextController;
</span><span class="cx">     client.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
</span><span class="cx">     client.didCommitLoadForFrame = didCommitLoadForFrame;
</span><span class="lines">@@ -193,6 +215,7 @@
</span><span class="cx">     client.didRemoveFrameFromHierarchy = didRemoveFrameFromHierarchy;
</span><span class="cx">     client.didHandleOnloadEventsForFrame = didHandleOnloadEventsForFrame;
</span><span class="cx">     client.didFirstVisuallyNonEmptyLayoutForFrame = didFirstVisuallyNonEmptyLayoutForFrame;
</span><ins>+    client.userAgentForURL = userAgentForURL;
</ins><span class="cx"> 
</span><span class="cx">     client.didLayoutForFrame = didLayoutForFrame;
</span><span class="cx">     client.didLayout = didLayout;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -29,11 +29,13 @@
</span><span class="cx"> #include &quot;APIArray.h&quot;
</span><span class="cx"> #include &quot;APIData.h&quot;
</span><span class="cx"> #include &quot;APIError.h&quot;
</span><ins>+#include &quot;APIURL.h&quot;
</ins><span class="cx"> #include &quot;APIURLRequest.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleDOMWindowExtension.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleScriptWorld.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="cx"> #include &quot;WKBundleAPICast.h&quot;
</span><ins>+#include &quot;WKSharedAPICast.h&quot;
</ins><span class="cx"> #include &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -351,5 +353,13 @@
</span><span class="cx"> 
</span><span class="cx">     m_client.willDestroyFrame(toAPI(page), toAPI(frame), m_client.base.clientInfo);
</span><span class="cx"> }
</span><del>-
</del><ins>+    
+API::String* InjectedBundlePageLoaderClient::userAgentForURL(WebFrame* frame, API::URL* url) const
+{
+    if (!m_client.userAgentForURL)
+        return nullptr;
+    WKStringRef userAgent = m_client.userAgentForURL(toAPI(frame), toAPI(url), m_client.base.clientInfo);
+    return toImpl(userAgent);
+}
+    
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx"> #define InjectedBundlePageLoaderClient_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIClient.h&quot;
</span><ins>+#include &quot;APIString.h&quot;
+#include &quot;APIURL.h&quot;
</ins><span class="cx"> #include &quot;SameDocumentNavigationType.h&quot;
</span><span class="cx"> #include &quot;WKBundlePage.h&quot;
</span><span class="cx"> #include &lt;JavaScriptCore/JSBase.h&gt;
</span><span class="lines">@@ -38,7 +40,7 @@
</span><span class="cx"> class Object;
</span><span class="cx"> 
</span><span class="cx"> template&lt;&gt; struct ClientTraits&lt;WKBundlePageLoaderClientBase&gt; {
</span><del>-    typedef std::tuple&lt;WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7&gt; Versions;
</del><ins>+    typedef std::tuple&lt;WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8&gt; Versions;
</ins><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -99,6 +101,7 @@
</span><span class="cx">     void featuresUsedInPage(WebPage*, const Vector&lt;String&gt;&amp;);
</span><span class="cx"> 
</span><span class="cx">     void willDestroyFrame(WebPage*, WebFrame*);
</span><ins>+    API::String* userAgentForURL(WebFrame*, API::URL*) const;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include &quot;InjectedBundleUserMessageCoders.h&quot;
</span><span class="cx"> #include &quot;NavigationActionData.h&quot;
</span><span class="cx"> #include &quot;PluginView.h&quot;
</span><ins>+#include &quot;WKBundleAPICast.h&quot;
</ins><span class="cx"> #include &quot;WebBackForwardListProxy.h&quot;
</span><span class="cx"> #include &quot;WebContextMessages.h&quot;
</span><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="lines">@@ -1187,7 +1188,7 @@
</span><span class="cx">     if (!webPage)
</span><span class="cx">         return String();
</span><span class="cx"> 
</span><del>-    return webPage-&gt;userAgent(url);
</del><ins>+    return webPage-&gt;userAgent(m_frame, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -55,7 +55,10 @@
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><span class="cx"> #include &quot;TelephoneNumberOverlayController.h&quot;
</span><span class="cx"> #include &quot;VisitedLinkTableController.h&quot;
</span><ins>+#include &quot;WKBundleAPICast.h&quot;
+#include &quot;WKRetainPtr.h&quot;
</ins><span class="cx"> #include &quot;WKSharedAPICast.h&quot;
</span><ins>+#include &quot;WKStringCF.h&quot;
</ins><span class="cx"> #include &quot;WebAlternativeTextClient.h&quot;
</span><span class="cx"> #include &quot;WebBackForwardListItem.h&quot;
</span><span class="cx"> #include &quot;WebBackForwardListProxy.h&quot;
</span><span class="lines">@@ -2271,19 +2274,31 @@
</span><span class="cx">     send(Messages::WebPageProxy::ShowPage());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::setUserAgent(const String&amp; userAgent)
</del><ins>+String WebPage::userAgent(const URL&amp; webCoreURL) const
</ins><span class="cx"> {
</span><del>-    m_userAgent = userAgent;
</del><ins>+    return userAgent(nullptr, webCoreURL);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String WebPage::userAgent(const URL&amp; url) const
</del><ins>+String WebPage::userAgent(WebFrame* frame, const URL&amp; webcoreURL) const
</ins><span class="cx"> {
</span><del>-    String userAgent = platformUserAgent(url);
</del><ins>+    if (frame &amp;&amp; m_loaderClient.client().userAgentForURL) {
+        RefPtr&lt;API::URL&gt; url = API::URL::create(webcoreURL);
+
+        API::String* apiString = m_loaderClient.userAgentForURL(frame, url.get());
+        if (apiString)
+            return apiString-&gt;string();
+    }
+
+    String userAgent = platformUserAgent(webcoreURL);
</ins><span class="cx">     if (!userAgent.isEmpty())
</span><span class="cx">         return userAgent;
</span><del>-
</del><span class="cx">     return m_userAgent;
</span><span class="cx"> }
</span><ins>+    
+void WebPage::setUserAgent(const String&amp; userAgent)
+{
+    m_userAgent = userAgent;
+}
</ins><span class="cx"> 
</span><span class="cx"> void WebPage::suspendActiveDOMObjectsAndAnimations()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -255,6 +255,7 @@
</span><span class="cx">     void didFinishLoad(WebFrame*);
</span><span class="cx">     void show();
</span><span class="cx">     String userAgent(const WebCore::URL&amp;) const;
</span><ins>+    String userAgent(WebFrame*, const WebCore::URL&amp;) const;
</ins><span class="cx">     String platformUserAgent(const WebCore::URL&amp;) const;
</span><span class="cx">     WebCore::IntRect windowResizerRect() const;
</span><span class="cx">     WebCore::KeyboardUIMode keyboardUIMode();
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (170329 => 170330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2014-06-23 23:13:42 UTC (rev 170329)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2014-06-23 23:15:10 UTC (rev 170330)
</span><span class="lines">@@ -268,8 +268,8 @@
</span><span class="cx">     : m_page(page)
</span><span class="cx">     , m_world(AdoptWK, WKBundleScriptWorldCreateWorld())
</span><span class="cx"> {
</span><del>-    WKBundlePageLoaderClientV7 loaderClient = {
-        { 7, this },
</del><ins>+    WKBundlePageLoaderClientV8 loaderClient = {
+        { 8, this },
</ins><span class="cx">         didStartProvisionalLoadForFrame,
</span><span class="cx">         didReceiveServerRedirectForProvisionalLoadForFrame,
</span><span class="cx">         didFailProvisionalLoadWithErrorForFrame,
</span><span class="lines">@@ -305,6 +305,7 @@
</span><span class="cx">         0, // willLoadURLRequest
</span><span class="cx">         0, // willLoadDataRequest
</span><span class="cx">         0, // willDestroyFrame
</span><ins>+        0, // userAgentForURL
</ins><span class="cx">     };
</span><span class="cx">     WKBundlePageSetPageLoaderClient(m_page, &amp;loaderClient.base);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>