summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp8
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h2
-rw-r--r--Source/WebKit/android/plugins/ANPWindowInterface.cpp14
-rw-r--r--Source/WebKit/android/plugins/PluginWidgetAndroid.cpp35
-rw-r--r--Source/WebKit/android/plugins/PluginWidgetAndroid.h3
-rw-r--r--Source/WebKit/android/plugins/android_npapi.h33
6 files changed, 89 insertions, 6 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index ded3965..601d4ee 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -391,7 +391,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;I)V");
m_javaGlue->m_formDidBlur = GetJMethod(env, clazz, "formDidBlur", "(I)V");
m_javaGlue->m_getPluginClass = GetJMethod(env, clazz, "getPluginClass", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Class;");
- m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/ViewManager$ChildView;I)V");
+ m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/ViewManager$ChildView;II)V");
m_javaGlue->m_hideFullScreenPlugin = GetJMethod(env, clazz, "hideFullScreenPlugin", "()V");
m_javaGlue->m_createSurface = GetJMethod(env, clazz, "createSurface", "(Landroid/view/View;)Landroid/webkit/ViewManager$ChildView;");
m_javaGlue->m_addSurface = GetJMethod(env, clazz, "addSurface", "(Landroid/view/View;IIII)Landroid/webkit/ViewManager$ChildView;");
@@ -3619,14 +3619,16 @@ jclass WebViewCore::getPluginClass(const WTF::String& libName, const char* class
}
}
-void WebViewCore::showFullScreenPlugin(jobject childView, NPP npp)
+void WebViewCore::showFullScreenPlugin(jobject childView, int32_t orientation, NPP npp)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject javaObject = m_javaGlue->object(env);
if (!javaObject.get())
return;
- env->CallVoidMethod(javaObject.get(), m_javaGlue->m_showFullScreenPlugin, childView, reinterpret_cast<int>(npp));
+ env->CallVoidMethod(javaObject.get(),
+ m_javaGlue->m_showFullScreenPlugin,
+ childView, orientation, reinterpret_cast<int>(npp));
checkException(env);
}
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 0e9d80f..0dd45da 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -470,7 +470,7 @@ namespace android {
jclass getPluginClass(const WTF::String& libName, const char* className);
// Creates a full screen surface for a plugin
- void showFullScreenPlugin(jobject webkitPlugin, NPP npp);
+ void showFullScreenPlugin(jobject webkitPlugin, int32_t orientation, NPP npp);
// Instructs the UI thread to discard the plugin's full-screen surface
void hideFullScreenPlugin();
diff --git a/Source/WebKit/android/plugins/ANPWindowInterface.cpp b/Source/WebKit/android/plugins/ANPWindowInterface.cpp
index a74616c..cac8f8c 100644
--- a/Source/WebKit/android/plugins/ANPWindowInterface.cpp
+++ b/Source/WebKit/android/plugins/ANPWindowInterface.cpp
@@ -79,6 +79,12 @@ static ANPRectI anp_visibleRect(NPP instance) {
return pluginWidget->visibleRect();
}
+static void anp_requestFullScreenOrientation(NPP instance, ANPScreenOrientation orientation) {
+ PluginView* pluginView = pluginViewForInstance(instance);
+ PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
+ pluginWidget->setFullScreenOrientation(orientation);
+}
+
///////////////////////////////////////////////////////////////////////////////
#define ASSIGN(obj, name) (obj)->name = anp_##name
@@ -101,3 +107,11 @@ void ANPWindowInterfaceV1_Init(ANPInterface* value) {
ANPWindowInterfaceV1* i = reinterpret_cast<ANPWindowInterfaceV1*>(value);
ASSIGN(i, visibleRect);
}
+
+void ANPWindowInterfaceV2_Init(ANPInterface* value) {
+ // initialize the functions from the previous interface
+ ANPWindowInterfaceV1_Init(value);
+ // add any new functions or override existing functions
+ ANPWindowInterfaceV2* i = reinterpret_cast<ANPWindowInterfaceV2*>(value);
+ ASSIGN(i, requestFullScreenOrientation);
+}
diff --git a/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp b/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp
index b8a10cc..19433ab 100644
--- a/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -45,7 +45,7 @@
#include "android_graphics.h"
#include <JNIUtility.h>
-// #define PLUGIN_DEBUG_LOCAL // controls the printing of log messages
+#define PLUGIN_DEBUG_LOCAL // controls the printing of log messages
#define DEBUG_EVENTS 0 // logs event contents, return value, and processing time
#define DEBUG_VISIBLE_RECTS 0 // temporary debug printfs and fixes
@@ -73,6 +73,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view)
m_isSurfaceClippedOut = false;
m_layer = 0;
m_powerState = kDefault_ANPPowerState;
+ m_fullScreenOrientation = -1;
}
PluginWidgetAndroid::~PluginWidgetAndroid() {
@@ -630,7 +631,8 @@ void PluginWidgetAndroid::requestFullScreen() {
m_core->destroySurface(m_embeddedView);
// add the full screen view
- m_core->showFullScreenPlugin(m_embeddedView, m_pluginView->instance());
+ m_core->showFullScreenPlugin(m_embeddedView, m_fullScreenOrientation,
+ m_pluginView->instance());
m_isFullScreen = true;
}
@@ -658,6 +660,35 @@ void PluginWidgetAndroid::exitFullScreen(bool pluginInitiated) {
m_isFullScreen = false;
}
+void PluginWidgetAndroid::setFullScreenOrientation(ANPScreenOrientation orientation) {
+
+ int internalOrienationId;
+ /* We need to validate that the input is legitimate and then convert the
+ * value from the plugin enum to the enum used by the android view system.
+ * The view system values correspond to those values for the
+ * screenOrientation attribute in R.java (see also ActivityInfo.java).
+ */
+ switch (orientation) {
+ case kFixedLandscape_ANPScreenOrientation:
+ internalOrienationId = 0;
+ break;
+ case kFixedPortrait_ANPScreenOrientation:
+ internalOrienationId = 1;
+ break;
+ case kLandscape_ANPScreenOrientation:
+ internalOrienationId = 6;
+ break;
+ case kPortrait_ANPScreenOrientation:
+ internalOrienationId = 7;
+ break;
+ default:
+ internalOrienationId = -1;
+ }
+
+ PLUGIN_LOG("%s orientation (%d)", __FUNCTION__, internalOrienationId);
+ m_fullScreenOrientation = internalOrienationId;
+}
+
void PluginWidgetAndroid::requestCenterFitZoom() {
m_core->centerFitRect(m_pluginWindow->x, m_pluginWindow->y,
m_pluginWindow->width, m_pluginWindow->height);
diff --git a/Source/WebKit/android/plugins/PluginWidgetAndroid.h b/Source/WebKit/android/plugins/PluginWidgetAndroid.h
index 5d586b1..cbebb7f 100644
--- a/Source/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/Source/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -150,6 +150,8 @@ struct PluginWidgetAndroid {
bool inFullScreen() { return m_isFullScreen; }
+ void setFullScreenOrientation(ANPScreenOrientation orientation);
+
/** Called to check if a plugin currently has document focus, which is
required for certain operations (e.g. show/hide keyboard). It returns
true if the plugin currently has focus and false otherwise.
@@ -204,6 +206,7 @@ private:
bool m_acceptEvents;
bool m_isSurfaceClippedOut;
ANPPowerState m_powerState;
+ int m_fullScreenOrientation;
/* We limit the number of rectangles to minimize storage and ensure adequate
speed.
diff --git a/Source/WebKit/android/plugins/android_npapi.h b/Source/WebKit/android/plugins/android_npapi.h
index b0c3765..4ff45c8 100644
--- a/Source/WebKit/android/plugins/android_npapi.h
+++ b/Source/WebKit/android/plugins/android_npapi.h
@@ -127,6 +127,7 @@ typedef uint32_t ANPMatrixFlag;
#define kSystemInterfaceV1_ANPGetValue ((NPNVariable)1016)
#define kSystemInterfaceV2_ANPGetValue ((NPNVariable)1017)
+#define kWindowInterfaceV2_ANPGetValue ((NPNVariable)1018)
/** queries for the drawing models supported on this device.
@@ -695,6 +696,38 @@ struct ANPWindowInterfaceV1 : ANPWindowInterfaceV0 {
ANPRectI (*visibleRect)(NPP instance);
};
+enum ANPScreenOrientations {
+ /** No preference specified: let the system decide the best orientation.
+ */
+ kDefault_ANPScreenOrientation = 0,
+ /** Would like to have the screen in a landscape orientation, but it will
+ not allow for 180 degree rotations.
+ */
+ kFixedLandscape_ANPScreenOrientation = 1,
+ /** Would like to have the screen in a portrait orientation, but it will
+ not allow for 180 degree rotations.
+ */
+ kFixedPortrait_ANPScreenOrientation = 2,
+ /** Would like to have the screen in landscape orientation, but can use the
+ sensor to change which direction the screen is facing.
+ */
+ kLandscape_ANPScreenOrientation = 3,
+ /** Would like to have the screen in portrait orientation, but can use the
+ sensor to change which direction the screen is facing.
+ */
+ kPortrait_ANPScreenOrientation = 4
+};
+typedef int32_t ANPScreenOrientation;
+
+struct ANPWindowInterfaceV2 : ANPWindowInterfaceV1 {
+ /** Called when the plugin wants to specify a particular screen orientation
+ when entering into full screen mode. The orientation must be set prior
+ to entering into full screen. After entering full screen any subsequent
+ changes will be updated the next time the plugin goes full screen.
+ */
+ void (*requestFullScreenOrientation)(NPP instance, ANPScreenOrientation orientation);
+};
+
///////////////////////////////////////////////////////////////////////////////
enum ANPSampleFormats {