зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1167690 - Part 1: Hook up NPPVpluginIsPlayingAudio to the plugin process; r=josh
This commit is contained in:
Родитель
c34722a98d
Коммит
61e92462cb
|
@ -2402,6 +2402,27 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
|
|||
return inst->SetUsesDOMForCursor(useDOMForCursor);
|
||||
}
|
||||
|
||||
case NPPVpluginIsPlayingAudio: {
|
||||
// For testing, remove me
|
||||
printf("set audio %p\n", result);
|
||||
bool isPlaying = !!result;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetDocumentFromNPP(npp);
|
||||
if (doc) {
|
||||
nsCOMPtr<nsPIDOMWindow> domwindow = doc->GetWindow();
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
// XXX THIS NEEDS A BETTER API
|
||||
observerService->NotifyObservers(ToSupports(domwindow),
|
||||
"media-playback",
|
||||
isPlaying ? NS_LITERAL_STRING("active").get() :
|
||||
NS_LITERAL_STRING("inactive").get());
|
||||
}
|
||||
}
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
// On android, their 'drawing model' uses the same constant!
|
||||
case NPPVpluginDrawingModel: {
|
||||
|
|
|
@ -150,6 +150,8 @@ parent:
|
|||
returns (NPError result);
|
||||
intr NPN_SetValue_NPPVpluginEventModel(int eventModel)
|
||||
returns (NPError result);
|
||||
intr NPN_SetValue_NPPVpluginIsPlayingAudio(bool isAudioPlaying)
|
||||
returns (NPError result);
|
||||
|
||||
intr NPN_GetURL(nsCString url, nsCString target)
|
||||
returns (NPError result);
|
||||
|
|
|
@ -626,6 +626,14 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
|
|||
}
|
||||
#endif
|
||||
|
||||
case NPPVpluginIsPlayingAudio: {
|
||||
NPError rv = NPERR_GENERIC_ERROR;
|
||||
if (!CallNPN_SetValue_NPPVpluginIsPlayingAudio((NPBool)(intptr_t)aValue, &rv)) {
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
default:
|
||||
MOZ_LOG(GetPluginLog(), LogLevel::Warning,
|
||||
("In PluginInstanceChild::NPN_SetValue: Unhandled NPPVariable %i (%s)",
|
||||
|
|
|
@ -440,6 +440,15 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginEventModel(
|
|||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginIsPlayingAudio(
|
||||
const bool& isAudioPlaying, NPError* result)
|
||||
{
|
||||
*result = mNPNIface->setvalue(mNPP, NPPVpluginIsPlayingAudio,
|
||||
(void*)(intptr_t)isAudioPlaying);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceParent::AnswerNPN_GetURL(const nsCString& url,
|
||||
const nsCString& target,
|
||||
|
|
|
@ -128,6 +128,9 @@ public:
|
|||
virtual bool
|
||||
AnswerNPN_SetValue_NPPVpluginEventModel(const int& eventModel,
|
||||
NPError* result) override;
|
||||
virtual bool
|
||||
AnswerNPN_SetValue_NPPVpluginIsPlayingAudio(const bool& isAudioPlaying,
|
||||
NPError* result) override;
|
||||
|
||||
virtual bool
|
||||
AnswerNPN_GetURL(const nsCString& url, const nsCString& target,
|
||||
|
|
Загрузка…
Ссылка в новой задаче