Bug 727421 - Implement full screen support for Flash on Android r=blassey
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// For ScreenOrientation.h
|
||||
#include "base/basictypes.h"
|
||||
#endif
|
||||
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
#include "nscore.h"
|
||||
@@ -35,6 +40,7 @@
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "AndroidBridge.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
|
||||
class PluginEventRunnable : public nsRunnable
|
||||
{
|
||||
@@ -74,6 +80,7 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance()
|
||||
mSurface(nsnull),
|
||||
mANPDrawingModel(0),
|
||||
mOnScreen(true),
|
||||
mFullScreenOrientation(dom::eScreenOrientation_LandscapePrimary),
|
||||
#endif
|
||||
mRunning(NOT_STARTED),
|
||||
mWindowless(false),
|
||||
@@ -743,63 +750,29 @@ void nsNPAPIPluginInstance::MemoryPressure()
|
||||
SendLifecycleEvent(this, kFreeMemory_ANPLifecycleAction);
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::NotifyFullScreen(bool aFullScreen)
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::NotifyFullScreen this=%p\n",this));
|
||||
|
||||
if (RUNNING != mRunning)
|
||||
return;
|
||||
|
||||
SendLifecycleEvent(this, aFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction);
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::SetANPDrawingModel(PRUint32 aModel)
|
||||
{
|
||||
mANPDrawingModel = aModel;
|
||||
}
|
||||
|
||||
class SurfaceGetter : public nsRunnable {
|
||||
public:
|
||||
SurfaceGetter(nsNPAPIPluginInstance* aInstance, NPPluginFuncs* aPluginFunctions, NPP_t aNPP) :
|
||||
mInstance(aInstance), mPluginFunctions(aPluginFunctions), mNPP(aNPP) {
|
||||
}
|
||||
~SurfaceGetter() {
|
||||
}
|
||||
nsresult Run() {
|
||||
void* surface;
|
||||
(*mPluginFunctions->getvalue)(&mNPP, kJavaSurface_ANPGetValue, &surface);
|
||||
mInstance->SetJavaSurface(surface);
|
||||
return NS_OK;
|
||||
}
|
||||
void RequestSurface() {
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
if (!mozilla::AndroidBridge::Bridge()) {
|
||||
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance null AndroidBridge"));
|
||||
return;
|
||||
}
|
||||
mozilla::AndroidBridge::Bridge()->PostToJavaThread(env, this);
|
||||
}
|
||||
private:
|
||||
nsNPAPIPluginInstance* mInstance;
|
||||
NPP_t mNPP;
|
||||
NPPluginFuncs* mPluginFunctions;
|
||||
};
|
||||
|
||||
|
||||
void* nsNPAPIPluginInstance::GetJavaSurface()
|
||||
{
|
||||
if (mANPDrawingModel != kSurface_ANPDrawingModel)
|
||||
void* surface = nsnull;
|
||||
nsresult rv = GetValueFromPlugin(kJavaSurface_ANPGetValue, &surface);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
return mSurface;
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::SetJavaSurface(void* aSurface)
|
||||
{
|
||||
mSurface = aSurface;
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::RequestJavaSurface()
|
||||
{
|
||||
if (mSurfaceGetter.get())
|
||||
return;
|
||||
|
||||
mSurfaceGetter = new SurfaceGetter(this, mPlugin->PluginFuncs(), mNPP);
|
||||
|
||||
((SurfaceGetter*)mSurfaceGetter.get())->RequestSurface();
|
||||
return surface;
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::PostEvent(void* event)
|
||||
|
||||
Reference in New Issue
Block a user