<!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>[176039] 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/176039">176039</a></dd>
<dt>Author</dt> <dd>adachan@apple.com</dd>
<dt>Date</dt> <dd>2014-11-12 14:12:33 -0800 (Wed, 12 Nov 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement new plug-in API for muting plug-ins
https://bugs.webkit.org/show_bug.cgi?id=138105
Reviewed by Anders Carlsson.
Source/WebCore:
Add the new NPNVmuteAudioBool NPNVariable.
Test: platform/mac-wk2/plugins/muted-state.html
* plugins/npapi.h:
Source/WebKit2:
Handle the setting of NPNVmuteAudioBool on the plug-in.
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::PluginControllerProxy):
Initialize m_isMuted.
(WebKit::PluginControllerProxy::mutedStateChanged):
Tell the plugin about the new muted state.
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/PluginControllerProxy.messages.in:
Add the MutedStateChanged message.
* PluginProcess/PluginCreationParameters.cpp:
(WebKit::PluginCreationParameters::PluginCreationParameters):
Initialize isMuted.
(WebKit::PluginCreationParameters::encode):
Handle isMuted.
(WebKit::PluginCreationParameters::decode):
Ditto.
* PluginProcess/PluginCreationParameters.h:
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue):
Get the plug-in's muted state.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::isMuted):
Get the muted state from PluginControllerProxy.
(WebKit::NetscapePlugin::mutedStateChanged):
Call NPP_SetValue with NPNVmuteAudioBool and the updated muted state.
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Plugin.h:
(WebKit::Plugin::mutedStateChanged):
* WebProcess/Plugins/PluginController.h:
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::initialize):
Set m_pendingPluginCreationParameters->isMuted.
(WebKit::PluginProxy::mutedStateChanged):
Send the MutedStateChanged message to the plugin process.
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::pageMutedStateDidChange):
Call Plugin::mutedStateChanged() with the page's muted state.
(WebKit::PluginView::isMuted):
Get the page's current muted state.
* WebProcess/Plugins/PluginView.h:
Tools:
Add a new plug-in test for the mute API.
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp: Added.
(SetMuted::SetMuted):
(SetMuted::isMuted):
(SetMuted::cachedIsMuted):
(SetMuted::ScriptableObject::hasProperty):
(SetMuted::ScriptableObject::getProperty):
(SetMuted::ScriptableObject::pluginTest):
(SetMuted::NPP_New):
(SetMuted::NPP_GetValue):
(SetMuted::NPP_SetValue):
LayoutTests:
* platform/mac-wk2/plugins/muted-state-expected.txt: Added.
* platform/mac-wk2/plugins/muted-state.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepluginsnpapih">trunk/Source/WebCore/plugins/npapi.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessPluginControllerProxycpp">trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessPluginControllerProxyh">trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessPluginControllerProxymessagesin">trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessPluginCreationParameterscpp">trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessPluginCreationParametersh">trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsNetscapeNetscapeBrowserFuncscpp">trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsNetscapeNetscapePlugincpp">trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsNetscapeNetscapePluginh">trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginh">trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginControllerh">trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginProxycpp">trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginProxyh">trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginViewcpp">trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginViewh">trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj">trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacwk2pluginsmutedstateexpectedtxt">trunk/LayoutTests/platform/mac-wk2/plugins/muted-state-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2pluginsmutedstatehtml">trunk/LayoutTests/platform/mac-wk2/plugins/muted-state.html</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestNetscapePlugInTestsmacSetMutedcpp">trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/LayoutTests/ChangeLog        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-11-05 Ada Chan <adachan@apple.com>
+
+ Implement new plug-in API for muting plug-ins
+ https://bugs.webkit.org/show_bug.cgi?id=138105
+
+ Reviewed by Anders Carlsson.
+
+ * platform/mac-wk2/plugins/muted-state-expected.txt: Added.
+ * platform/mac-wk2/plugins/muted-state.html: Added.
+
</ins><span class="cx"> 2014-11-12 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Some platform/mac text expectation cleanup.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2pluginsmutedstateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/plugins/muted-state-expected.txt (0 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/plugins/muted-state-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/plugins/muted-state-expected.txt        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Tests that the mute API implementation works as expected. This test needs to be run through WebKitTestRunner.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS plugin1.isMuted is false
+PASS plugin1.cachedIsMuted is false
+PASS plugin1.isMuted is true
+PASS plugin1.cachedIsMuted is true
+PASS plugin2.isMuted is true
+PASS plugin2.cachedIsMuted is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2pluginsmutedstatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/plugins/muted-state.html (0 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/plugins/muted-state.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/plugins/muted-state.html        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+<script>
+description("Tests that the mute API implementation works as expected. This test needs to be run through WebKitTestRunner.");
+
+jsTestIsAsync = true;
+
+function createTestPlugin(testName)
+{
+ var plugin = document.createElement("embed");
+ plugin.type = "application/x-webkit-test-netscape";
+ plugin.setAttribute('test', testName);
+
+ return plugin;
+}
+
+function runTest()
+{
+ if (!window.testRunner) {
+ debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
+ return;
+ }
+
+ plugin1 = createTestPlugin('set-muted');
+ document.body.appendChild(plugin1);
+
+ shouldBeFalse("plugin1.isMuted");
+ shouldBeFalse("plugin1.cachedIsMuted");
+
+ // Now set page to be muted.
+ if (window.internals)
+ window.internals.setPageMuted(true);
+
+ shouldBeTrue("plugin1.isMuted");
+ shouldBeTrue("plugin1.cachedIsMuted");
+
+ plugin2 = createTestPlugin('set-muted');
+ document.body.appendChild(plugin2);
+ shouldBeTrue("plugin2.isMuted");
+ shouldBeTrue("plugin2.cachedIsMuted");
+
+ finishJSTest();
+}
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</head>
+<body onload="runTest()">
+</body>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebCore/ChangeLog        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-11-05 Ada Chan <adachan@apple.com>
+
+ Implement new plug-in API for muting plug-ins
+ https://bugs.webkit.org/show_bug.cgi?id=138105
+
+ Reviewed by Anders Carlsson.
+
+ Add the new NPNVmuteAudioBool NPNVariable.
+
+ Test: platform/mac-wk2/plugins/muted-state.html
+
+ * plugins/npapi.h:
+
</ins><span class="cx"> 2014-11-12 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Need to show the text indicator when Data Detectors shows a popover
</span></span></pre></div>
<a id="trunkSourceWebCorepluginsnpapih"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/plugins/npapi.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/plugins/npapi.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebCore/plugins/npapi.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -432,6 +432,9 @@
</span><span class="cx"> , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
</span><span class="cx"> CA model compositing */
</span><span class="cx"> #endif /* XP_MACOSX */
</span><ins>+
+ , NPNVmuteAudioBool = 4000
+
</ins><span class="cx"> } NPNVariable;
</span><span class="cx">
</span><span class="cx"> typedef enum {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2014-11-05 Ada Chan <adachan@apple.com>
+
+ Implement new plug-in API for muting plug-ins
+ https://bugs.webkit.org/show_bug.cgi?id=138105
+
+ Reviewed by Anders Carlsson.
+
+ Handle the setting of NPNVmuteAudioBool on the plug-in.
+
+ * PluginProcess/PluginControllerProxy.cpp:
+ (WebKit::PluginControllerProxy::PluginControllerProxy):
+ Initialize m_isMuted.
+ (WebKit::PluginControllerProxy::mutedStateChanged):
+ Tell the plugin about the new muted state.
+ * PluginProcess/PluginControllerProxy.h:
+ * PluginProcess/PluginControllerProxy.messages.in:
+ Add the MutedStateChanged message.
+ * PluginProcess/PluginCreationParameters.cpp:
+ (WebKit::PluginCreationParameters::PluginCreationParameters):
+ Initialize isMuted.
+ (WebKit::PluginCreationParameters::encode):
+ Handle isMuted.
+ (WebKit::PluginCreationParameters::decode):
+ Ditto.
+ * PluginProcess/PluginCreationParameters.h:
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_GetValue):
+ Get the plug-in's muted state.
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::isMuted):
+ Get the muted state from PluginControllerProxy.
+ (WebKit::NetscapePlugin::mutedStateChanged):
+ Call NPP_SetValue with NPNVmuteAudioBool and the updated muted state.
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ * WebProcess/Plugins/Plugin.h:
+ (WebKit::Plugin::mutedStateChanged):
+ * WebProcess/Plugins/PluginController.h:
+ * WebProcess/Plugins/PluginProxy.cpp:
+ (WebKit::PluginProxy::initialize):
+ Set m_pendingPluginCreationParameters->isMuted.
+ (WebKit::PluginProxy::mutedStateChanged):
+ Send the MutedStateChanged message to the plugin process.
+ * WebProcess/Plugins/PluginProxy.h:
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::pageMutedStateDidChange):
+ Call Plugin::mutedStateChanged() with the page's muted state.
+ (WebKit::PluginView::isMuted):
+ Get the page's current muted state.
+ * WebProcess/Plugins/PluginView.h:
+
</ins><span class="cx"> 2014-11-12 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Two action menu item titles are swapped
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginControllerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> , m_pluginInstanceID(creationParameters.pluginInstanceID)
</span><span class="cx"> , m_userAgent(creationParameters.userAgent)
</span><span class="cx"> , m_isPrivateBrowsingEnabled(creationParameters.isPrivateBrowsingEnabled)
</span><ins>+ , m_isMuted(creationParameters.isMuted)
</ins><span class="cx"> , m_isAcceleratedCompositingEnabled(creationParameters.isAcceleratedCompositingEnabled)
</span><span class="cx"> , m_isInitializing(false)
</span><span class="cx"> , m_isVisible(false)
</span><span class="lines">@@ -637,6 +638,15 @@
</span><span class="cx"> m_plugin->privateBrowsingStateChanged(isPrivateBrowsingEnabled);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void PluginControllerProxy::mutedStateChanged(bool isMuted)
+{
+ if (m_isMuted == isMuted)
+ return;
+
+ m_isMuted = isMuted;
+ m_plugin->mutedStateChanged(isMuted);
+}
+
</ins><span class="cx"> void PluginControllerProxy::getFormValue(bool& returnValue, String& formValue)
</span><span class="cx"> {
</span><span class="cx"> returnValue = m_plugin->getFormValue(formValue);
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginControllerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx"> virtual String cookiesForURL(const String&) override;
</span><span class="cx"> virtual void setCookiesForURL(const String& urlString, const String& cookieString) override;
</span><span class="cx"> virtual bool isPrivateBrowsingEnabled() override;
</span><ins>+ virtual bool isMuted() const override { return m_isMuted; }
</ins><span class="cx"> virtual bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password) override;
</span><span class="cx"> virtual void protectPluginFromDestruction() override;
</span><span class="cx"> virtual void unprotectPluginFromDestruction() override;
</span><span class="lines">@@ -164,6 +165,7 @@
</span><span class="cx">
</span><span class="cx"> void storageBlockingStateChanged(bool);
</span><span class="cx"> void privateBrowsingStateChanged(bool);
</span><ins>+ void mutedStateChanged(bool);
</ins><span class="cx"> void getFormValue(bool& returnValue, String& formValue);
</span><span class="cx">
</span><span class="cx"> void platformInitialize(const PluginCreationParameters&);
</span><span class="lines">@@ -176,6 +178,7 @@
</span><span class="cx"> String m_userAgent;
</span><span class="cx"> bool m_storageBlockingEnabled;
</span><span class="cx"> bool m_isPrivateBrowsingEnabled;
</span><ins>+ bool m_isMuted;
</ins><span class="cx"> bool m_isAcceleratedCompositingEnabled;
</span><span class="cx"> bool m_isInitializing;
</span><span class="cx"> bool m_isVisible;
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginControllerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -129,6 +129,9 @@
</span><span class="cx">
</span><span class="cx"> # Gets the string representating the form value of the plug-in
</span><span class="cx"> GetFormValue() -> (bool returnValue, String formValue)
</span><ins>+
+ # Sent when the browser wants to mute or unmute the plugin.
+ MutedStateChanged(bool muted)
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> , windowNPObjectID(0)
</span><span class="cx"> , contentsScaleFactor(1)
</span><span class="cx"> , isPrivateBrowsingEnabled(false)
</span><ins>+ , isMuted(false)
</ins><span class="cx"> , asynchronousCreationIncomplete(false)
</span><span class="cx"> , artificialPluginInitializationDelayEnabled(false)
</span><span class="cx"> , isAcceleratedCompositingEnabled(false)
</span><span class="lines">@@ -51,6 +52,7 @@
</span><span class="cx"> encoder << userAgent;
</span><span class="cx"> encoder << contentsScaleFactor;
</span><span class="cx"> encoder << isPrivateBrowsingEnabled;
</span><ins>+ encoder << isMuted;
</ins><span class="cx"> encoder << asynchronousCreationIncomplete;
</span><span class="cx"> encoder << artificialPluginInitializationDelayEnabled;
</span><span class="cx"> encoder << isAcceleratedCompositingEnabled;
</span><span class="lines">@@ -76,6 +78,9 @@
</span><span class="cx"> if (!decoder.decode(result.isPrivateBrowsingEnabled))
</span><span class="cx"> return false;
</span><span class="cx">
</span><ins>+ if (!decoder.decode(result.isMuted))
+ return false;
+
</ins><span class="cx"> if (!decoder.decode(result.asynchronousCreationIncomplete))
</span><span class="cx"> return false;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/PluginProcess/PluginCreationParameters.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -60,6 +60,9 @@
</span><span class="cx">
</span><span class="cx"> // Whether private browsing is enabled at the time of instantiation.
</span><span class="cx"> bool isPrivateBrowsingEnabled;
</span><ins>+
+ // Whether the plugin should be muted.
+ bool isMuted;
</ins><span class="cx">
</span><span class="cx"> // If requesting synchronous initialization, whether this plugin had previously been requested asynchronously
</span><span class="cx"> bool asynchronousCreationIncomplete;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsNetscapeNetscapeBrowserFuncscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -442,6 +442,12 @@
</span><span class="cx"> *(NPBool*)value = plugin->isPrivateBrowsingEnabled();
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+
+ case NPNVmuteAudioBool: {
+ RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+ *(NPBool*)value = plugin->isMuted();
+ break;
+ }
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> case NPNVsupportsCoreGraphicsBool:
</span><span class="cx"> // Always claim to support the Core Graphics drawing model.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsNetscapeNetscapePlugincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -254,6 +254,11 @@
</span><span class="cx"> return controller()->isPrivateBrowsingEnabled();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool NetscapePlugin::isMuted() const
+{
+ return controller()->isMuted();
+}
+
</ins><span class="cx"> NPObject* NetscapePlugin::windowScriptNPObject()
</span><span class="cx"> {
</span><span class="cx"> return controller()->windowScriptNPObject();
</span><span class="lines">@@ -1082,6 +1087,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void NetscapePlugin::mutedStateChanged(bool muted)
+{
+ NPBool value = muted;
+ NPP_SetValue(NPNVmuteAudioBool, &value);
+}
+
</ins><span class="cx"> #if !PLATFORM(COCOA)
</span><span class="cx">
</span><span class="cx"> void NetscapePlugin::windowFocusChanged(bool)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsNetscapeNetscapePluginh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -103,6 +103,7 @@
</span><span class="cx"> static void setException(const String&);
</span><span class="cx"> bool evaluate(NPObject*, const String&scriptString, NPVariant* result);
</span><span class="cx"> bool isPrivateBrowsingEnabled();
</span><ins>+ bool isMuted() const;
</ins><span class="cx">
</span><span class="cx"> static void setSetExceptionFunction(void (*)(const String&));
</span><span class="cx">
</span><span class="lines">@@ -260,6 +261,8 @@
</span><span class="cx">
</span><span class="cx"> virtual String getSelectionString() const override { return String(); }
</span><span class="cx">
</span><ins>+ virtual void mutedStateChanged(bool) override;
+
</ins><span class="cx"> void updateNPNPrivateMode();
</span><span class="cx">
</span><span class="cx"> #if PLUGIN_ARCHITECTURE(WIN)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -280,6 +280,8 @@
</span><span class="cx">
</span><span class="cx"> virtual WebCore::AudioHardwareActivityType audioHardwareActivity() const { return WebCore::AudioHardwareActivityType::Unknown; }
</span><span class="cx">
</span><ins>+ virtual void mutedStateChanged(bool) { }
+
</ins><span class="cx"> protected:
</span><span class="cx"> Plugin();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -84,6 +84,9 @@
</span><span class="cx">
</span><span class="cx"> // Called by the Netscape plug-in when it starts or stops playing audio.
</span><span class="cx"> virtual void setPluginIsPlayingAudio(bool) = 0;
</span><ins>+
+ // Returns whether the plugin should be muted.
+ virtual bool isMuted() const = 0;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // Set the statusbar text.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -104,6 +104,7 @@
</span><span class="cx"> m_pendingPluginCreationParameters->userAgent = controller()->userAgent();
</span><span class="cx"> m_pendingPluginCreationParameters->contentsScaleFactor = contentsScaleFactor();
</span><span class="cx"> m_pendingPluginCreationParameters->isPrivateBrowsingEnabled = controller()->isPrivateBrowsingEnabled();
</span><ins>+ m_pendingPluginCreationParameters->isMuted = controller()->isMuted();
</ins><span class="cx"> m_pendingPluginCreationParameters->artificialPluginInitializationDelayEnabled = controller()->artificialPluginInitializationDelayEnabled();
</span><span class="cx"> m_pendingPluginCreationParameters->isAcceleratedCompositingEnabled = controller()->isAcceleratedCompositingEnabled();
</span><span class="cx">
</span><span class="lines">@@ -526,6 +527,11 @@
</span><span class="cx"> m_connection->connection()->send(Messages::PluginControllerProxy::PrivateBrowsingStateChanged(isPrivateBrowsingEnabled), m_pluginInstanceID);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void PluginProxy::mutedStateChanged(bool isMuted)
+{
+ m_connection->connection()->send(Messages::PluginControllerProxy::MutedStateChanged(isMuted), m_pluginInstanceID);
+}
+
</ins><span class="cx"> bool PluginProxy::getFormValue(String& formValue)
</span><span class="cx"> {
</span><span class="cx"> bool returnValue;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx"> virtual void contentsScaleFactorChanged(float);
</span><span class="cx"> virtual void storageBlockingStateChanged(bool);
</span><span class="cx"> virtual void privateBrowsingStateChanged(bool);
</span><ins>+ virtual void mutedStateChanged(bool) override;
</ins><span class="cx"> virtual bool getFormValue(String& formValue);
</span><span class="cx"> virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
</span><span class="cx"> virtual WebCore::Scrollbar* horizontalScrollbar();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -1331,7 +1331,11 @@
</span><span class="cx">
</span><span class="cx"> void PluginView::pageMutedStateDidChange()
</span><span class="cx"> {
</span><del>- // FIXME: To be implemented (https://bugs.webkit.org/show_bug.cgi?id=138105).
</del><ins>+ // The plug-in can be null here if it failed to initialize.
+ if (!m_isInitialized || !m_plugin)
+ return;
+
+ m_plugin->mutedStateChanged(isMuted());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PluginView::isPluginVisible()
</span><span class="lines">@@ -1452,6 +1456,14 @@
</span><span class="cx"> m_pluginIsPlayingAudio = pluginIsPlayingAudio;
</span><span class="cx"> m_pluginElement->document().updateIsPlayingAudio();
</span><span class="cx"> }
</span><ins>+
+bool PluginView::isMuted() const
+{
+ if (!frame() || !frame()->page())
+ return false;
+
+ return frame()->page()->isMuted();
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void PluginView::setStatusbarText(const String& statusbarText)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -196,6 +196,7 @@
</span><span class="cx"> virtual NPObject* pluginElementNPObject() override;
</span><span class="cx"> virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups) override;
</span><span class="cx"> virtual void setPluginIsPlayingAudio(bool) override;
</span><ins>+ virtual bool isMuted() const override;
</ins><span class="cx"> #endif
</span><span class="cx"> virtual void setStatusbarText(const String&) override;
</span><span class="cx"> virtual bool isAcceleratedCompositingEnabled() override;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Tools/ChangeLog        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-11-05 Ada Chan <adachan@apple.com>
+
+ Implement new plug-in API for muting plug-ins
+ https://bugs.webkit.org/show_bug.cgi?id=138105
+
+ Reviewed by Anders Carlsson.
+
+ Add a new plug-in test for the mute API.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp: Added.
+ (SetMuted::SetMuted):
+ (SetMuted::isMuted):
+ (SetMuted::cachedIsMuted):
+ (SetMuted::ScriptableObject::hasProperty):
+ (SetMuted::ScriptableObject::getProperty):
+ (SetMuted::ScriptableObject::pluginTest):
+ (SetMuted::NPP_New):
+ (SetMuted::NPP_GetValue):
+ (SetMuted::NPP_SetValue):
+
</ins><span class="cx"> 2014-11-12 Philippe Normand <pnormand@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, GTK gardening.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (176038 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2014-11-12 21:55:18 UTC (rev 176038)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx">                 515F429C15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */; };
</span><span class="cx">                 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; };
</span><span class="cx">                 51CACBD815D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CACBD715D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp */; };
</span><ins>+                520206CF1A0ADA5900AD5154 /* SetMuted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520206CE1A0ADA5900AD5154 /* SetMuted.cpp */; };
</ins><span class="cx">                 53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */; };
</span><span class="cx">                 5DB9AC970F722C3600684641 /* AHEM____.TTF in Copy Font Files */ = {isa = PBXBuildFile; fileRef = AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */; };
</span><span class="cx">                 5DB9AC980F722C3600684641 /* WebKitWeightWatcher100.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */; };
</span><span class="lines">@@ -264,6 +265,7 @@
</span><span class="cx">                 5185F69E10714A57007AA393 /* HistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryDelegate.h; path = mac/HistoryDelegate.h; sourceTree = "<group>"; };
</span><span class="cx">                 5185F69F10714A57007AA393 /* HistoryDelegate.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = HistoryDelegate.mm; path = mac/HistoryDelegate.mm; sourceTree = "<group>"; };
</span><span class="cx">                 51CACBD715D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EvaluateJSWithinNPP_New.cpp; path = TestNetscapePlugIn/Tests/EvaluateJSWithinNPP_New.cpp; sourceTree = SOURCE_ROOT; };
</span><ins>+                520206CE1A0ADA5900AD5154 /* SetMuted.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetMuted.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CyclicRedundancyCheck.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 53CBB831134E42F3001CE6A4 /* CyclicRedundancyCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CyclicRedundancyCheck.h; sourceTree = "<group>"; };
</span><span class="cx">                 5DE8AE4313A2C15800D6A37D /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -573,6 +575,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */,
</span><span class="cx">                                 1A31EB3713466AC100017372 /* ConvertPoint.cpp */,
</span><ins>+                                520206CE1A0ADA5900AD5154 /* SetMuted.cpp */,
</ins><span class="cx">                                 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */,
</span><span class="cx">                         );
</span><span class="cx">                         path = mac;
</span><span class="lines">@@ -900,6 +903,7 @@
</span><span class="cx">                                 51CACBD815D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp in Sources */,
</span><span class="cx">                                 4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */,
</span><span class="cx">                                 1AFF66BC137DEFD200791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp in Sources */,
</span><ins>+                                520206CF1A0ADA5900AD5154 /* SetMuted.cpp in Sources */,
</ins><span class="cx">                                 1A5CC1F5137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp in Sources */,
</span><span class="cx">                                 1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */,
</span><span class="cx">                                 1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestNetscapePlugInTestsmacSetMutedcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp (0 => 176039)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp         (rev 0)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp        2014-11-12 22:12:33 UTC (rev 176039)
</span><span class="lines">@@ -0,0 +1,106 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginTest.h"
+
+using namespace std;
+
+class SetMuted : public PluginTest {
+public:
+ SetMuted(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ , m_cachedIsMuted(false)
+ {
+ }
+
+private:
+ bool isMuted()
+ {
+ NPBool muted = FALSE;
+ NPN_GetValue(NPNVmuteAudioBool, &muted);
+ return muted;
+ }
+
+ bool cachedIsMuted()
+ {
+ return m_cachedIsMuted;
+ }
+
+ class ScriptableObject : public Object<ScriptableObject> {
+ public:
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ return identifierIs(propertyName, "isMuted")
+ || identifierIs(propertyName, "cachedIsMuted");
+ }
+
+ bool getProperty(NPIdentifier propertyName, NPVariant* result)
+ {
+ if (identifierIs(propertyName, "isMuted")) {
+ BOOLEAN_TO_NPVARIANT(pluginTest()->isMuted(), *result);
+ return true;
+ }
+ if (identifierIs(propertyName, "cachedIsMuted")) {
+ BOOLEAN_TO_NPVARIANT(pluginTest()->cachedIsMuted(), *result);
+ return true;
+ }
+ return false;
+ }
+
+ private:
+ SetMuted* pluginTest() const { return static_cast<SetMuted*>(Object<ScriptableObject>::pluginTest()); }
+ };
+
+ virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved)
+ {
+ m_cachedIsMuted = isMuted();
+ return NPERR_NO_ERROR;
+ }
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void* value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = ScriptableObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+
+ virtual NPError NPP_SetValue(NPNVariable variable, void* value)
+ {
+ switch (variable) {
+ case NPNVmuteAudioBool:
+ m_cachedIsMuted = *(NPBool*)value;
+ return NPERR_NO_ERROR;
+ default:
+ return NPERR_GENERIC_ERROR;
+ }
+
+ }
+ bool m_cachedIsMuted;
+};
+
+static PluginTest::Register<SetMuted> setMuted("set-muted");
</ins></span></pre>
</div>
</div>
</body>
</html>