<!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>[176011] 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/176011">176011</a></dd>
<dt>Author</dt> <dd>philn@webkit.org</dd>
<dt>Date</dt> <dd>2014-11-12 00:25:05 -0800 (Wed, 12 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Patch</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaClienth">trunk/Source/WebCore/Modules/mediastream/UserMediaClient.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaControllerh">trunk/Source/WebCore/Modules/mediastream/UserMediaController.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp">trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaRequesth">trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmockUserMediaClientMockh">trunk/Source/WebCore/platform/mock/UserMediaClientMock.h</a></li>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcWKBaseh">trunk/Source/WebKit2/Shared/API/c/WKBase.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIObjecth">trunk/Source/WebKit2/Shared/APIObject.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIUIClienth">trunk/Source/WebKit2/UIProcess/API/APIUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKAPICasth">trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagecpp">trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPageUIClienth">trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWebKit2_Ch">trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</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="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPICMakeListstxt">trunk/Tools/TestWebKitAPI/CMakeLists.txt</a></li>
<li><a href="#trunkToolsTestWebKitAPIPlatformGTKcmake">trunk/Tools/TestWebKitAPI/PlatformGTK.cmake</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundleh">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllerh">trunk/Tools/WebKitTestRunner/TestController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastmediastreamdelayedpermissionallowedexpectedtxt">trunk/LayoutTests/fast/mediastream/delayed-permission-allowed-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamdelayedpermissionallowedhtml">trunk/LayoutTests/fast/mediastream/delayed-permission-allowed.html</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamdelayedpermissiondeniedexpectedtxt">trunk/LayoutTests/fast/mediastream/delayed-permission-denied-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamdelayedpermissiondeniedhtml">trunk/LayoutTests/fast/mediastream/delayed-permission-denied.html</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamerrorexpectedtxt">trunk/LayoutTests/fast/mediastream/error-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamerrorhtml">trunk/LayoutTests/fast/mediastream/error.html</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamsuccessexpectedtxt">trunk/LayoutTests/fast/mediastream/success-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamsuccesshtml">trunk/LayoutTests/fast/mediastream/success.html</a></li>
<li>trunk/LayoutTests/http/tests/media/media-stream/</li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamdisconnectedframealreadyexpectedtxt">trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamdisconnectedframealreadyhtml">trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamdisconnectedframeexpectedtxt">trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamdisconnectedframepermissiondeniedexpectedtxt">trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamdisconnectedframepermissiondeniedhtml">trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamdisconnectedframehtml">trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame.html</a></li>
<li>trunk/LayoutTests/http/tests/media/media-stream/resources/</li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamresourcesdisconnectedframealreadyinner1html">trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner1.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamresourcesdisconnectedframealreadyinner2html">trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner2.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmediamediastreamresourcesdisconnectedframeinnerhtml">trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-inner.html</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKUserMediaPermissionRequestcpp">trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKUserMediaPermissionRequesth">trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserMediaPermissionRequestManagerProxycpp">trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserMediaPermissionRequestManagerProxyh">trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserMediaPermissionRequestProxycpp">trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserMediaPermissionRequestProxyh">trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.h</a></li>
<li>trunk/Source/WebKit2/WebProcess/MediaStream/</li>
<li><a href="#trunkSourceWebKit2WebProcessMediaStreamUserMediaPermissionRequestManagercpp">trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessMediaStreamUserMediaPermissionRequestManagerh">trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebUserMediaClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebUserMediaClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2UserMediacpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/UserMedia.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2getUserMediahtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/getUserMedia.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/LayoutTests/ChangeLog        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-09-01  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [WK2] UserMediaClient support
+        https://bugs.webkit.org/show_bug.cgi?id=123158
+
+        Reviewed by Benjamin Poulain.
+
+        Simple UserMedia permission request tests inspired from the
+        Geolocation test suite.
+
+        * fast/mediastream/error-expected.txt: Added.
+        * fast/mediastream/error.html: Added.
+        * fast/mediastream/script-tests/error.js: Added.
+        * fast/mediastream/script-tests/success.js: Added.
+        * fast/mediastream/success-expected.txt: Added.
+        * fast/mediastream/success.html: Added.
+        * fast/mediastream/delayed-permission-allowed-expected.txt: Added.
+        * fast/mediastream/delayed-permission-allowed.html: Added.
+        * fast/mediastream/delayed-permission-denied-expected.txt: Added.
+        * fast/mediastream/delayed-permission-denied.html: Added.
+        * http/tests/media/media-stream/disconnected-frame-already-expected.txt: Added.
+        * http/tests/media/media-stream/disconnected-frame-already.html: Added.
+        * http/tests/media/media-stream/disconnected-frame-expected.txt: Added.
+        * http/tests/media/media-stream/disconnected-frame-permission-denied-expected.txt: Added.
+        * http/tests/media/media-stream/disconnected-frame-permission-denied.html: Added.
+        * http/tests/media/media-stream/disconnected-frame.html: Added.
+        * http/tests/media/media-stream/resources/disconnected-frame-already-inner1.html: Added.
+        * http/tests/media/media-stream/resources/disconnected-frame-already-inner2.html: Added.
+        * http/tests/media/media-stream/resources/disconnected-frame-inner.html: Added.
+        * platform/gtk/TestExpectations:
+
</ins><span class="cx"> 2014-11-11  Jinwoo Song  &lt;jinwoo7.song@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Unreviewed EFL gardening. Rebaseline after r174535.
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamdelayedpermissionallowedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/delayed-permission-allowed-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/delayed-permission-allowed-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/delayed-permission-allowed-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Tests that no callbacks are invoked until permission is allowed.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Success callback invoked
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamdelayedpermissionallowedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/delayed-permission-allowed.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/delayed-permission-allowed.html                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/delayed-permission-allowed.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests that no callbacks are invoked until permission is allowed.&quot;);
+window.jsTestIsAsync = true;
+
+function allowPermission() {
+    permissionSet = true;
+    if (window.testRunner)
+        testRunner.setUserMediaPermission(true);
+}
+
+var options = {audio: true, video: true};
+navigator.webkitGetUserMedia(options, function(stream) {
+   if (permissionSet) {
+        testPassed('Success callback invoked');
+        finishJSTest();
+        return;
+    }
+    testFailed('Success callback invoked unexpectedly');
+}, function(e) {
+    testFailed('Error callback invoked unexpectedly');
+    finishJSTest();
+});
+
+window.setTimeout(allowPermission, 100);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamdelayedpermissiondeniedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/delayed-permission-denied-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/delayed-permission-denied-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/delayed-permission-denied-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Tests that no callbacks are invoked until permission is denied.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamdelayedpermissiondeniedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/delayed-permission-denied.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/delayed-permission-denied.html                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/delayed-permission-denied.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests that no callbacks are invoked until permission is denied.&quot;);
+window.jsTestIsAsync = true;
+
+function denyPermission() {
+    permissionSet = true;
+    if (window.testRunner)
+        testRunner.setUserMediaPermission(false);
+}
+
+var error;
+var options = {audio: true, video: true};
+navigator.webkitGetUserMedia(options, function(stream) {
+    testFailed('Success callback invoked unexpectedly');
+    finishJSTest();
+}, function(e) {
+    if (permissionSet) {
+        error = e;
+        shouldBe('error.code', 'error.PERMISSION_DENIED');
+        finishJSTest();
+        return;
+    }
+    testFailed('Error callback invoked unexpectedly');
+    finishJSTest();
+});
+
+window.setTimeout(denyPermission, 100);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamerrorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/error-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/error-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/error-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Tests UserMedia error callback using the mock service.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamerrorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/error.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/error.html                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/error.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests UserMedia error callback using the mock service.&quot;);
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.setUserMediaPermission(false);
+else
+    debug('This test can not be run without the testRunner');
+
+var error;
+var options = {audio:false, video:true};
+navigator.webkitGetUserMedia(options, function(stream) {
+    testFailed('Success callback invoked unexpectedly');
+    finishJSTest();
+}, function(e) {
+    error = e;
+    shouldBe('error.code', 'error.PERMISSION_DENIED');
+    finishJSTest();
+});
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamsuccessexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/success-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/success-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/success-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+Tests UserMedia success callback using the mock service.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamsuccesshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/success.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/success.html                                (rev 0)
+++ trunk/LayoutTests/fast/mediastream/success.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests UserMedia success callback using the mock service.&quot;);
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.setUserMediaPermission(true);
+else
+    debug('This test can not be run without the testRunner');
+
+var options = {audio: true, video: true};
+navigator.webkitGetUserMedia(options, function(stream) {
+    finishJSTest();
+}, function(e) {
+    testFailed('Error callback invoked unexpectedly');
+    finishJSTest();
+});
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamdisconnectedframealreadyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+CONSOLE MESSAGE: line 24: NotSupportedError: DOM Exception 9: The implementation did not support the requested type of object or operation.
+Tests that when a getUserMedia request is made after its frame has been disconnected, no callbacks are made and no crash occurs.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+webkitGetUserMedia called on object with disconnected Frame.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamdisconnectedframealreadyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests that when a getUserMedia request is made after its frame has been disconnected, no callbacks are made and no crash occurs.&quot;);
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.setUserMediaPermission(true);
+
+function onFirstIframeLoaded() {
+    iframeNavigator = iframe.contentWindow.navigator;
+    iframe.src = 'resources/disconnected-frame-already-inner2.html';
+}
+
+var error;
+var options = {audio: true, video: true};
+function onSecondIframeLoaded() {
+    setTimeout(finishTest, 100);
+
+    iframeNavigator.webkitGetUserMedia(options, function(stream) {
+        testFailed('Success callback invoked unexpectedly');
+        finishJSTest();
+    }, function(e) {
+        testFailed('Error callback invoked unexpectedly');
+        finishJSTest();
+    });
+}
+
+function finishTest() {
+    debug('webkitGetUserMedia called on object with disconnected Frame.');
+    finishJSTest();
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-already-inner1.html';
+document.body.appendChild(iframe);
+&lt;/script&gt;
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamdisconnectedframeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - has 1 onunload handler(s)
+Tests that when a request is made on a UserMedia object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS No callbacks invoked
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamdisconnectedframepermissiondeniedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied-expected.txt (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied-expected.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - has 1 onunload handler(s)
+Tests that when a getUserMedia request is made, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS error.code is error.PERMISSION_DENIED
+
+PASS No callbacks invoked
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamdisconnectedframepermissiondeniedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-permission-denied.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests that when a getUserMedia request is made, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.&quot;);
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.setUserMediaPermission(false);
+else
+    debug('This test can not be run without the testRunner');
+
+var error;
+var options = {audio: true, video: true};
+function onIframeLoaded() {
+    iframeNavigator = iframe.contentWindow.navigator;
+    iframeNavigator.webkitGetUserMedia(options, function(stream) {
+        testFailed('Success callback invoked unexpectedly');
+        finishJSTest();
+    }, function(e) {
+        error = e;
+        shouldBe('error.code', 'error.PERMISSION_DENIED');
+        debug('');
+        iframe.src = 'data:text/html,This frame should be visible when the test completes';
+    });
+}
+
+function onIframeUnloaded() {
+    // Make another request, with permission already denied.
+    iframeNavigator.webkitGetUserMedia(options, function(stream) {
+        testFailed('Success callback invoked unexpectedly');
+        finishJSTest();
+    }, function(e) {
+        testFailed('Error callback invoked unexpectedly');
+        finishJSTest();
+    });
+    setTimeout(function() {
+        testPassed('No callbacks invoked');
+        finishJSTest();
+    }, 100);
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-inner.html';
+document.body.appendChild(iframe);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamdisconnectedframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description(&quot;Tests that when a request is made on a UserMedia object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.&quot;);
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.setUserMediaPermission(true);
+
+function onIframeLoaded() {
+    iframeNavigator = iframe.contentWindow.navigator;
+    iframe.src = 'data:text/html,This frame should be visible when the test completes';
+}
+
+function onIframeUnloaded() {
+    var options = {audio: true, video: true};
+    iframeNavigator.webkitGetUserMedia(options, function (stream) {
+        testFailed('Success callback invoked unexpectedly');
+        finishJSTest();
+    }, function(e) {
+        testFailed('Error callback invoked unexpectedly');
+        finishJSTest();
+    });
+
+    setTimeout(function() {
+        testPassed('No callbacks invoked');
+        finishJSTest();
+    }, 100);
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-inner.html';
+document.body.appendChild(iframe);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamresourcesdisconnectedframealreadyinner1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner1.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner1.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner1.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+  &lt;/head&gt;
+  &lt;body onload=&quot;window.parent.onFirstIframeLoaded()&quot;&gt;
+    &lt;p&gt;This frame should be replaced before the test ends&lt;/p&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamresourcesdisconnectedframealreadyinner2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner2.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner2.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-already-inner2.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+  &lt;/head&gt;
+  &lt;body onload=&quot;window.parent.onSecondIframeLoaded()&quot;&gt;
+    &lt;p&gt;This frame should be visible when the test completes&lt;/p&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediamediastreamresourcesdisconnectedframeinnerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-inner.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-inner.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/resources/disconnected-frame-inner.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+  &lt;/head&gt;
+  &lt;body onload=&quot;window.parent.onIframeLoaded()&quot; onunload=&quot;window.parent.onIframeUnloaded();&quot;&gt;
+    &lt;p&gt;This frame should be replaced before the test ends&lt;/p&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -291,7 +291,43 @@
</span><span class="cx"> webkit.org/b/85212 ietestcenter/css3/flexbox/flexbox-layout-002.htm [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><span class="cx"> # Mediastream implementation is not complete yet.
</span><del>-webkit.org/b/79203 fast/mediastream [ Skip ]
</del><ins>+webkit.org/b/79203 fast/mediastream/argument-types.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/getusermedia.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-add-ended-tracks.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-add-remove-tracks.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-add-tracks-to-inactive-stream.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-clone.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStreamConstructor.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-construct-with-ended-tracks.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-getTracks.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStream-MediaElement-srcObject.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStreamTrackEvent-constructor.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStreamTrack-getSources.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStreamTrack.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/MediaStreamTrack-onended.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/no-interface-object.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCIceCandidate.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-AddRemoveStream.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-createAnswer.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-createOffer.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-datachannel.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-dtmf.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-events.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-getConfiguration.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-local-offer.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-local-pranswer.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-remote-offer.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-remote-pranswer.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-ice.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-localDescription.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-onnegotiationneeded.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-remoteDescription.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-stable.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-state.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-stats.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCPeerConnection-statsSelector.html [ Skip ]
+webkit.org/b/79203 fast/mediastream/RTCSessionDescription.html [ Skip ]
</ins><span class="cx"> webkit.org/b/79203 fast/events/constructors/media-stream-event-constructor.html [ Skip ]
</span><span class="cx"> webkit.org/b/79203 webaudio/mediastreamaudiodestinationnode.html [ Skip ]
</span><span class="cx"> webkit.org/b/79203 webaudio/mediastreamaudiosourcenode.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -157,6 +157,7 @@
</span><span class="cx"> # Media Stream API is not yet enabled.
</span><span class="cx"> fast/mediastream
</span><span class="cx"> fast/events/constructors/media-stream-event-constructor.html
</span><ins>+http/tests/media/media-stream
</ins><span class="cx"> 
</span><span class="cx"> # Asserts in debug.
</span><span class="cx"> [ Debug ] fast/images/large-size-image-crash.html [ Skip ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebCore/ChangeLog        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-09-01  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [WK2] UserMediaClient support
+        https://bugs.webkit.org/show_bug.cgi?id=123158
+
+        Reviewed by Benjamin Poulain.
+
+        Added document and frame accessors, needed by the
+        UserMediaRequestManager of the WebProcess. Also added two methods
+        used by the permission request manager to know if access to audio
+        or video devices is requested.
+
+        Tests: fast/mediastream/error.html
+               fast/mediastream/success.html
+               fast/mediastream/delayed-permission-allowed.html
+               fast/mediastream/delayed-permission-denied.html
+               http/tests/media/media-stream/disconnected-frame-already.html
+               http/tests/media/media-stream/disconnected-frame-permission-denied.html
+               http/tests/media/media-stream/disconnected-frame.html
+
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::document):
+        (WebCore::UserMediaRequest::frame):
+        * Modules/mediastream/UserMediaRequest.h:
+        (WebCore::UserMediaRequest::requiresAudio):
+        (WebCore::UserMediaRequest::requiresVideo):
+
</ins><span class="cx"> 2014-11-12  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Clean up OwnPtr in RenderThemeEfl
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaClient.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaClient.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaClient.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -44,8 +44,8 @@
</span><span class="cx"> public:
</span><span class="cx">     virtual void pageDestroyed() = 0;
</span><span class="cx"> 
</span><del>-    virtual void requestPermission(PassRefPtr&lt;UserMediaRequest&gt;) = 0;
-    virtual void cancelRequest(UserMediaRequest*) = 0;
</del><ins>+    virtual void requestPermission(PassRef&lt;UserMediaRequest&gt;) = 0;
+    virtual void cancelRequest(UserMediaRequest&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual ~UserMediaClient() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaController.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaController.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaController.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -39,8 +39,8 @@
</span><span class="cx">     ~UserMediaController();
</span><span class="cx"> 
</span><span class="cx">     UserMediaClient* client() const { return m_client; }
</span><del>-    void requestPermission(PassRefPtr&lt;UserMediaRequest&gt;);
-    void cancelRequest(UserMediaRequest*);
</del><ins>+    void requestPermission(PassRef&lt;UserMediaRequest&gt;);
+    void cancelRequest(UserMediaRequest&amp;);
</ins><span class="cx"> 
</span><span class="cx">     static const char* supplementName();
</span><span class="cx">     static UserMediaController* from(Page* page) { return static_cast&lt;UserMediaController*&gt;(Supplement&lt;Page&gt;::from(page, supplementName())); }
</span><span class="lines">@@ -49,12 +49,12 @@
</span><span class="cx">     UserMediaClient* m_client;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline void UserMediaController::requestPermission(PassRefPtr&lt;UserMediaRequest&gt; request)
</del><ins>+inline void UserMediaController::requestPermission(PassRef&lt;UserMediaRequest&gt; request)
</ins><span class="cx"> {
</span><del>-    m_client-&gt;requestPermission(request);
</del><ins>+    m_client-&gt;requestPermission(WTF::move(request));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void UserMediaController::cancelRequest(UserMediaRequest* request)
</del><ins>+inline void UserMediaController::cancelRequest(UserMediaRequest&amp; request)
</ins><span class="cx"> {
</span><span class="cx">     m_client-&gt;cancelRequest(request);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><ins>+#include &quot;Frame.h&quot;
</ins><span class="cx"> #include &quot;MediaConstraintsImpl.h&quot;
</span><span class="cx"> #include &quot;MediaStream.h&quot;
</span><span class="cx"> #include &quot;MediaStreamCenter.h&quot;
</span><span class="lines">@@ -123,7 +124,7 @@
</span><span class="cx">     callOnMainThread([protectedThis] {
</span><span class="cx">         // 2 - The constraints are valid, ask the user for access to media.
</span><span class="cx">         if (UserMediaController* controller = protectedThis-&gt;m_controller)
</span><del>-            controller-&gt;requestPermission(protectedThis.get());
</del><ins>+            controller-&gt;requestPermission(*protectedThis.get());
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -201,7 +202,7 @@
</span><span class="cx">     Ref&lt;UserMediaRequest&gt; protect(*this);
</span><span class="cx"> 
</span><span class="cx">     if (m_controller) {
</span><del>-        m_controller-&gt;cancelRequest(this);
</del><ins>+        m_controller-&gt;cancelRequest(*this);
</ins><span class="cx">         m_controller = 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> 
</span><span class="cx"> class Dictionary;
</span><span class="cx"> class Document;
</span><ins>+class Frame;
</ins><span class="cx"> class MediaConstraints;
</span><span class="cx"> class MediaStreamPrivate;
</span><span class="cx"> class UserMediaController;
</span><span class="lines">@@ -66,6 +67,9 @@
</span><span class="cx">     WEBCORE_EXPORT void userMediaAccessGranted();
</span><span class="cx">     WEBCORE_EXPORT void userMediaAccessDenied();
</span><span class="cx"> 
</span><ins>+    bool requiresAudio() const { return m_audioConstraints; }
+    bool requiresVideo() const { return m_videoConstraints; }
+
</ins><span class="cx"> private:
</span><span class="cx">     UserMediaRequest(ScriptExecutionContext*, UserMediaController*, PassRefPtr&lt;MediaConstraints&gt; audioConstraints, PassRefPtr&lt;MediaConstraints&gt; videoConstraints, PassRefPtr&lt;NavigatorUserMediaSuccessCallback&gt;, PassRefPtr&lt;NavigatorUserMediaErrorCallback&gt;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockUserMediaClientMockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/UserMediaClientMock.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/UserMediaClientMock.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebCore/platform/mock/UserMediaClientMock.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> 
</span><span class="cx"> class UserMediaClientRequestNotifier : public MockNotifier {
</span><span class="cx"> public:
</span><del>-    UserMediaClientRequestNotifier(PassRefPtr&lt;UserMediaRequest&gt; request, bool requestSuccess)
-        : m_request(request)
</del><ins>+    UserMediaClientRequestNotifier(PassRef&lt;UserMediaRequest&gt; request, bool requestSuccess)
+        : m_request(WTF::move(request))
</ins><span class="cx">         , m_requestSuccess(requestSuccess)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    RefPtr&lt;UserMediaRequest&gt; m_request;
</del><ins>+    Ref&lt;UserMediaRequest&gt; m_request;
</ins><span class="cx">     bool m_requestSuccess;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -60,13 +60,13 @@
</span><span class="cx">     public:
</span><span class="cx">     virtual void pageDestroyed() override { }
</span><span class="cx"> 
</span><del>-    virtual void requestPermission(PassRefPtr&lt;UserMediaRequest&gt; request) override
</del><ins>+    virtual void requestPermission(PassRef&lt;UserMediaRequest&gt; request) override
</ins><span class="cx">     {
</span><del>-        RefPtr&lt;UserMediaClientRequestNotifier&gt; notifier = adoptRef(new UserMediaClientRequestNotifier(request, true));
</del><ins>+        RefPtr&lt;UserMediaClientRequestNotifier&gt; notifier = adoptRef(new UserMediaClientRequestNotifier(WTF::move(request), true));
</ins><span class="cx">         m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual void cancelRequest(UserMediaRequest* request) override
</del><ins>+    virtual void cancelRequest(UserMediaRequest&amp; request) override
</ins><span class="cx">     {
</span><span class="cx">         RefPtr&lt;UserMediaClientRequestNotifier&gt; notifier = adoptRef(new UserMediaClientRequestNotifier(request, false));
</span><span class="cx">         m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
</span></span></pre></div>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/CMakeLists.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/InjectedBundle/DOM&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Launching&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/MediaCache&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/WebProcess/MediaStream&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Network&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Notifications&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/OriginData&quot;
</span><span class="lines">@@ -300,6 +301,8 @@
</span><span class="cx">     UIProcess/ResponsivenessTimer.cpp
</span><span class="cx">     UIProcess/StatisticsRequest.cpp
</span><span class="cx">     UIProcess/TextCheckerCompletion.cpp
</span><ins>+    UIProcess/UserMediaPermissionRequestManagerProxy.cpp
+    UIProcess/UserMediaPermissionRequestProxy.cpp
</ins><span class="cx">     UIProcess/VisitedLinkProvider.cpp
</span><span class="cx">     UIProcess/WebApplicationCacheManagerProxy.cpp
</span><span class="cx">     UIProcess/WebBackForwardList.cpp
</span><span class="lines">@@ -388,6 +391,7 @@
</span><span class="cx">     UIProcess/API/C/WKResourceCacheManager.cpp
</span><span class="cx">     UIProcess/API/C/WKSessionStateRef.cpp
</span><span class="cx">     UIProcess/API/C/WKTextChecker.cpp
</span><ins>+    UIProcess/API/C/WKUserMediaPermissionRequest.cpp
</ins><span class="cx">     UIProcess/API/C/WKVibration.cpp
</span><span class="cx">     UIProcess/API/C/WKViewportAttributes.cpp
</span><span class="cx"> 
</span><span class="lines">@@ -484,6 +488,8 @@
</span><span class="cx"> 
</span><span class="cx">     WebProcess/MediaCache/WebMediaCacheManager.cpp
</span><span class="cx"> 
</span><ins>+    WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
+
</ins><span class="cx">     WebProcess/Network/NetworkProcessConnection.cpp
</span><span class="cx">     WebProcess/Network/WebResourceLoadScheduler.cpp
</span><span class="cx">     WebProcess/Network/WebResourceLoader.cpp
</span><span class="lines">@@ -535,6 +541,7 @@
</span><span class="cx">     WebProcess/WebCoreSupport/WebPopupMenu.cpp
</span><span class="cx">     WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
</span><span class="cx">     WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
</span><ins>+    WebProcess/WebCoreSupport/WebUserMediaClient.cpp
</ins><span class="cx">     WebProcess/WebCoreSupport/WebVibrationClient.cpp
</span><span class="cx"> 
</span><span class="cx">     WebProcess/WebPage/DrawingArea.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2014-09-01  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [WK2] UserMediaClient support
+        https://bugs.webkit.org/show_bug.cgi?id=123158
+
+        Reviewed by Benjamin Poulain.
+
+        Support for UserMediaPermissionRequest in WebKit2. It's
+        implemented similarily to the GeolocationPermissionRequest
+        support. When the WebPage requires this permission it sends a
+        message to the UI process which at some point grants or denies the
+        permission and sends the result back to the WebProcess.
+
+        * CMakeLists.txt: Generic CMake support for new files.
+        * Shared/API/c/WKBase.h: New type for UserMediaPermissionRequest.
+        * Shared/APIObject.h: Ditto.
+        * UIProcess/API/C/WKAPICast.h: PermissionRequest API mapping.
+        * UIProcess/API/APIUIClient.h: New decidePolicy handler for UserMediaPermissionRequest.
+        (API::UIClient::decidePolicyForUserMediaPermissionRequest):
+        * UIProcess/API/C/WKPage.cpp: Ditto.
+        (WKPageSetPageUIClient):
+        * UIProcess/API/C/WKPageUIClient.h: WKPageUIClient version bump to
+        5, including the new decidePolicyForUserMediaPermissionRequest member.
+        * UIProcess/API/C/WKUserMediaPermissionRequest.cpp: Added, C API
+        implementation of the UserMediaPermissionRequest.
+        (WKUserMediaPermissionRequestGetTypeID):
+        (WKUserMediaPermissionRequestAllow):
+        (WKUserMediaPermissionRequestDeny):
+        * UIProcess/API/C/WKUserMediaPermissionRequest.h: Added.
+        * UIProcess/API/C/WebKit2_C.h:
+        * UIProcess/UserMediaPermissionRequestManagerProxy.h: Added.
+        * UIProcess/UserMediaPermissionRequestProxy.cpp: Added, proxy
+        object for the UserMediaPermissionRequestType.
+        (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
+        (WebKit::UserMediaPermissionRequestProxy::allow):
+        (WebKit::UserMediaPermissionRequestProxy::deny):
+        (WebKit::UserMediaPermissionRequestProxy::invalidate):
+        * UIProcess/UserMediaPermissionRequestProxy.h: Added.
+        (WebKit::UserMediaPermissionRequestProxy::create):
+        (WebKit::UserMediaPermissionRequestProxy::mediaParameters):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Defer
+        UserPermissionRequest to the UIClient.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in: New message to handle UserMediaPermissionRequests.
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: Added,
+        WebProcess side of the UserRequestManager, keeping track of each
+        permission request.
+        (WebKit::generateRequestID):
+        (WebKit::UserMediaPermissionRequestManager::UserMediaPermissionRequestManager):
+        (WebKit::UserMediaPermissionRequestManager::startRequest):
+        (WebKit::UserMediaPermissionRequestManager::cancelRequest):
+        (WebKit::UserMediaPermissionRequestManager::didReceiveUserMediaPermissionDecision):
+        * WebProcess/MediaStream/UserMediaPermissionRequestManager.h: Added.
+        * WebProcess/WebCoreSupport/WebUserMediaClient.cpp: Added,
+        WebProcess implementation of the WebCore::UserMediaClient.
+        (WebKit::WebUserMediaClient::WebUserMediaClient):
+        (WebKit::WebUserMediaClient::pageDestroyed):
+        (WebKit::WebUserMediaClient::requestPermission):
+        (WebKit::WebUserMediaClient::cancelRequest):
+        * WebProcess/WebCoreSupport/WebUserMediaClient.h: Added.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Create the
+        UserMediaPermissionRequestManager and register the UserMediaClient
+        to the page.
+        (WebKit::WebPage::didReceiveUserMediaPermissionDecision): Dispatch
+        decision to manager.
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::userMediaPermissionRequestManager):
+        * WebProcess/WebPage/WebPage.messages.in: New Message to handle
+        permission decision result from the UI process.
+
</ins><span class="cx"> 2014-11-11  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for mailto: link action menus
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcWKBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/WKBase.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/WKBase.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/Shared/API/c/WKBase.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx"> typedef const struct OpaqueWKTextChecker* WKTextCheckerRef;
</span><span class="cx"> typedef const struct OpaqueWKSession* WKSessionRef;
</span><span class="cx"> typedef const struct OpaqueWKSessionState* WKSessionStateRef;
</span><ins>+typedef const struct OpaqueWKUserMediaPermissionRequest* WKUserMediaPermissionRequestRef;
</ins><span class="cx"> typedef const struct OpaqueWKVibration* WKVibrationRef;
</span><span class="cx"> typedef const struct OpaqueWKViewportAttributes* WKViewportAttributesRef;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIObject.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/APIObject.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/Shared/APIObject.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -132,6 +132,7 @@
</span><span class="cx">         Preferences,
</span><span class="cx">         Session,
</span><span class="cx">         TextChecker,
</span><ins>+        UserMediaPermissionRequest,
</ins><span class="cx">         Vibration,
</span><span class="cx">         ViewportAttributes,
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> class NativeWebKeyboardEvent;
</span><span class="cx"> class NativeWebWheelEvent;
</span><span class="cx"> class NotificationPermissionRequest;
</span><ins>+class UserMediaPermissionRequestProxy;
</ins><span class="cx"> class WebColorPickerResultListenerProxy;
</span><span class="cx"> class WebFrameProxy;
</span><span class="cx"> class WebOpenPanelParameters;
</span><span class="lines">@@ -122,6 +123,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebOpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }
</span><span class="cx">     virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebSecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; }
</span><ins>+    virtual bool decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&amp;, WebKit::WebFrameProxy&amp;, WebKit::WebSecurityOrigin&amp;, WebKit::UserMediaPermissionRequestProxy&amp;) { return false; }
</ins><span class="cx">     virtual bool decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebSecurityOrigin*, WebKit::NotificationPermissionRequest*) { return false; }
</span><span class="cx"> 
</span><span class="cx">     // Printing.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> class DownloadProxy;
</span><span class="cx"> class GeolocationPermissionRequestProxy;
</span><span class="cx"> class NotificationPermissionRequest;
</span><ins>+class UserMediaPermissionRequestProxy;
</ins><span class="cx"> class WebApplicationCacheManagerProxy;
</span><span class="cx"> class WebBackForwardList;
</span><span class="cx"> class WebBackForwardListItem;
</span><span class="lines">@@ -146,6 +147,7 @@
</span><span class="cx"> WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject)
</span><span class="cx"> WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState)
</span><span class="cx"> WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
</span><ins>+WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
</ins><span class="cx"> WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
</span><span class="cx"> WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
</span><span class="cx"> WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;&gt; struct ClientTraits&lt;WKPageUIClientBase&gt; {
</span><del>-    typedef std::tuple&lt;WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4&gt; Versions;
</del><ins>+    typedef std::tuple&lt;WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5&gt; Versions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="lines">@@ -1499,6 +1499,15 @@
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        virtual bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&amp; page, WebFrameProxy&amp; frame, WebSecurityOrigin&amp; origin, UserMediaPermissionRequestProxy&amp; permissionRequest) override
+        {
+            if (!m_client.decidePolicyForUserMediaPermissionRequest)
+                return false;
+
+            m_client.decidePolicyForUserMediaPermissionRequest(toAPI(&amp;page), toAPI(&amp;frame), toAPI(&amp;origin), toAPI(&amp;permissionRequest), m_client.base.clientInfo);
+            return true;
+        }
+
</ins><span class="cx">         virtual bool decidePolicyForNotificationPermissionRequest(WebPageProxy* page, WebSecurityOrigin* origin, NotificationPermissionRequest* permissionRequest) override
</span><span class="cx">         {
</span><span class="cx">             if (!m_client.decidePolicyForNotificationPermissionRequest)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPageUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx"> typedef void (*WKPageDidRecognizeLongMousePressCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
</span><span class="cx"> typedef void (*WKPageDidCancelTrackingPotentialLongMousePressCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
</span><span class="cx"> typedef void (*WKPageIsPlayingAudioDidChangeCallback)(WKPageRef page, const void* clientInfo);
</span><ins>+typedef void (*WKPageDecidePolicyForUserMediaPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKUserMediaPermissionRequestRef permissionRequest, const void* clientInfo);
</ins><span class="cx"> 
</span><span class="cx"> // Deprecated    
</span><span class="cx"> typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
</span><span class="lines">@@ -378,6 +379,74 @@
</span><span class="cx">     WKPageIsPlayingAudioDidChangeCallback                               isPlayingAudioDidChange;
</span><span class="cx"> } WKPageUIClientV4;
</span><span class="cx"> 
</span><ins>+typedef struct WKPageUIClientV5 {
+    WKPageUIClientBase                                                  base;
+
+    // Version 0.
+    WKPageCreateNewPageCallback_deprecatedForUseWithV0                  createNewPage_deprecatedForUseWithV0;
+    WKPageUIClientCallback                                              showPage;
+    WKPageUIClientCallback                                              close;
+    WKPageTakeFocusCallback                                             takeFocus;
+    WKPageFocusCallback                                                 focus;
+    WKPageUnfocusCallback                                               unfocus;
+    WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
+    WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
+    WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
+    WKPageSetStatusTextCallback                                         setStatusText;
+    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
+    WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0     missingPluginButtonClicked_deprecatedForUseWithV0;
+    WKPageDidNotHandleKeyEventCallback                                  didNotHandleKeyEvent;
+    WKPageDidNotHandleWheelEventCallback                                didNotHandleWheelEvent;
+    WKPageGetToolbarsAreVisibleCallback                                 toolbarsAreVisible;
+    WKPageSetToolbarsAreVisibleCallback                                 setToolbarsAreVisible;
+    WKPageGetMenuBarIsVisibleCallback                                   menuBarIsVisible;
+    WKPageSetMenuBarIsVisibleCallback                                   setMenuBarIsVisible;
+    WKPageGetStatusBarIsVisibleCallback                                 statusBarIsVisible;
+    WKPageSetStatusBarIsVisibleCallback                                 setStatusBarIsVisible;
+    WKPageGetIsResizableCallback                                        isResizable;
+    WKPageSetIsResizableCallback                                        setIsResizable;
+    WKPageGetWindowFrameCallback                                        getWindowFrame;
+    WKPageSetWindowFrameCallback                                        setWindowFrame;
+    WKPageRunBeforeUnloadConfirmPanelCallback                           runBeforeUnloadConfirmPanel;
+    WKPageUIClientCallback                                              didDraw;
+    WKPageUIClientCallback                                              pageDidScroll;
+    WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
+    WKPageRunOpenPanelCallback                                          runOpenPanel;
+    WKPageDecidePolicyForGeolocationPermissionRequestCallback           decidePolicyForGeolocationPermissionRequest;
+    WKPageHeaderHeightCallback                                          headerHeight;
+    WKPageFooterHeightCallback                                          footerHeight;
+    WKPageDrawHeaderCallback                                            drawHeader;
+    WKPageDrawFooterCallback                                            drawFooter;
+    WKPagePrintFrameCallback                                            printFrame;
+    WKPageUIClientCallback                                              runModal;
+    void*                                                               unused1; // Used to be didCompleteRubberBandForMainFrame
+    WKPageSaveDataToFileInDownloadsFolderCallback                       saveDataToFileInDownloadsFolder;
+    WKPageShouldInterruptJavaScriptCallback                             shouldInterruptJavaScript;
+
+    // Version 1.
+    WKPageCreateNewPageCallback                                         createNewPage;
+    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
+    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
+    WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1;
+
+    // Version 2.
+    WKPageShowColorPickerCallback                                       showColorPicker;
+    WKPageHideColorPickerCallback                                       hideColorPicker;
+    WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
+    
+    // Version 3.
+    WKPagePinnedStateDidChangeCallback                                  pinnedStateDidChange;
+
+    // Version 4.
+    WKPageDidBeginTrackingPotentialLongMousePressCallback               didBeginTrackingPotentialLongMousePress;
+    WKPageDidRecognizeLongMousePressCallback                            didRecognizeLongMousePress;
+    WKPageDidCancelTrackingPotentialLongMousePressCallback              didCancelTrackingPotentialLongMousePress;
+    WKPageIsPlayingAudioDidChangeCallback                               isPlayingAudioDidChange;
+
+    // Version 5.
+    WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
+} WKPageUIClientV5;
+
</ins><span class="cx"> enum { kWKPageUIClientCurrentVersion WK_ENUM_DEPRECATED(&quot;Use an explicit version number instead&quot;) = 2 };
</span><span class="cx"> typedef struct WKPageUIClient {
</span><span class="cx">     int                                                                 version;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKUserMediaPermissionRequestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WKUserMediaPermissionRequest.h&quot;
+
+#include &quot;UserMediaPermissionRequestProxy.h&quot;
+#include &quot;WKAPICast.h&quot;
+
+using namespace WebKit;
+
+WKTypeID WKUserMediaPermissionRequestGetTypeID()
+{
+    return toAPI(UserMediaPermissionRequestProxy::APIType);
+}
+
+void WKUserMediaPermissionRequestAllow(WKUserMediaPermissionRequestRef userMediaPermissionRequestRef)
+{
+    toImpl(userMediaPermissionRequestRef)-&gt;allow();
+}
+
+void WKUserMediaPermissionRequestDeny(WKUserMediaPermissionRequestRef userMediaPermissionRequestRef)
+{
+    toImpl(userMediaPermissionRequestRef)-&gt;deny();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKUserMediaPermissionRequesth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef WKUserMediaPermissionRequest_h
+#define WKUserMediaPermissionRequest_h
+
+#include &lt;WebKit/WKBase.h&gt;
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+WK_EXPORT WKTypeID WKUserMediaPermissionRequestGetTypeID();
+
+WK_EXPORT void WKUserMediaPermissionRequestAllow(WKUserMediaPermissionRequestRef);
+WK_EXPORT void WKUserMediaPermissionRequestDeny(WKUserMediaPermissionRequestRef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKUserMediaPermissionRequest_h */
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWebKit2_Ch"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> #include &lt;WebKit/WKURL.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKURLRequest.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKURLResponse.h&gt;
</span><ins>+#include &lt;WebKit/WKUserMediaPermissionRequest.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if defined(__OBJC__) &amp;&amp; __OBJC__
</span><span class="cx"> #import &lt;WebKit/WKView.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserMediaPermissionRequestManagerProxycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+#include &quot;UserMediaPermissionRequestManagerProxy.h&quot;
+
+#include &quot;WebPageMessages.h&quot;
+#include &quot;WebPageProxy.h&quot;
+#include &quot;WebProcessProxy.h&quot;
+
+namespace WebKit {
+
+UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy(WebPageProxy&amp; page)
+    : m_page(page)
+{
+}
+
+void UserMediaPermissionRequestManagerProxy::invalidateRequests()
+{
+    for (auto&amp; request : m_pendingRequests.values())
+        request-&gt;invalidate();
+
+    m_pendingRequests.clear();
+}
+
+PassRefPtr&lt;UserMediaPermissionRequestProxy&gt; UserMediaPermissionRequestManagerProxy::createRequest(uint64_t userMediaID, bool audio, bool video)
+{
+    RefPtr&lt;UserMediaPermissionRequestProxy&gt; request = UserMediaPermissionRequestProxy::create(*this, userMediaID, audio, video);
+    m_pendingRequests.add(userMediaID, request.get());
+    return request.release();
+}
+
+void UserMediaPermissionRequestManagerProxy::didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed)
+{
+    if (!m_page.isValid())
+        return;
+
+    if (!m_pendingRequests.take(userMediaID))
+        return;
+
+#if ENABLE(MEDIA_STREAM)
+    m_page.process().send(Messages::WebPage::DidReceiveUserMediaPermissionDecision(userMediaID, allowed), m_page.pageID());
+#else
+    UNUSED_PARAM(allowed);
+#endif
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserMediaPermissionRequestManagerProxyh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.h (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef UserMediaPermissionRequestManagerProxy_h
+#define UserMediaPermissionRequestManagerProxy_h
+
+#include &quot;UserMediaPermissionRequestProxy.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class UserMediaPermissionRequestManagerProxy {
+public:
+    explicit UserMediaPermissionRequestManagerProxy(WebPageProxy&amp;);
+
+    void invalidateRequests();
+
+    // Create a request to be presented to the user.
+    PassRefPtr&lt;UserMediaPermissionRequestProxy&gt; createRequest(uint64_t userMediaID, bool audio, bool video);
+
+    // Called by UserMediaPermissionRequestProxy when a decision is made by the user.
+    void didReceiveUserMediaPermissionDecision(uint64_t, bool allow);
+
+private:
+    HashMap&lt;uint64_t, RefPtr&lt;UserMediaPermissionRequestProxy&gt;&gt; m_pendingRequests;
+    WebPageProxy&amp; m_page;
+};
+
+} // namespace WebKit
+
+#endif // UserMediaPermissionRequestManagerProxy_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserMediaPermissionRequestProxycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.cpp (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+#include &quot;UserMediaPermissionRequestProxy.h&quot;
+
+#include &quot;APINumber.h&quot;
+#include &quot;UserMediaPermissionRequestManagerProxy.h&quot;
+#include &lt;wtf/text/StringHash.h&gt;
+
+namespace WebKit {
+
+UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy(UserMediaPermissionRequestManagerProxy&amp; manager, uint64_t userMediaID, bool audio, bool video)
+    : m_manager(manager)
+    , m_userMediaID(userMediaID)
+{
+    HashMap&lt;String, RefPtr&lt;API::Object&gt;&gt; parametersMap;
+    parametersMap.add(ASCIILiteral(&quot;audio&quot;), API::Boolean::create(audio));
+    parametersMap.add(ASCIILiteral(&quot;video&quot;), API::Boolean::create(video));
+    m_mediaParameters = ImmutableDictionary::create(WTF::move(parametersMap));
+}
+
+void UserMediaPermissionRequestProxy::allow()
+{
+    m_manager.didReceiveUserMediaPermissionDecision(m_userMediaID, true);
+}
+
+void UserMediaPermissionRequestProxy::deny()
+{
+    m_manager.didReceiveUserMediaPermissionDecision(m_userMediaID, false);
+}
+
+void UserMediaPermissionRequestProxy::invalidate()
+{
+    m_manager.invalidateRequests();
+}
+
+} // namespace WebKit
+
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserMediaPermissionRequestProxyh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.h (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef UserMediaPermissionRequestProxy_h
+#define UserMediaPermissionRequestProxy_h
+
+#include &quot;APIObject.h&quot;
+#include &quot;ImmutableDictionary.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+
+namespace WebKit {
+
+class UserMediaPermissionRequestManagerProxy;
+
+class UserMediaPermissionRequestProxy : public API::ObjectImpl&lt;API::Object::Type::UserMediaPermissionRequest&gt; {
+public:
+    static PassRefPtr&lt;UserMediaPermissionRequestProxy&gt; create(UserMediaPermissionRequestManagerProxy&amp; manager, uint64_t userMediaID, bool audio, bool video)
+    {
+        return adoptRef(new UserMediaPermissionRequestProxy(manager, userMediaID, audio, video));
+    }
+
+    void allow();
+    void deny();
+
+    void invalidate();
+
+    PassRefPtr&lt;ImmutableDictionary&gt; mediaParameters() const { return m_mediaParameters; }
+
+private:
+    UserMediaPermissionRequestProxy(UserMediaPermissionRequestManagerProxy&amp;, uint64_t userMediaID, bool audio, bool video);
+
+    UserMediaPermissionRequestManagerProxy&amp; m_manager;
+    uint64_t m_userMediaID;
+    RefPtr&lt;ImmutableDictionary&gt; m_mediaParameters;
+};
+
+} // namespace WebKit
+
+#endif // UserMediaPermissionRequestProxy_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> #include &quot;TextChecker.h&quot;
</span><span class="cx"> #include &quot;TextCheckerState.h&quot;
</span><span class="cx"> #include &quot;TextIndicator.h&quot;
</span><ins>+#include &quot;UserMediaPermissionRequestProxy.h&quot;
</ins><span class="cx"> #include &quot;WKContextPrivate.h&quot;
</span><span class="cx"> #include &quot;WebBackForwardList.h&quot;
</span><span class="cx"> #include &quot;WebBackForwardListItem.h&quot;
</span><span class="lines">@@ -279,6 +280,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     , m_geolocationPermissionRequestManager(*this)
</span><span class="cx">     , m_notificationPermissionRequestManager(*this)
</span><ins>+    , m_userMediaPermissionRequestManager(*this)
</ins><span class="cx">     , m_viewState(ViewState::NoFlags)
</span><span class="cx">     , m_viewWasEverInWindow(false)
</span><span class="cx">     , m_backForwardList(WebBackForwardList::create(*this))
</span><span class="lines">@@ -4716,6 +4718,18 @@
</span><span class="cx">     request-&gt;deny();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video)
+{
+    WebFrameProxy* frame = m_process-&gt;webFrame(frameID);
+    MESSAGE_CHECK(frame);
+
+    RefPtr&lt;WebSecurityOrigin&gt; origin = WebSecurityOrigin::create(SecurityOrigin::createFromDatabaseIdentifier(originIdentifier));
+    RefPtr&lt;UserMediaPermissionRequestProxy&gt; request = m_userMediaPermissionRequestManager.createRequest(userMediaID, audio, video);
+
+    if (!m_uiClient-&gt;decidePolicyForUserMediaPermissionRequest(*this, *frame, *origin.get(), *request.get()))
+        request-&gt;deny();
+}
+
</ins><span class="cx"> void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String&amp; originString)
</span><span class="cx"> {
</span><span class="cx">     if (!isRequestIDValid(requestID))
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include &quot;PlatformProcessIdentifier.h&quot;
</span><span class="cx"> #include &quot;SandboxExtension.h&quot;
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><ins>+#include &quot;UserMediaPermissionRequestManagerProxy.h&quot;
</ins><span class="cx"> #include &quot;VisibleContentRectUpdateInfo.h&quot;
</span><span class="cx"> #include &quot;WKBase.h&quot;
</span><span class="cx"> #include &quot;WKPagePrivate.h&quot;
</span><span class="lines">@@ -124,6 +125,7 @@
</span><span class="cx"> class FloatRect;
</span><span class="cx"> class GraphicsLayer;
</span><span class="cx"> class IntSize;
</span><ins>+class MediaConstraintsImpl;
</ins><span class="cx"> class ProtectionSpace;
</span><span class="cx"> class RunLoopObserver;
</span><span class="cx"> class SharedBuffer;
</span><span class="lines">@@ -1060,6 +1062,9 @@
</span><span class="cx">     void exceededDatabaseQuota(uint64_t frameID, const String&amp; originIdentifier, const String&amp; databaseName, const String&amp; displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, PassRefPtr&lt;Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&gt;);
</span><span class="cx">     void reachedApplicationCacheOriginQuota(const String&amp; originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr&lt;Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply&gt;);
</span><span class="cx">     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
</span><ins>+
+    void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video);
+
</ins><span class="cx">     void runModal();
</span><span class="cx">     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&amp;);
</span><span class="cx">     void recommendedScrollbarStyleDidChange(int32_t newStyle);
</span><span class="lines">@@ -1396,6 +1401,8 @@
</span><span class="cx">     GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
</span><span class="cx">     NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
</span><span class="cx"> 
</span><ins>+    UserMediaPermissionRequestManagerProxy m_userMediaPermissionRequestManager;
+
</ins><span class="cx">     WebCore::ViewState::Flags m_viewState;
</span><span class="cx">     bool m_viewWasEverInWindow;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -257,6 +257,11 @@
</span><span class="cx">     # Geolocation messages
</span><span class="cx">     RequestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
</span><span class="cx">     
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    # MediaSteam messages
+    RequestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video)
+#endif
+
</ins><span class="cx">     # Notification messages
</span><span class="cx">     RequestNotificationPermission(uint64_t requestID, String originIdentifier)
</span><span class="cx">     ShowNotification(String title, String body, String iconURL, String tag, String lang, String dir, String originIdentifier, uint64_t notificationID)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -791,6 +791,14 @@
</span><span class="cx">                 3F889D14188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F889D12188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm */; };
</span><span class="cx">                 3F889D15188778C900FEADAF /* WebVideoFullscreenManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F889D13188778C900FEADAF /* WebVideoFullscreenManagerProxy.h */; };
</span><span class="cx">                 3F889D171887859300FEADAF /* WebVideoFullscreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F889D0D1887699C00FEADAF /* WebVideoFullscreenManager.mm */; };
</span><ins>+                4A3CC18A19B063E700D14AEF /* UserMediaPermissionRequestManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F3919AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.cpp */; };
+                4A3CC18B19B0640F00D14AEF /* UserMediaPermissionRequestManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A410F3A19AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.h */; };
+                4A3CC18C19B0641500D14AEF /* UserMediaPermissionRequestProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F3B19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.cpp */; };
+                4A3CC18D19B0641900D14AEF /* UserMediaPermissionRequestProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A410F3C19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.h */; };
+                4A3CC18E19B07B8500D14AEF /* WKUserMediaPermissionRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F3519AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.cpp */; };
+                4A3CC18F19B07B8A00D14AEF /* WKUserMediaPermissionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A410F3619AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                4A410F4419AF7B27002EBAB5 /* UserMediaPermissionRequestManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F4219AF7B27002EBAB5 /* UserMediaPermissionRequestManager.cpp */; };
+                4A410F4A19AF7B80002EBAB5 /* WebUserMediaClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F4819AF7B80002EBAB5 /* WebUserMediaClient.cpp */; };
</ins><span class="cx">                 4F601432155C5AA2001FBDE0 /* BlockingResponseMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F601430155C5A32001FBDE0 /* BlockingResponseMap.h */; };
</span><span class="cx">                 51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */; };
</span><span class="cx">                 510274321981AF8E008165ED /* WKOriginDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 755422BA18062B9C0046F6A8 /* WKOriginDataManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2818,6 +2826,16 @@
</span><span class="cx">                 3F889D12188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenManagerProxy.mm; path = ios/WebVideoFullscreenManagerProxy.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3F889D13188778C900FEADAF /* WebVideoFullscreenManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenManagerProxy.h; path = ios/WebVideoFullscreenManagerProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3F889D1618877A2400FEADAF /* WebVideoFullscreenManagerProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = WebVideoFullscreenManagerProxy.messages.in; path = ios/WebVideoFullscreenManagerProxy.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                4A410F3519AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserMediaPermissionRequest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F3619AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserMediaPermissionRequest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F3919AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionRequestManagerProxy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F3A19AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaPermissionRequestManagerProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F3B19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionRequestProxy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F3C19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaPermissionRequestProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F4219AF7B27002EBAB5 /* UserMediaPermissionRequestManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionRequestManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F4319AF7B27002EBAB5 /* UserMediaPermissionRequestManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaPermissionRequestManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F4819AF7B80002EBAB5 /* WebUserMediaClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserMediaClient.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F4919AF7B80002EBAB5 /* WebUserMediaClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserMediaClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 4F601430155C5A32001FBDE0 /* BlockingResponseMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockingResponseMap.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 510031F61379CACB00C8DFE4 /* SecItemShim.dylib */ = {isa = PBXFileReference; explicitFileType = &quot;compiled.mach-o.dylib&quot;; includeInIndex = 0; path = SecItemShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClientMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5175,6 +5193,15 @@
</span><span class="cx">                         path = Cocoa;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                4A410F4119AF7B27002EBAB5 /* MediaStream */ = {
+                        isa = PBXGroup;
+                        children = (
+                                4A410F4219AF7B27002EBAB5 /* UserMediaPermissionRequestManager.cpp */,
+                                4A410F4319AF7B27002EBAB5 /* UserMediaPermissionRequestManager.h */,
+                        );
+                        path = MediaStream;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 5105B0D2162F7A5E00E27709 /* Network */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -5635,6 +5662,7 @@
</span><span class="cx">                 BC032D5C10F436D50058C15A /* WebProcess */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                4A410F4119AF7B27002EBAB5 /* MediaStream */,
</ins><span class="cx">                                 512E352A130B559900ABD19A /* ApplicationCache */,
</span><span class="cx">                                 7C6E70F818B2D47E00F24E2E /* cocoa */,
</span><span class="cx">                                 3309344B1315B93A0097A7BC /* Cookies */,
</span><span class="lines">@@ -5672,6 +5700,8 @@
</span><span class="cx">                 BC032D5D10F437220058C15A /* WebCoreSupport */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                4A410F4819AF7B80002EBAB5 /* WebUserMediaClient.cpp */,
+                                4A410F4919AF7B80002EBAB5 /* WebUserMediaClient.h */,
</ins><span class="cx">                                 2D28F3DF1885CCB4004B9EAE /* ios */,
</span><span class="cx">                                 BC111ADE112F5B9A00337BAB /* mac */,
</span><span class="cx">                                 1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */,
</span><span class="lines">@@ -5775,6 +5805,10 @@
</span><span class="cx">                 BC032DC310F438260058C15A /* UIProcess */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                4A410F3919AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.cpp */,
+                                4A410F3A19AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.h */,
+                                4A410F3B19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.cpp */,
+                                4A410F3C19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.h */,
</ins><span class="cx">                                 2DA944A81884E9AB00ED86DB /* ios */,
</span><span class="cx">                                 BC032DC410F4387C0058C15A /* API */,
</span><span class="cx">                                 512F588D12A8836F00629530 /* Authentication */,
</span><span class="lines">@@ -5943,6 +5977,8 @@
</span><span class="cx">                 BC0C376610F807660076D7CB /* C */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                4A410F3519AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.cpp */,
+                                4A410F3619AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.h */,
</ins><span class="cx">                                 5123CF18133D25E60056F800 /* cg */,
</span><span class="cx">                                 6EE849C41368D9040038D481 /* mac */,
</span><span class="cx">                                 BCB63477116BF10600603215 /* WebKit2_C.h */,
</span><span class="lines">@@ -7195,6 +7231,7 @@
</span><span class="cx">                                 1AA41AB512C02EC4002BE67B /* EditorState.h in Headers */,
</span><span class="cx">                                 51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */,
</span><span class="cx">                                 1A7C6CDB1378950800B9C04D /* EnvironmentVariables.h in Headers */,
</span><ins>+                                4A3CC18F19B07B8A00D14AEF /* WKUserMediaPermissionRequest.h in Headers */,
</ins><span class="cx">                                 1AA575FB1496B52600A4EE06 /* EventDispatcher.h in Headers */,
</span><span class="cx">                                 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */,
</span><span class="cx">                                 1A910071126675C4001842F5 /* TextIndicator.h in Headers */,
</span><span class="lines">@@ -7609,6 +7646,7 @@
</span><span class="cx">                                 518353DB1885BF8C00D9FE44 /* IDBSerialization.h in Headers */,
</span><span class="cx">                                 1ADF591B1890528E0043C145 /* WKWebViewConfiguration.h in Headers */,
</span><span class="cx">                                 BC5744F012638FB3006F0F12 /* WebPopupItem.h in Headers */,
</span><ins>+                                4A3CC18D19B0641900D14AEF /* UserMediaPermissionRequestProxy.h in Headers */,
</ins><span class="cx">                                 D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */,
</span><span class="cx">                                 BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */,
</span><span class="cx">                                 7C8EB11718DB6A19007917C2 /* WKPreferencesPrivate.h in Headers */,
</span><span class="lines">@@ -7635,6 +7673,7 @@
</span><span class="cx">                                 2D29ECD0192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h in Headers */,
</span><span class="cx">                                 3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
</span><span class="cx">                                 33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */,
</span><ins>+                                4A3CC18B19B0640F00D14AEF /* UserMediaPermissionRequestManagerProxy.h in Headers */,
</ins><span class="cx">                                 1AAF089B19267EE500B6390C /* WKUserScript.h in Headers */,
</span><span class="cx">                                 33367656130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h in Headers */,
</span><span class="cx">                                 2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */,
</span><span class="lines">@@ -8709,7 +8748,9 @@
</span><span class="cx">                         isa = PBXSourcesBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                4A410F4419AF7B27002EBAB5 /* UserMediaPermissionRequestManager.cpp in Sources */,
</ins><span class="cx">                                 BC5D24A116CC3B9E007D5461 /* ChildProcessMain.mm in Sources */,
</span><ins>+                                4A410F4A19AF7B80002EBAB5 /* WebUserMediaClient.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -9102,6 +9143,7 @@
</span><span class="cx">                                 1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */,
</span><span class="cx">                                 A1DF631218E0B7C8003A3E2A /* DownloadClient.mm in Sources */,
</span><span class="cx">                                 1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */,
</span><ins>+                                4A3CC18A19B063E700D14AEF /* UserMediaPermissionRequestManagerProxy.cpp in Sources */,
</ins><span class="cx">                                 1AC1337F18590AE400F3EC05 /* RemoteObjectRegistry.mm in Sources */,
</span><span class="cx">                                 CEDA12E2152CD1AE00D9E08D /* WebAlternativeTextClient.cpp in Sources */,
</span><span class="cx">                                 512E352E130B55AF00ABD19A /* WebApplicationCacheManager.cpp in Sources */,
</span><span class="lines">@@ -9224,6 +9266,7 @@
</span><span class="cx">                                 51834592134532E90092B696 /* WebIconDatabaseClient.cpp in Sources */,
</span><span class="cx">                                 51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 C57193BE18C14A44002D0F12 /* WKFormSelectControl.mm in Sources */,
</span><ins>+                                4A3CC18E19B07B8500D14AEF /* WKUserMediaPermissionRequest.cpp in Sources */,
</ins><span class="cx">                                 2DDF731618E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm in Sources */,
</span><span class="cx">                                 511B24A6132E095700065A0C /* WebIconDatabaseProxy.cpp in Sources */,
</span><span class="cx">                                 51D02F6B132EC73700BEAA96 /* WebIconDatabaseProxyMessageReceiver.cpp in Sources */,
</span><span class="lines">@@ -9387,6 +9430,7 @@
</span><span class="cx">                                 BC407628124FF0400068F20A /* WKCertificateInfoMac.mm in Sources */,
</span><span class="cx">                                 515E7727183DD6F60007203F /* AsyncRequest.cpp in Sources */,
</span><span class="cx">                                 BCA284D61492F2C7001F9042 /* WKConnection.mm in Sources */,
</span><ins>+                                4A3CC18C19B0641500D14AEF /* UserMediaPermissionRequestProxy.cpp in Sources */,
</ins><span class="cx">                                 0F0C365818C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm in Sources */,
</span><span class="cx">                                 0F0C365C18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm in Sources */,
</span><span class="cx">                                 BC4A6296147313A0006C681A /* WKConnectionRef.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessMediaStreamUserMediaPermissionRequestManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+#include &quot;UserMediaPermissionRequestManager.h&quot;
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &quot;WebCoreArgumentCoders.h&quot;
+#include &quot;WebFrame.h&quot;
+#include &quot;WebPage.h&quot;
+#include &quot;WebPageProxyMessages.h&quot;
+#include &lt;WebCore/Document.h&gt;
+#include &lt;WebCore/Frame.h&gt;
+#include &lt;WebCore/FrameLoader.h&gt;
+#include &lt;WebCore/SecurityOrigin.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static uint64_t generateRequestID()
+{
+    static uint64_t uniqueRequestID = 1;
+    return uniqueRequestID++;
+}
+
+UserMediaPermissionRequestManager::UserMediaPermissionRequestManager(WebPage&amp; page)
+    : m_page(page)
+{
+}
+
+void UserMediaPermissionRequestManager::startRequest(UserMediaRequest&amp; request)
+{
+    Document* document = downcast&lt;Document&gt;(request.scriptExecutionContext());
+    Frame* frame = document ? document-&gt;frame() : nullptr;
+
+    if (!frame) {
+        request.userMediaAccessDenied();
+        return;
+    }
+
+    uint64_t requestID = generateRequestID();
+    m_idToRequestMap.add(requestID, &amp;request);
+    m_requestToIDMap.add(&amp;request, requestID);
+
+    WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
+    ASSERT(webFrame);
+
+    SecurityOrigin* origin = request.securityOrigin();
+    m_page.send(Messages::WebPageProxy::RequestUserMediaPermissionForFrame(requestID, webFrame-&gt;frameID(), origin-&gt;databaseIdentifier(), request.requiresAudio(), request.requiresVideo()));
+}
+
+void UserMediaPermissionRequestManager::cancelRequest(UserMediaRequest&amp; request)
+{
+    uint64_t requestID = m_requestToIDMap.take(&amp;request);
+    if (!requestID)
+        return;
+    m_idToRequestMap.remove(requestID);
+}
+
+void UserMediaPermissionRequestManager::didReceiveUserMediaPermissionDecision(uint64_t requestID, bool allowed)
+{
+    RefPtr&lt;UserMediaRequest&gt; request = m_idToRequestMap.take(requestID);
+    if (!request)
+        return;
+    m_requestToIDMap.remove(request);
+
+    if (allowed)
+        request-&gt;userMediaAccessGranted();
+    else
+        request-&gt;userMediaAccessDenied();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessMediaStreamUserMediaPermissionRequestManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.h (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef UserMediaPermissionRequestManager_h
+#define UserMediaPermissionRequestManager_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &lt;WebCore/UserMediaRequest.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/PassRef.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+
+namespace WebKit {
+
+class WebPage;
+
+class UserMediaPermissionRequestManager {
+public:
+    explicit UserMediaPermissionRequestManager(WebPage&amp;);
+
+    void startRequest(WebCore::UserMediaRequest&amp;);
+    void cancelRequest(WebCore::UserMediaRequest&amp;);
+
+    void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
+
+private:
+    WebPage&amp; m_page;
+
+    HashMap&lt;uint64_t, RefPtr&lt;WebCore::UserMediaRequest&gt;&gt; m_idToRequestMap;
+    HashMap&lt;RefPtr&lt;WebCore::UserMediaRequest&gt;, uint64_t&gt; m_requestToIDMap;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // UserMediaPermissionRequestManager_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebUserMediaClientcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebUserMediaClient.h&quot;
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &quot;UserMediaController.h&quot;
+#include &quot;UserMediaRequest.h&quot;
+#include &quot;WebPage.h&quot;
+#include &lt;WebCore/UserMediaRequest.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebUserMediaClient::WebUserMediaClient(WebPage&amp; page)
+    : m_page(page)
+{
+}
+
+void WebUserMediaClient::pageDestroyed()
+{
+    delete this;
+}
+
+void WebUserMediaClient::requestPermission(PassRef&lt;UserMediaRequest&gt; prRequest)
+{
+    UserMediaRequest&amp; request = prRequest.leakRef();
+    m_page.userMediaPermissionRequestManager().startRequest(request);
+}
+
+void WebUserMediaClient::cancelRequest(UserMediaRequest&amp; request)
+{
+    m_page.userMediaPermissionRequestManager().cancelRequest(request);
+}
+
+} // namespace WebKit;
+
+#endif // MEDIA_STREAM
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebUserMediaClienth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef WebUserMediaClient_h
+#define WebUserMediaClient_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &lt;WebCore/UserMediaClient.h&gt;
+#include &lt;wtf/PassRefPtr.h&gt;
+
+namespace WebKit {
+
+class WebPage;
+
+class WebUserMediaClient : public WebCore::UserMediaClient {
+public:
+    WebUserMediaClient(WebPage&amp;);
+
+private:
+    virtual void pageDestroyed();
+    virtual void requestPermission(PassRef&lt;WebCore::UserMediaRequest&gt;) override;
+    virtual void cancelRequest(WebCore::UserMediaRequest&amp;) override;
+
+    WebPage&amp; m_page;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // WebUserMediaClient_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -98,6 +98,7 @@
</span><span class="cx"> #include &quot;WebProgressTrackerClient.h&quot;
</span><span class="cx"> #include &quot;WebUndoStep.h&quot;
</span><span class="cx"> #include &quot;WebUserContentController.h&quot;
</span><ins>+#include &quot;WebUserMediaClient.h&quot;
</ins><span class="cx"> #include &lt;JavaScriptCore/APICast.h&gt;
</span><span class="cx"> #include &lt;WebCore/ArchiveResource.h&gt;
</span><span class="cx"> #include &lt;WebCore/Chrome.h&gt;
</span><span class="lines">@@ -281,6 +282,9 @@
</span><span class="cx"> #if ENABLE(GEOLOCATION)
</span><span class="cx">     , m_geolocationPermissionRequestManager(this)
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    , m_userMediaPermissionRequestManager(*this)
+#endif
</ins><span class="cx">     , m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
</span><span class="cx">     , m_canRunModal(parameters.canRunModal)
</span><span class="cx">     , m_isRunningModal(false)
</span><span class="lines">@@ -386,6 +390,9 @@
</span><span class="cx"> #if ENABLE(PROXIMITY_EVENTS)
</span><span class="cx">     WebCore::provideDeviceProximityTo(m_page.get(), new WebDeviceProximityClient(this));
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    WebCore::provideUserMediaTo(m_page.get(), new WebUserMediaClient(*this));
+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">     m_page-&gt;setRemoteInspectionAllowed(true);
</span><span class="lines">@@ -3252,6 +3259,13 @@
</span><span class="cx">     notificationPermissionRequestManager()-&gt;didReceiveNotificationPermissionDecision(notificationID, allowed);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_STREAM)
+void WebPage::didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed)
+{
+    m_userMediaPermissionRequestManager.didReceiveUserMediaPermissionDecision(userMediaID, allowed);
+}
+#endif
+
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> void WebPage::advanceToNextMisspelling(bool startBeforeSelection)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include &quot;Plugin.h&quot;
</span><span class="cx"> #include &quot;SandboxExtension.h&quot;
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><ins>+#include &quot;UserMediaPermissionRequestManager.h&quot;
</ins><span class="cx"> #include &lt;WebCore/DictationAlternative.h&gt;
</span><span class="cx"> #include &lt;WebCore/DragData.h&gt;
</span><span class="cx"> #include &lt;WebCore/Editor.h&gt;
</span><span class="lines">@@ -449,6 +450,10 @@
</span><span class="cx">     void restorePageState(const WebCore::HistoryItem&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    UserMediaPermissionRequestManager&amp; userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     WebCore::FloatSize screenSize() const;
</span><span class="cx">     WebCore::FloatSize availableScreenSize() const;
</span><span class="lines">@@ -1019,6 +1024,10 @@
</span><span class="cx"> 
</span><span class="cx">     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
+#endif
+
</ins><span class="cx">     void advanceToNextMisspelling(bool startBeforeSelection);
</span><span class="cx">     void changeSpellingToWord(const String&amp; word);
</span><span class="cx"> #if USE(APPKIT)
</span><span class="lines">@@ -1186,6 +1195,10 @@
</span><span class="cx">     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    UserMediaPermissionRequestManager m_userMediaPermissionRequestManager;
+#endif
+
</ins><span class="cx">     std::unique_ptr&lt;WebCore::PrintContext&gt; m_printContext;
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     RefPtr&lt;WebPrintOperationGtk&gt; m_printOperation;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -269,6 +269,11 @@
</span><span class="cx">     DidReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_STREAM)
+    # MediaSteam
+    DidReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed)
+#endif
+
</ins><span class="cx">     # Notification
</span><span class="cx">     DidReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/ChangeLog        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-09-01  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [WK2] UserMediaClient support
+        https://bugs.webkit.org/show_bug.cgi?id=123158
+
+        Reviewed by Benjamin Poulain.
+
+        Simple API test for the UserMedia permission request API. The
+        required test infrastructure is also added, inspired by the
+        Geolocation infrastructure.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: New API test for UserMedia
+        Permission request.
+        * TestWebKitAPI/Tests/WebKit2/UserMedia.cpp: Added.
+        (TestWebKitAPI::decidePolicyForUserMediaPermissionRequestCallBack):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/getUserMedia.html: Added.
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: new
+        helper method to set the permission request result without user interaction.
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Ditto.
+        (WTR::InjectedBundle::setUserMediaPermission):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Ditto.
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp: Ditto.
+        (WTR::TestRunner::setUserMediaPermission):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h: Ditto.
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::decidePolicyForUserMediaPermissionRequest): Permission
+        request handler.
+        (WTR::TestController::createOtherPage): Enable the new UserMedia
+        permission request handler.
+        (WTR::TestController::createWebViewWithOptions): Ditto.
+        (WTR::TestController::resetPreferencesToConsistentValues): Enable
+        MediaStream support, this is needed for getUserMedia.
+        (WTR::TestController::resetStateToConsistentValues): clear
+        UserMedia permissions list and flags.
+        (WTR::TestController::setUserMediaPermission): Set permission
+        request result and distpatch it.
+        (WTR::TestController::handleUserMediaPermissionRequest): Save
+        request and dispatch it.
+        (WTR::TestController::decidePolicyForUserMediaPermissionRequestIfPossible):
+        Dispatch cached permission requests.
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
</ins><span class="cx"> 2014-11-11  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         webkit-patch --suggest-reviewers is broken with newer versions of git
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPICMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/CMakeLists.txt        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -168,6 +168,8 @@
</span><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> target_link_libraries(TestJavaScriptCore ${TestJavaScriptCore_LIBRARIES})
</span><ins>+add_dependencies(TestJavaScriptCore ${ForwardingHeadersForTestWebKitAPI_NAME})
+
</ins><span class="cx"> add_test(TestJavaScriptCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJavaScriptCore)
</span><span class="cx"> set_tests_properties(TestJavaScriptCore PROPERTIES TIMEOUT 60)
</span><span class="cx"> set_target_properties(TestJavaScriptCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResizeWindowAfterCrash.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/RestoreSessionStateContainingFormData.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMedia.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx">                 37E1064D16976C8500B78BD0 /* DOMHTMLTableCellCellAbove.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37E1064A1697676400B78BD0 /* DOMHTMLTableCellCellAbove.mm */; };
</span><span class="cx">                 37E38C34169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37E38C33169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm */; };
</span><span class="cx">                 440A1D3914A0103A008A66F2 /* URL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 440A1D3814A0103A008A66F2 /* URL.cpp */; };
</span><ins>+                4A410F4C19AF7BD6002EBAB5 /* UserMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */; };
</ins><span class="cx">                 4BB4160216815B2600824238 /* JSWrapperForNodeInWebFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4160116815B2600824238 /* JSWrapperForNodeInWebFrame.mm */; };
</span><span class="cx">                 4BB4160416815F9100824238 /* ElementAtPointInWebFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4160316815F9100824238 /* ElementAtPointInWebFrame.mm */; };
</span><span class="cx">                 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
</span><span class="lines">@@ -446,6 +447,8 @@
</span><span class="cx">                 37E38C33169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewDidRemoveFrameFromHierarchy.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 440A1D3814A0103A008A66F2 /* URL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 44A622C114A0E2B60048515B /* WTFStringUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFStringUtilities.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMedia.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMedia.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 4BB4160116815B2600824238 /* JSWrapperForNodeInWebFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSWrapperForNodeInWebFrame.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 4BB4160316815F9100824238 /* ElementAtPointInWebFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementAtPointInWebFrame.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -838,6 +841,7 @@
</span><span class="cx">                 BC9096411255616000083756 /* WebKit2 */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */,
</ins><span class="cx">                                 C0C5D3BB14598B6F00A802A6 /* mac */,
</span><span class="cx">                                 BC90977B125571AE00083756 /* Resources */,
</span><span class="cx">                                 BC246D8C132F115A00B56D7C /* AboutBlankLoad.cpp */,
</span><span class="lines">@@ -972,6 +976,7 @@
</span><span class="cx">                 BC90977B125571AE00083756 /* Resources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */,
</ins><span class="cx">                                 C045F9461385C2F800C0F3CD /* 18-characters.html */,
</span><span class="cx">                                 F6B7BE9617469B7E008A3445 /* associate-form-controls.html */,
</span><span class="cx">                                 76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
</span><span class="lines">@@ -1380,6 +1385,7 @@
</span><span class="cx">                                 51FCF79A1534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp in Sources */,
</span><span class="cx">                                 1AFDE6561953B2C000C48FFA /* Optional.cpp in Sources */,
</span><span class="cx">                                 C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */,
</span><ins>+                                4A410F4C19AF7BD6002EBAB5 /* UserMedia.cpp in Sources */,
</ins><span class="cx">                                 C02B77F2126612140026BF0F /* SpacebarScrolling.cpp in Sources */,
</span><span class="cx">                                 93D3D19E17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp in Sources */,
</span><span class="cx">                                 E194E1BB177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2UserMediacpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/UserMedia.cpp (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/UserMedia.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/UserMedia.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(MEDIA_STREAM)
+#include &quot;PlatformUtilities.h&quot;
+#include &quot;PlatformWebView.h&quot;
+#include &quot;Test.h&quot;
+#include &lt;WebKit/WKRetainPtr.h&gt;
+#include &lt;string.h&gt;
+#include &lt;vector&gt;
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+void decidePolicyForUserMediaPermissionRequestCallBack(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKUserMediaPermissionRequestRef permissionRequest, const void* /* clientInfo */)
+{
+    WKUserMediaPermissionRequestAllow(permissionRequest);
+    done = true;
+}
+
+TEST(WebKit2, UserMediaBasic)
+{
+    auto context = adoptWK(WKContextCreate());
+    PlatformWebView webView(context.get());
+    WKPageUIClientV5 uiClient;
+    memset(&amp;uiClient, 0, sizeof(uiClient));
+
+
+    uiClient.base.version = 5;
+    uiClient.decidePolicyForUserMediaPermissionRequest = decidePolicyForUserMediaPermissionRequestCallBack;
+
+    WKPageSetPageUIClient(webView.page(), &amp;uiClient.base);
+
+    done = false;
+    auto url = adoptWK(Util::createURLForResource(&quot;getUserMedia&quot;, &quot;html&quot;));
+    WKPageLoadURL(webView.page(), url.get());
+
+    Util::run(&amp;done);
+}
+
+} // namespace TestWebKitAPI
+
+#endif // ENABLE(MEDIA_STREAM)
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2getUserMediahtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/getUserMedia.html (0 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/getUserMedia.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/getUserMedia.html        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;script&gt;
+function gotUserMedia(mediaStream)
+{
+    console.log(&quot;Got user media&quot;);
+}
+
+function userMediaError(error)
+{
+    console.log(error);
+}
+
+var options = { audio: false, video: true};
+navigator.webkitGetUserMedia(options, gotUserMedia, userMediaError);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -169,6 +169,9 @@
</span><span class="cx">     void setMockGeolocationPosition(double latitude, double longitude, double accuracy, [Default=Undefined] optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed);
</span><span class="cx">     void setMockGeolocationPositionUnavailableError(DOMString errorMessage);
</span><span class="cx"> 
</span><ins>+    // MediaStream
+    void setUserMediaPermission(boolean value);
+
</ins><span class="cx">     // Audio testing.
</span><span class="cx">     [PassContext] void setAudioResult(object data);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -458,6 +458,13 @@
</span><span class="cx">     WKBundlePostMessage(m_bundle, messageName.get(), errorMessage);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InjectedBundle::setUserMediaPermission(bool enabled)
+{
+    auto messageName = adoptWK(WKStringCreateWithUTF8CString(&quot;SetUserMediaPermission&quot;));
+    auto messageBody = adoptWK(WKBooleanCreate(enabled));
+    WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
</ins><span class="cx"> void InjectedBundle::setCustomPolicyDelegate(bool enabled, bool permissive)
</span><span class="cx"> {
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; messageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;SetCustomPolicyDelegate&quot;));
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundleh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -92,6 +92,9 @@
</span><span class="cx">     void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
</span><span class="cx">     void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
</span><span class="cx"> 
</span><ins>+    // MediaStream.
+    void setUserMediaPermission(bool);
+
</ins><span class="cx">     // Policy delegate.
</span><span class="cx">     void setCustomPolicyDelegate(bool enabled, bool permissive);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -720,6 +720,12 @@
</span><span class="cx">     InjectedBundle::shared().setMockGeolocationPositionUnavailableError(messageWK.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::setUserMediaPermission(bool enabled)
+{
+    // FIXME: this should be done by frame.
+    InjectedBundle::shared().setUserMediaPermission(enabled);
+}
+
</ins><span class="cx"> bool TestRunner::callShouldCloseOnWebView()
</span><span class="cx"> {
</span><span class="cx">     WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()-&gt;page());
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -252,6 +252,9 @@
</span><span class="cx">     void setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef altitude, JSValueRef altitudeAccuracy, JSValueRef heading, JSValueRef speed);
</span><span class="cx">     void setMockGeolocationPositionUnavailableError(JSStringRef message);
</span><span class="cx"> 
</span><ins>+    // MediaStream
+    void setUserMediaPermission(bool);
+
</ins><span class="cx">     void setPageVisibility(JSStringRef state);
</span><span class="cx">     void resetPageVisibility();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -189,6 +189,11 @@
</span><span class="cx">     TestController::shared().handleGeolocationPermissionRequest(permissionRequest);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void decidePolicyForUserMediaPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKUserMediaPermissionRequestRef permissionRequest, const void* clientInfo)
+{
+    TestController::shared().handleUserMediaPermissionRequest(permissionRequest);
+}
+
</ins><span class="cx"> int TestController::getCustomTimeout()
</span><span class="cx"> {
</span><span class="cx">     return m_timeout;
</span><span class="lines">@@ -203,8 +208,8 @@
</span><span class="cx"> 
</span><span class="cx">     view-&gt;resizeTo(800, 600);
</span><span class="cx"> 
</span><del>-    WKPageUIClientV2 otherPageUIClient = {
-        { 2, view },
</del><ins>+    WKPageUIClientV5 otherPageUIClient = {
+        { 5, view },
</ins><span class="cx">         0, // createNewPage_deprecatedForUseWithV0
</span><span class="cx">         0, // showPage
</span><span class="cx">         closeOtherPage,
</span><span class="lines">@@ -251,6 +256,12 @@
</span><span class="cx">         0, // showColorPicker
</span><span class="cx">         0, // hideColorPicker
</span><span class="cx">         0, // unavailablePluginButtonClicked
</span><ins>+        0, // pinnedStateDidChange
+        0, // didBeginTrackingPotentialLongMousePress
+        0, // didRecognizeLongMousePress
+        0, // didCancelTrackingPotentialLongMousePress
+        0, // isPlayingAudioDidChange
+        decidePolicyForUserMediaPermissionRequest,
</ins><span class="cx">     };
</span><span class="cx">     WKPageSetPageUIClient(newPage, &amp;otherPageUIClient.base);
</span><span class="cx"> 
</span><span class="lines">@@ -409,8 +420,8 @@
</span><span class="cx"> void TestController::createWebViewWithOptions(WKDictionaryRef options)
</span><span class="cx"> {
</span><span class="cx">     m_mainWebView = std::make_unique&lt;PlatformWebView&gt;(m_context.get(), m_pageGroup.get(), nullptr, options);
</span><del>-    WKPageUIClientV2 pageUIClient = {
-        { 2, m_mainWebView.get() },
</del><ins>+    WKPageUIClientV5 pageUIClient = {
+        { 5, m_mainWebView.get() },
</ins><span class="cx">         0, // createNewPage_deprecatedForUseWithV0
</span><span class="cx">         0, // showPage
</span><span class="cx">         0, // close
</span><span class="lines">@@ -457,6 +468,12 @@
</span><span class="cx">         0, // showColorPicker
</span><span class="cx">         0, // hideColorPicker
</span><span class="cx">         unavailablePluginButtonClicked,
</span><ins>+        0, // pinnedStateDidChange
+        0, // didBeginTrackingPotentialLongMousePress
+        0, // didRecognizeLongMousePress
+        0, // didCancelTrackingPotentialLongMousePress
+        0, // isPlayingAudioDidChange
+        decidePolicyForUserMediaPermissionRequest,
</ins><span class="cx">     };
</span><span class="cx">     WKPageSetPageUIClient(m_mainWebView-&gt;page(), &amp;pageUIClient.base);
</span><span class="cx"> 
</span><span class="lines">@@ -546,6 +563,7 @@
</span><span class="cx">     WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
</span><span class="cx">     WKPreferencesSetXSSAuditorEnabled(preferences, false);
</span><span class="cx">     WKPreferencesSetWebAudioEnabled(preferences, true);
</span><ins>+    WKPreferencesSetMediaStreamEnabled(preferences, true);
</ins><span class="cx">     WKPreferencesSetDeveloperExtrasEnabled(preferences, true);
</span><span class="cx">     WKPreferencesSetJavaScriptExperimentsEnabled(preferences, true);
</span><span class="cx">     WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(preferences, true);
</span><span class="lines">@@ -649,6 +667,11 @@
</span><span class="cx">     m_isGeolocationPermissionSet = false;
</span><span class="cx">     m_isGeolocationPermissionAllowed = false;
</span><span class="cx"> 
</span><ins>+    // Reset UserMedia permissions.
+    m_userMediaPermissionRequests.clear();
+    m_isUserMediaPermissionSet = false;
+    m_isUserMediaPermissionAllowed = false;
+
</ins><span class="cx">     // Reset Custom Policy Delegate.
</span><span class="cx">     setCustomPolicyDelegate(false, false);
</span><span class="cx"> 
</span><span class="lines">@@ -1366,6 +1389,33 @@
</span><span class="cx">     decidePolicyForGeolocationPermissionRequestIfPossible();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestController::setUserMediaPermission(bool enabled)
+{
+    m_isUserMediaPermissionSet = true;
+    m_isUserMediaPermissionAllowed = enabled;
+    decidePolicyForUserMediaPermissionRequestIfPossible();
+}
+
+void TestController::handleUserMediaPermissionRequest(WKUserMediaPermissionRequestRef userMediaPermissionRequest)
+{
+    m_userMediaPermissionRequests.append(userMediaPermissionRequest);
+    decidePolicyForUserMediaPermissionRequestIfPossible();
+}
+
+void TestController::decidePolicyForUserMediaPermissionRequestIfPossible()
+{
+    if (!m_isUserMediaPermissionSet)
+        return;
+
+    for (auto&amp; request : m_userMediaPermissionRequests) {
+        if (m_isUserMediaPermissionAllowed)
+            WKUserMediaPermissionRequestAllow(request.get());
+        else
+            WKUserMediaPermissionRequestDeny(request.get());
+    }
+    m_userMediaPermissionRequests.clear();
+}
+
</ins><span class="cx"> void TestController::setCustomPolicyDelegate(bool enabled, bool permissive)
</span><span class="cx"> {
</span><span class="cx">     m_policyDelegateEnabled = enabled;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.h (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.h        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/TestController.h        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -88,6 +88,10 @@
</span><span class="cx">     void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
</span><span class="cx">     void handleGeolocationPermissionRequest(WKGeolocationPermissionRequestRef);
</span><span class="cx"> 
</span><ins>+    // MediaStream.
+    void setUserMediaPermission(bool);
+    void handleUserMediaPermissionRequest(WKUserMediaPermissionRequestRef);
+
</ins><span class="cx">     // Policy delegate.
</span><span class="cx">     void setCustomPolicyDelegate(bool enabled, bool permissive);
</span><span class="cx"> 
</span><span class="lines">@@ -134,6 +138,7 @@
</span><span class="cx">     void updateLayoutTypeForTest(const TestInvocation&amp;);
</span><span class="cx"> 
</span><span class="cx">     void decidePolicyForGeolocationPermissionRequestIfPossible();
</span><ins>+    void decidePolicyForUserMediaPermissionRequestIfPossible();
</ins><span class="cx"> 
</span><span class="cx">     // WKContextInjectedBundleClient
</span><span class="cx">     static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*);
</span><span class="lines">@@ -238,6 +243,10 @@
</span><span class="cx">     bool m_isGeolocationPermissionSet;
</span><span class="cx">     bool m_isGeolocationPermissionAllowed;
</span><span class="cx"> 
</span><ins>+    Vector&lt;WKRetainPtr&lt;WKUserMediaPermissionRequestRef&gt;&gt; m_userMediaPermissionRequests;
+    bool m_isUserMediaPermissionSet;
+    bool m_isUserMediaPermissionAllowed;
+
</ins><span class="cx">     bool m_policyDelegateEnabled;
</span><span class="cx">     bool m_policyDelegatePermissive;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (176010 => 176011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2014-11-12 07:59:21 UTC (rev 176010)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2014-11-12 08:25:05 UTC (rev 176011)
</span><span class="lines">@@ -478,6 +478,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, &quot;SetUserMediaPermission&quot;)) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef enabledWK = static_cast&lt;WKBooleanRef&gt;(messageBody);
+        TestController::shared().setUserMediaPermission(WKBooleanGetValue(enabledWK));
+        return;
+    }
+
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(messageName, &quot;SetCustomPolicyDelegate&quot;)) {
</span><span class="cx">         ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
</span><span class="cx">         WKDictionaryRef messageBodyDictionary = static_cast&lt;WKDictionaryRef&gt;(messageBody);
</span></span></pre>
</div>
</div>

</body>
</html>