summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/plugins/android')
-rw-r--r--WebCore/plugins/android/PluginClient.h2
-rw-r--r--WebCore/plugins/android/PluginDataAndroid.cpp42
-rw-r--r--WebCore/plugins/android/PluginPackageAndroid.cpp100
-rw-r--r--WebCore/plugins/android/PluginViewAndroid.cpp210
4 files changed, 165 insertions, 189 deletions
diff --git a/WebCore/plugins/android/PluginClient.h b/WebCore/plugins/android/PluginClient.h
index f858eb8..e3f7ddf 100644
--- a/WebCore/plugins/android/PluginClient.h
+++ b/WebCore/plugins/android/PluginClient.h
@@ -13,7 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
diff --git a/WebCore/plugins/android/PluginDataAndroid.cpp b/WebCore/plugins/android/PluginDataAndroid.cpp
index 23bed89..698f2ac 100644
--- a/WebCore/plugins/android/PluginDataAndroid.cpp
+++ b/WebCore/plugins/android/PluginDataAndroid.cpp
@@ -1,23 +1,29 @@
/*
* Copyright 2009, The Android Open Source Project
- Copyright (C) 2008 Trolltech ASA
- Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Trolltech ASA
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#include "config.h"
#include "PluginData.h"
diff --git a/WebCore/plugins/android/PluginPackageAndroid.cpp b/WebCore/plugins/android/PluginPackageAndroid.cpp
index e3c0e56..d55da87 100644
--- a/WebCore/plugins/android/PluginPackageAndroid.cpp
+++ b/WebCore/plugins/android/PluginPackageAndroid.cpp
@@ -5,45 +5,44 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * 1. Redistributions of source code must retain the above copyright
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
+ * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef ANDROID_PLUGINS
-
-#define LOG_TAG "WebKit"
-
#include "config.h"
-#include "PluginDatabase.h"
#include "PluginPackage.h"
-#include "Timer.h"
+#ifdef ANDROID_PLUGINS
+
+#include "CString.h"
+#include "JNIUtility.h"
#include "PlatformString.h"
+#include "PluginDatabase.h"
+#include "PluginDebug.h"
+#include "PluginDebugAndroid.h"
#include "PluginMainThreadScheduler.h"
-#include "CString.h"
-#include "jni_utility.h"
-#include "npruntime_impl.h"
+#include "Timer.h"
#include "npfunctions.h"
+#include "npruntime_impl.h"
#include <dlfcn.h>
#include <errno.h>
-#include "PluginDebug.h"
-#include "PluginDebugAndroid.h"
+#define LOG_TAG "WebKit"
namespace WebCore {
@@ -107,17 +106,6 @@ static bool getEntryPoint(PlatformModule module,
}
}
-int PluginPackage::compareFileVersion(
- const PlatformModuleVersion& compareVersion) const
-{
- // return -1, 0, or 1 if plug-in version is less than, equal to,
- // or greater than the passed version
- if (m_moduleVersion != compareVersion)
- return m_moduleVersion > compareVersion ? 1 : -1;
- else
- return 0;
-}
-
bool PluginPackage::isPluginBlacklisted()
{
// No blacklisted Android plugins... yet!
@@ -199,45 +187,6 @@ static void initializeExtraBrowserFuncs(NPNetscapeFuncs *funcs)
funcs->enumerate = _NPN_Enumerate;
}
-static jobject createPluginObject(const char *name,
- const char *path,
- const char *fileName,
- const char *description)
-{
- JNIEnv *env = JSC::Bindings::getJNIEnv();
- // Create a Java "class Plugin" object instance
- jclass pluginClass = env->FindClass("android/webkit/Plugin");
- if(!pluginClass) {
- PLUGIN_LOG("Couldn't find class android.webkit.Plugin\n");
- return 0;
- }
- // Get Plugin(String, String, String, String, Context)
- jmethodID pluginConstructor = env->GetMethodID(
- pluginClass,
- "<init>",
- "(Ljava/lang/String;"
- "Ljava/lang/String;"
- "Ljava/lang/String;"
- "Ljava/lang/String;)V");
- if(!pluginConstructor) {
- PLUGIN_LOG("Couldn't get android.webkit.Plugin constructor\n");
- return 0;
- }
- // Make Java strings of name, path, fileName, description
- jstring javaName = env->NewStringUTF(name);
- jstring javaPath = env->NewStringUTF(path);
- jstring javaFileName = env->NewStringUTF(fileName);
- jstring javaDescription = env->NewStringUTF(description);
- // Make a plugin instance
- jobject pluginObject = env->NewObject(pluginClass,
- pluginConstructor,
- javaName,
- javaPath,
- javaFileName,
- javaDescription);
- return pluginObject;
-}
-
bool PluginPackage::load()
{
PLUGIN_LOG("tid:%d isActive:%d isLoaded:%d loadCount:%d\n",
@@ -295,8 +244,7 @@ bool PluginPackage::load()
m_pluginFuncs.size = sizeof(m_pluginFuncs);
if(NP_Initialize(&m_browserFuncs,
&m_pluginFuncs,
- JSC::Bindings::getJNIEnv(),
- m_pluginObject) != NPERR_NO_ERROR) {
+ JSC::Bindings::getJNIEnv()) != NPERR_NO_ERROR) {
PLUGIN_LOG("Couldn't initialize plugin\n");
return false;
}
@@ -404,22 +352,6 @@ bool PluginPackage::fetchInfo()
m_mimeToDescriptions.set(mimeType, description);
}
- // Create a new Java Plugin object, this object is an instance of
- // android.os.WebView.Plugin
- CString path = m_path.utf8();
- CString filename = m_fileName.utf8();
- jobject pluginObject = createPluginObject(name,
- path.data(),
- filename.data(),
- description);
- if(!pluginObject) {
- PLUGIN_LOG("Couldn't create Java Plugin\n");
- return false;
- }
-
- // Retain the Java Plugin object
- m_pluginObject = JSC::Bindings::getJNIEnv()->NewGlobalRef(pluginObject);
-
PLUGIN_LOG("Fetch Info Loaded plugin details ok \"%s\"\n",
m_path.utf8().data());
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp
index 7d10993..72fdf3f 100644
--- a/WebCore/plugins/android/PluginViewAndroid.cpp
+++ b/WebCore/plugins/android/PluginViewAndroid.cpp
@@ -5,16 +5,16 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * 1. Redistributions of source code must retain the above copyright
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
+ * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#define LOG_TAG "WebCore"
#include "config.h"
@@ -51,7 +52,9 @@
#include "PlatformKeyboardEvent.h"
#include "PluginMainThreadScheduler.h"
#include "PluginPackage.h"
+#include "Touch.h"
#include "TouchEvent.h"
+#include "TouchList.h"
#include "android_graphics.h"
#include "SkCanvas.h"
#include "npruntime_impl.h"
@@ -75,6 +78,7 @@
#include "android_npapi.h"
#include "ANPSurface_npapi.h"
+#include "ANPSystem_npapi.h"
#include "SkANP.h"
#include "SkFlipPixelRef.h"
@@ -83,6 +87,7 @@
extern void ANPAudioTrackInterfaceV0_Init(ANPInterface* value);
extern void ANPBitmapInterfaceV0_Init(ANPInterface* value);
extern void ANPCanvasInterfaceV0_Init(ANPInterface* value);
+extern void ANPEventInterfaceV0_Init(ANPInterface* value);
extern void ANPLogInterfaceV0_Init(ANPInterface* value);
extern void ANPMatrixInterfaceV0_Init(ANPInterface* value);
extern void ANPOffscreenInterfaceV0_Init(ANPInterface* value);
@@ -106,6 +111,7 @@ static const VarProcPair gVarProcs[] = {
{ VARPROCLINE(AudioTrackInterfaceV0) },
{ VARPROCLINE(BitmapInterfaceV0) },
{ VARPROCLINE(CanvasInterfaceV0) },
+ { VARPROCLINE(EventInterfaceV0) },
{ VARPROCLINE(LogInterfaceV0) },
{ VARPROCLINE(MatrixInterfaceV0) },
{ VARPROCLINE(PaintInterfaceV0) },
@@ -163,58 +169,16 @@ void PluginView::platformInit()
m_npWindow.window = 0;
}
-void PluginView::platformStart()
+bool PluginView::platformStart()
{
- notImplemented();
+ return true;
}
-PluginView::~PluginView()
+void PluginView::platformDestroy()
{
- stop();
-
- deleteAllValues(m_requests);
-
- freeStringArray(m_paramNames, m_paramCount);
- freeStringArray(m_paramValues, m_paramCount);
-
- m_parentFrame->script()->cleanupScriptObjectsForPlugin(this);
-
-// Since we have no legacy plugins to check, we ignore the quirks check
-// if (m_plugin && !m_plugin->quirks().contains(PluginQuirkDontUnloadPlugin))
- if (m_plugin) {
- m_plugin->unload();
- }
delete m_window;
}
-void PluginView::init()
-{
- if (m_haveInitialized)
- return;
- m_haveInitialized = true;
-
- android::WebViewCore* c = android::WebViewCore::getWebViewCore(this->parent());
- m_window->init(c);
-
- if (!m_plugin) {
- ASSERT(m_status == PluginStatusCanNotFindPlugin);
- return;
- }
-
- if (!m_plugin->load()) {
- m_plugin = 0;
- m_status = PluginStatusCanNotLoadPlugin;
- return;
- }
-
- if (!start()) {
- m_status = PluginStatusCanNotLoadPlugin;
- return;
- }
-
- m_status = PluginStatusLoadedSuccessfully;
-}
-
void PluginView::handleTouchEvent(TouchEvent* event)
{
if (!m_window->isAcceptingEvent(kTouch_ANPEventFlag))
@@ -223,6 +187,7 @@ void PluginView::handleTouchEvent(TouchEvent* event)
ANPEvent evt;
SkANP::InitEvent(&evt, kTouch_ANPEventType);
+ bool ignoreRet = false;
const AtomicString& type = event->type();
if (eventNames().touchstartEvent == type)
evt.data.touch.action = kDown_ANPTouchAction;
@@ -232,25 +197,44 @@ void PluginView::handleTouchEvent(TouchEvent* event)
evt.data.touch.action = kMove_ANPTouchAction;
else if (eventNames().touchcancelEvent == type)
evt.data.touch.action = kCancel_ANPTouchAction;
- else
+ else if (eventNames().touchlongpressEvent == type) {
+ evt.data.touch.action = kLongPress_ANPTouchAction;
+ ignoreRet = true;
+ } else if (eventNames().touchdoubletapEvent == type) {
+ evt.data.touch.action = kDoubleTap_ANPTouchAction;
+ ignoreRet = true;
+ } else
return;
evt.data.touch.modifiers = 0; // todo
- // convert to coordinates that are relative to the plugin. The pageX / pageY
- // values are the only values in the event that are consistently in frame
- // coordinates despite their misleading name.
- evt.data.touch.x = event->pageX() - m_npWindow.x;
- evt.data.touch.y = event->pageY() - m_npWindow.y;
+ // In the event of a touchend (up) event, we must ask the changedTouch for the
+ // co-ordinates as there is no touch in touches anymore.
+ TouchList* touches = (evt.data.touch.action == kUp_ANPTouchAction) ?
+ event->changedTouches() : event->touches();
- if (m_plugin->pluginFuncs()->event(m_instance, &evt)) {
+ // Convert to coordinates that are relative to the plugin.
+ // We only support single touch points at the moment, so we want to look at index 0 only.
+ IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(IntPoint(touches->item(0)->pageX(), touches->item(0)->pageY())));
+ evt.data.touch.x = localPos.x();
+ evt.data.touch.y = localPos.y();
+
+ int16 ret = m_plugin->pluginFuncs()->event(m_instance, &evt);
+ if (ignoreRet)
+ return;
+ if (ret & kHandleTouch_ANPTouchResult) {
// The plugin needs focus to receive keyboard events
if (evt.data.touch.action == kDown_ANPTouchAction) {
if (Page* page = m_parentFrame->page())
page->focusController()->setFocusedFrame(m_parentFrame);
m_parentFrame->document()->setFocusedNode(m_element);
}
- event->setDefaultPrevented(true);
+ event->preventDefault();
+ } else {
+ if (ret & kHandleLongPress_ANPTouchResult)
+ event->preventLongPress();
+ if (ret & kHandleDoubleTap_ANPTouchResult)
+ event->preventDoubleTap();
}
}
@@ -266,11 +250,11 @@ void PluginView::handleMouseEvent(MouseEvent* event)
SkANP::InitEvent(&evt, kMouse_ANPEventType);
evt.data.mouse.action = isUp ? kUp_ANPMouseAction : kDown_ANPMouseAction;
- // convert to coordinates that are relative to the plugin. The pageX / pageY
- // values are the only values in the event that are consistently in frame
- // coordinates despite their misleading name.
- evt.data.mouse.x = event->pageX() - m_npWindow.x;
- evt.data.mouse.y = event->pageY() - m_npWindow.y;
+ // Convert to coordinates that are relative to the plugin.
+ IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation()));
+ evt.data.mouse.x = localPos.x();
+ evt.data.mouse.y = localPos.y();
+
if (isDown) {
// The plugin needs focus to receive keyboard events
if (Page* page = m_parentFrame->page())
@@ -298,6 +282,20 @@ static ANPKeyModifier make_modifiers(bool shift, bool alt) {
return mod;
}
+void PluginView::handleFocusEvent(bool hasFocus)
+{
+ ANPEvent evt;
+ SkANP::InitEvent(&evt, kLifecycle_ANPEventType);
+ evt.data.lifecycle.action = hasFocus ? kGainFocus_ANPLifecycleAction :
+ kLoseFocus_ANPLifecycleAction;
+ m_window->sendEvent(evt);
+
+ // redraw the plugin which subsequently invalidates the nav cache
+ IntRect rect = IntRect(m_npWindow.x, m_npWindow.y,
+ m_npWindow.width, m_npWindow.height);
+ m_window->webViewCore()->contentInvalidate(rect);
+}
+
void PluginView::handleKeyboardEvent(KeyboardEvent* event)
{
if (!m_window->isAcceptingEvent(kKey_ANPEventFlag))
@@ -359,6 +357,13 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
if (m_plugin->pluginFuncs()->event(m_instance, &evt)) {
event->setDefaultHandled();
+ } else if (m_window->inFullScreen()){
+ // while in the full screen mode, always consumes the key events and
+ // keeps the document focus
+ event->setDefaultHandled();
+ } else {
+ // remove the plugin from the document's focus
+ m_parentFrame->document()->focusedNodeRemoved();
}
}
@@ -385,25 +390,45 @@ void PluginView::setParent(ScrollView* parent)
{
Widget::setParent(parent);
- if (parent)
+ if (parent) {
+ // the widget needs initialized now so that the plugin has access to
+ // WebViewCore when NPP_New is called
+ if (m_window && !m_window->webViewCore()) {
+ android::WebViewCore* c = android::WebViewCore::getWebViewCore(this->parent());
+ m_window->init(c);
+ }
init();
+ }
}
-void PluginView::setNPWindowRect(const IntRect& rect)
+void PluginView::setNPWindowRect(const IntRect&)
{
- if (!m_isStarted)
- return;
+ setNPWindowIfNeeded();
+}
- // the rect is relative to the frameview's (0,0)
- m_npWindow.x = rect.x();
- m_npWindow.y = rect.y();
- m_npWindow.width = rect.width();
- m_npWindow.height = rect.height();
+void PluginView::setNPWindowIfNeeded()
+{
+ if (!m_isStarted || !parent())
+ return;
- m_npWindow.clipRect.left = 0;
- m_npWindow.clipRect.top = 0;
- m_npWindow.clipRect.right = rect.width();
- m_npWindow.clipRect.bottom = rect.height();
+ // in Android, plugin always get the setwindow() in the page coordinate.
+ IntRect pageRect = m_windowRect;
+ ScrollView* top = parent();
+ while (top->parent())
+ top = top->parent();
+ // only the top ScrollView can have the offset
+ pageRect.move(top->scrollOffset());
+
+ // the m_npWindow is relative to the page
+ m_npWindow.x = pageRect.x();
+ m_npWindow.y = pageRect.y();
+ m_npWindow.width = pageRect.width();
+ m_npWindow.height = pageRect.height();
+
+ m_npWindow.clipRect.left = pageRect.x();
+ m_npWindow.clipRect.top = pageRect.y();
+ m_npWindow.clipRect.right = pageRect.x() + pageRect.width();
+ m_npWindow.clipRect.bottom = pageRect.y() + pageRect.height();
if (m_plugin->pluginFuncs()->setwindow) {
#if USE(JSC)
@@ -478,7 +503,13 @@ NPError PluginView::getValue(NPNVariable variable, void* value)
case kSupportedDrawingModel_ANPGetValue: {
uint32_t* bits = reinterpret_cast<uint32_t*>(value);
- *bits = (1 << kBitmap_ANPDrawingModel);
+ *bits = kBitmap_ANPDrawingModel & kSurface_ANPDrawingModel;
+ return NPERR_NO_ERROR;
+ }
+
+ case kJavaContext_ANPGetValue: {
+ jobject* retObject = static_cast<jobject*>(value);
+ *retObject = android::WebViewCore::getWebViewCore(parent())->getContext();
return NPERR_NO_ERROR;
}
@@ -495,12 +526,6 @@ NPError PluginView::platformSetValue(NPPVariable variable, void* value)
NPError error = NPERR_GENERIC_ERROR;
switch (variable) {
- case kSetPluginStubJavaClassName_ANPSetValue: {
- char* className = reinterpret_cast<char*>(value);
- if (m_window->setPluginStubJavaClassName(className))
- error = NPERR_NO_ERROR;
- break;
- }
case kRequestDrawingModel_ANPSetValue: {
ANPDrawingModel model = reinterpret_cast<ANPDrawingModel>(value);
if (m_window->setDrawingModel(model))
@@ -538,7 +563,6 @@ void PluginView::invalidateRect(NPRect* rect)
}
m_window->inval(r, true);
-// android::WebViewCore::getWebViewCore(parent())->contentInvalidate(r);
}
void PluginView::invalidateRegion(NPRegion region)
@@ -583,16 +607,22 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
}
m_window->inval(rect, false);
+ context->save();
+ context->translate(frame.x(), frame.y());
m_window->draw(android_gc2canvas(context));
+ context->restore();
}
-// new as of SVN 38068, Nov 5 2008
void PluginView::updatePluginWidget()
{
- // I bet/hope we can move all of setNPWindowRect() into here
FrameView* frameView = static_cast<FrameView*>(parent());
if (frameView) {
- m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size());
+ IntRect oldWindowRect = m_windowRect;
+
+ m_windowRect = frameView->contentsToWindow(frameRect());
+
+ if (m_windowRect != oldWindowRect)
+ setNPWindowIfNeeded();
}
}
@@ -601,4 +631,12 @@ void PluginView::setParentVisible(bool) {
notImplemented();
}
+void PluginView::halt() {
+ notImplemented();
+}
+
+void PluginView::restart() {
+ notImplemented();
+}
+
} // namespace WebCore