Implement new plug-in API for muting plug-ins
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Nov 2014 22:12:33 +0000 (22:12 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Nov 2014 22:12:33 +0000 (22:12 +0000)
commit2c63268ab32d45ef4d0694f3ab181334a4560f1a
treea80e3a0462e51d9ffa3de4034850ee1a6f5d3573
parenta851422907af815f47653acfa734c6e90de539a5
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/plugins/muted-state-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/plugins/muted-state.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/plugins/npapi.h
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/PluginControllerProxy.cpp
Source/WebKit2/PluginProcess/PluginControllerProxy.h
Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in
Source/WebKit2/PluginProcess/PluginCreationParameters.cpp
Source/WebKit2/PluginProcess/PluginCreationParameters.h
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
Source/WebKit2/WebProcess/Plugins/Plugin.h
Source/WebKit2/WebProcess/Plugins/PluginController.h
Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginProxy.h
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.h
Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SetMuted.cpp [new file with mode: 0644]