Bug 1167690 - Part 3: Hook up NPNVmuteAudioBool to the plugin process; r=josh

This commit is contained in:
Ehsan Akhgari 2015-07-27 00:05:10 -04:00
parent 3b6bd2528b
commit d9c418a0cc
4 changed files with 26 additions and 1 deletions

View File

@ -87,6 +87,8 @@ child:
intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
returns (nsCString plug_id, NPError result);
intr NPP_SetValue_NPNVmuteAudioBool(bool muted) returns (NPError result);
intr NPP_HandleEvent(NPRemoteEvent event)
returns (int16_t handled);
// special cases where we need to a shared memory buffer

View File

@ -773,6 +773,20 @@ PluginInstanceChild::AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value,
return true;
}
bool
PluginInstanceChild::AnswerNPP_SetValue_NPNVmuteAudioBool(const bool& value,
NPError* result)
{
if (!mPluginIface->setvalue) {
*result = NPERR_GENERIC_ERROR;
return true;
}
NPBool v = value;
*result = mPluginIface->setvalue(GetNPP(), NPNVmuteAudioBool, &v);
return true;
}
bool
PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
int16_t* handled)

View File

@ -80,6 +80,8 @@ protected:
NPError* aResult) override;
virtual bool
AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value, NPError* result) override;
virtual bool
AnswerNPP_SetValue_NPNVmuteAudioBool(const bool& value, NPError* result) override;
virtual bool
AnswerNPP_HandleEvent(const NPRemoteEvent& event, int16_t* handled) override;

View File

@ -1151,15 +1151,22 @@ PluginInstanceParent::NPP_GetValue(NPPVariable aVariable,
NPError
PluginInstanceParent::NPP_SetValue(NPNVariable variable, void* value)
{
NPError result;
switch (variable) {
case NPNVprivateModeBool:
NPError result;
if (!CallNPP_SetValue_NPNVprivateModeBool(*static_cast<NPBool*>(value),
&result))
return NPERR_GENERIC_ERROR;
return result;
case NPNVmuteAudioBool:
if (!CallNPP_SetValue_NPNVmuteAudioBool(*static_cast<NPBool*>(value),
&result))
return NPERR_GENERIC_ERROR;
return result;
default:
NS_ERROR("Unhandled NPNVariable in NPP_SetValue");
MOZ_LOG(GetPluginLog(), LogLevel::Warning,