Bug 759747 - Fix up fullscreen Flash handling on Android 4.0+ r=blassey

This commit is contained in:
James Willcox
2012-06-06 22:39:36 -04:00
parent 68eb3abaa0
commit bdd38c0d32
7 changed files with 132 additions and 23 deletions

View File

@@ -83,6 +83,7 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance()
mOnScreen(true),
mFullScreenOrientation(dom::eScreenOrientation_LandscapePrimary),
mWakeLocked(false),
mFullScreen(false),
#endif
mRunning(NOT_STARTED),
mWindowless(false),
@@ -760,10 +761,15 @@ void nsNPAPIPluginInstance::NotifyFullScreen(bool aFullScreen)
{
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::NotifyFullScreen this=%p\n",this));
if (RUNNING != mRunning)
if (RUNNING != mRunning || mFullScreen == aFullScreen)
return;
SendLifecycleEvent(this, aFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction);
mFullScreen = aFullScreen;
SendLifecycleEvent(this, mFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction);
if (mFullScreen && mFullScreenOrientation != dom::eScreenOrientation_None) {
AndroidBridge::Bridge()->LockScreenOrientation(mFullScreenOrientation);
}
}
void nsNPAPIPluginInstance::SetANPDrawingModel(PRUint32 aModel)
@@ -789,6 +795,27 @@ void nsNPAPIPluginInstance::PostEvent(void* event)
NS_DispatchToMainThread(r);
}
void nsNPAPIPluginInstance::SetFullScreenOrientation(PRUint32 orientation)
{
if (mFullScreenOrientation == orientation)
return;
PRUint32 oldOrientation = mFullScreenOrientation;
mFullScreenOrientation = orientation;
if (mFullScreen) {
// We're already fullscreen so immediately apply the orientation change
if (mFullScreenOrientation != dom::eScreenOrientation_None) {
AndroidBridge::Bridge()->LockScreenOrientation(mFullScreenOrientation);
} else if (oldOrientation != dom::eScreenOrientation_None) {
// We applied an orientation when we entered fullscreen, but
// we don't want it anymore
AndroidBridge::Bridge()->UnlockScreenOrientation();
}
}
}
void nsNPAPIPluginInstance::PopPostedEvent(PluginEventRunnable* r)
{
mPostedEvents.RemoveElement(r);