Bug 727421 - Implement full screen support for Flash on Android r=blassey
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* 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/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "assert.h"
|
||||
#include "ANPBase.h"
|
||||
#include <android/log.h>
|
||||
@@ -11,12 +12,20 @@
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsPluginInstanceOwner.h"
|
||||
#include "nsWindow.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
|
||||
#define ASSIGN(obj, name) (obj)->name = anp_window_##name
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static nsresult GetOwner(NPP instance, nsPluginInstanceOwner** owner) {
|
||||
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
||||
|
||||
return pinst->GetOwner((nsIPluginInstanceOwner**)owner);
|
||||
}
|
||||
|
||||
void
|
||||
anp_window_setVisibleRects(NPP instance, const ANPRectI rects[], int32_t count)
|
||||
@@ -54,13 +63,27 @@ anp_window_showKeyboard(NPP instance, bool value)
|
||||
void
|
||||
anp_window_requestFullScreen(NPP instance)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
||||
|
||||
nsRefPtr<nsPluginInstanceOwner> owner;
|
||||
if (NS_FAILED(GetOwner(instance, getter_AddRefs(owner)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->RequestFullScreen();
|
||||
}
|
||||
|
||||
void
|
||||
anp_window_exitFullScreen(NPP instance)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
||||
|
||||
nsRefPtr<nsPluginInstanceOwner> owner;
|
||||
if (NS_FAILED(GetOwner(instance, getter_AddRefs(owner)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->ExitFullScreen();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -69,12 +92,6 @@ anp_window_requestCenterFitZoom(NPP instance)
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
static nsresult GetOwner(NPP instance, nsPluginInstanceOwner** owner) {
|
||||
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
||||
|
||||
return pinst->GetOwner((nsIPluginInstanceOwner**)owner);
|
||||
}
|
||||
|
||||
ANPRectI
|
||||
anp_window_visibleRect(NPP instance)
|
||||
{
|
||||
@@ -98,7 +115,29 @@ anp_window_visibleRect(NPP instance)
|
||||
|
||||
void anp_window_requestFullScreenOrientation(NPP instance, ANPScreenOrientation orientation)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
short newOrientation;
|
||||
|
||||
// Convert to the ActivityInfo equivalent
|
||||
switch (orientation) {
|
||||
case kFixedLandscape_ANPScreenOrientation:
|
||||
newOrientation = eScreenOrientation_LandscapePrimary;
|
||||
break;
|
||||
case kFixedPortrait_ANPScreenOrientation:
|
||||
newOrientation = eScreenOrientation_PortraitPrimary;
|
||||
break;
|
||||
case kLandscape_ANPScreenOrientation:
|
||||
newOrientation = eScreenOrientation_Landscape;
|
||||
break;
|
||||
case kPortrait_ANPScreenOrientation:
|
||||
newOrientation = eScreenOrientation_Portrait;
|
||||
break;
|
||||
default:
|
||||
newOrientation = eScreenOrientation_None;
|
||||
break;
|
||||
}
|
||||
|
||||
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
||||
pinst->SetFullScreenOrientation(newOrientation);
|
||||
}
|
||||
|
||||
void InitWindowInterface(ANPWindowInterfaceV0 *i) {
|
||||
|
||||
Reference in New Issue
Block a user