summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--JavaScriptCore/wtf/Platform.h7
-rw-r--r--WebCore/config.h1
-rw-r--r--WebCore/platform/android/LocalizedStringsAndroid.cpp60
-rw-r--r--WebCore/platform/android/PlatformBridge.h53
-rw-r--r--WebCore/platform/android/RenderThemeAndroid.cpp113
-rw-r--r--WebCore/platform/android/SSLKeyGeneratorAndroid.cpp18
-rw-r--r--WebCore/platform/android/SharedTimerAndroid.cpp14
-rw-r--r--WebCore/platform/network/android/AuthenticationChallenge.h15
-rw-r--r--WebCore/plugins/android/PluginViewAndroid.cpp6
-rw-r--r--WebCore/rendering/RenderBlock.h4
-rw-r--r--WebKit/Android.mk3
-rw-r--r--WebKit/android/WebCoreSupport/KeyGeneratorClient.h (renamed from WebCore/platform/android/KeyGeneratorClient.h)0
-rw-r--r--WebKit/android/WebCoreSupport/PlatformBridge.cpp54
-rw-r--r--WebKit/android/jni/WebViewCore.cpp42
-rw-r--r--WebKit/android/jni/WebViewCore.h11
-rw-r--r--WebKit/android/nav/WebView.cpp31
-rw-r--r--WebKit/android/plugins/ANPSystemInterface.cpp7
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp72
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.h9
-rw-r--r--WebKit/android/plugins/android_npapi.h28
20 files changed, 326 insertions, 222 deletions
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 92ab043..888f6a8 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -728,6 +728,13 @@
#define ENABLE_TEXT_CARET 1
#endif
+// ENABLE_ARCHIVE is an Android addition. We need this default value to allow
+// us to build on Mac.
+// FIXME: Upstream to webkit.org.
+#if !defined(ENABLE_ARCHIVE)
+#define ENABLE_ARCHIVE 1
+#endif
+
#if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
#define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
#endif
diff --git a/WebCore/config.h b/WebCore/config.h
index f4b93c5..598acc4 100644
--- a/WebCore/config.h
+++ b/WebCore/config.h
@@ -110,6 +110,7 @@
#define ENABLE_XPATH 0
#define ENABLE_XSLT 0
+#undef ENABLE_ARCHIVE // Enabled by default in Platform.h
#define ENABLE_ARCHIVE 0
#define ENABLE_OFFLINE_WEB_APPLICATIONS 1
#define ENABLE_TOUCH_EVENTS 1
diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp
index fc3b63c..2fc880b 100644
--- a/WebCore/platform/android/LocalizedStringsAndroid.cpp
+++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp
@@ -279,6 +279,24 @@ String mediaElementLiveBroadcastStateText()
return String();
}
+String localizedMediaControlElementString(const String& controlName)
+{
+ notImplemented();
+ return String();
+}
+
+String localizedMediaControlElementHelpText(const String& controlName)
+{
+ notImplemented();
+ return String();
+}
+
+String localizedMediaTimeDescription(const String& controlName)
+{
+ notImplemented();
+ return String();
+}
+
String searchableIndexIntroduction()
{
notImplemented();
@@ -301,4 +319,46 @@ String inputElementAltText()
return String();
}
+String validationMessageValueMissingText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageTypeMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessagePatternMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageTooLongText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageRangeUnderflowText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageRangeOverflowText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageStepMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
} // namespace WebCore
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h
new file mode 100644
index 0000000..977a0fd
--- /dev/null
+++ b/WebCore/platform/android/PlatformBridge.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * 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.
+ */
+
+#ifndef PlatformBridge_h
+#define PlatformBridge_h
+
+#include "KURL.h"
+#include "PlatformString.h"
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// An interface to the embedding layer, which has the ability to answer
+// questions about the system and so on...
+// This is very similar to ChromiumBridge and the two are likely to converge
+// in the future.
+//
+// The methods in this class all need to reach across a JNI layer to the Java VM
+// where the embedder runs. The JNI machinery is currently all in WebKit/android
+// but the long term plan is to move to the WebKit API and share the bridge and its
+// implementation with Chromium. The JNI machinery will then move outside of WebKit,
+// similarly to how Chromium's IPC layer lives outside of WebKit.
+class PlatformBridge {
+public:
+ // KeyGenerator
+ static WTF::Vector<String> getSupportedKeyStrengthList();
+ static String getSignedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL&);
+};
+}
+#endif // PlatformBridge_h
diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp
index 4dafae2..4c5cff5 100644
--- a/WebCore/platform/android/RenderThemeAndroid.cpp
+++ b/WebCore/platform/android/RenderThemeAndroid.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2006, The Android Open Source Project
+ * Copyright 2009, The Android Open Source Project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -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
@@ -45,16 +45,16 @@ namespace WebCore {
// Add a constant amount of padding to the textsize to get the final height
// of buttons, so that our button images are large enough to properly fit
// the text.
-const int BUTTON_PADDING = 18;
+const int buttonPadding = 18;
// Add padding to the fontSize of ListBoxes to get their maximum sizes.
// Listboxes often have a specified size. Since we change them into
// dropdowns, we want a much smaller height, which encompasses the text.
-const int LISTBOX_PADDING = 5;
+const int listboxPadding = 5;
// This is the color of selection in a textfield. It was obtained by checking
// the color of selection in TextViews in the system.
-const RGBA32 SELECTION_COLOR = makeRGB(255, 146, 0);
+const RGBA32 selectionColor = makeRGB(255, 146, 0);
static SkCanvas* getCanvasFromInfo(const RenderObject::PaintInfo& info)
{
@@ -63,7 +63,7 @@ static SkCanvas* getCanvasFromInfo(const RenderObject::PaintInfo& info)
RenderTheme* theme()
{
- static RenderThemeAndroid androidTheme;
+ DEFINE_STATIC_LOCAL(RenderThemeAndroid, androidTheme, ());
return &androidTheme;
}
@@ -101,7 +101,7 @@ bool RenderThemeAndroid::stateChanged(RenderObject* obj, ControlState state) con
Color RenderThemeAndroid::platformActiveSelectionBackgroundColor() const
{
- return Color(SELECTION_COLOR);
+ return Color(selectionColor);
}
Color RenderThemeAndroid::platformInactiveSelectionBackgroundColor() const
@@ -201,7 +201,7 @@ void RenderThemeAndroid::adjustButtonStyle(CSSStyleSelector*, RenderStyle* style
const int padding = 8;
style->setPaddingLeft(Length(padding, Fixed));
style->setPaddingRight(Length(padding, Fixed));
- style->setMinHeight(Length(style->fontSize() + BUTTON_PADDING, Fixed));
+ style->setMinHeight(Length(style->fontSize() + buttonPadding, Fixed));
}
bool RenderThemeAndroid::paintCheckbox(RenderObject* obj, const RenderObject::PaintInfo& info, const IntRect& rect)
@@ -260,55 +260,56 @@ void RenderThemeAndroid::adjustTextAreaStyle(CSSStyleSelector*, RenderStyle* sty
bool RenderThemeAndroid::paintTextArea(RenderObject* obj, const RenderObject::PaintInfo& info, const IntRect& rect)
{
- if (obj->isListBox()) {
- paintCombo(obj, info, rect);
- RenderStyle* style = obj->style();
- if (style)
- style->setColor(Color::transparent);
- Node* node = obj->node();
- if (!node || !node->hasTagName(HTMLNames::selectTag)) {
- return true;
- }
- HTMLSelectElement* select = static_cast<HTMLSelectElement*>(node);
- // The first item may be visible. Make sure it does not draw.
- // If it has a style, it overrides the RenderListBox's style, so we
- // need to make sure both are set to transparent.
- node = select->item(0);
- if (node) {
- RenderObject* renderer = node->renderer();
- if (renderer) {
- RenderStyle* renderStyle = renderer->style();
- if (renderStyle)
- renderStyle->setColor(Color::transparent);
- }
- }
- // Find the first selected option, and draw its text.
- // FIXME: In a later change, if there is more than one item selected,
- // draw a string that says "X items" like iPhone Safari does
- int index = select->selectedIndex();
- node = select->item(index);
- if (!node || !node->hasTagName(HTMLNames::optionTag)) {
- return true;
+ if (!obj->isListBox())
+ return true;
+
+ paintCombo(obj, info, rect);
+ RenderStyle* style = obj->style();
+ if (style)
+ style->setColor(Color::transparent);
+ Node* node = obj->node();
+ if (!node || !node->hasTagName(HTMLNames::selectTag))
+ return true;
+
+ HTMLSelectElement* select = static_cast<HTMLSelectElement*>(node);
+ // The first item may be visible. Make sure it does not draw.
+ // If it has a style, it overrides the RenderListBox's style, so we
+ // need to make sure both are set to transparent.
+ node = select->item(0);
+ if (node) {
+ RenderObject* renderer = node->renderer();
+ if (renderer) {
+ RenderStyle* renderStyle = renderer->style();
+ if (renderStyle)
+ renderStyle->setColor(Color::transparent);
}
- HTMLOptionElement* option = static_cast<HTMLOptionElement*>(node);
- String label = option->textIndentedToRespectGroupLabel();
- SkRect r(rect);
-
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
- // Values for text size and positioning determined by trial and error
- paint.setTextSize(r.height() - SkIntToScalar(6));
-
- SkCanvas* canvas = getCanvasFromInfo(info);
- int saveCount = canvas->save();
- r.fRight -= SkIntToScalar(RenderSkinCombo::extraWidth());
- canvas->clipRect(r);
- canvas->drawText(label.characters(), label.length() << 1,
- r.fLeft + SkIntToScalar(5), r.fBottom - SkIntToScalar(5),
- paint);
- canvas->restoreToCount(saveCount);
}
+ // Find the first selected option, and draw its text.
+ // FIXME: In a later change, if there is more than one item selected,
+ // draw a string that says "X items" like iPhone Safari does
+ int index = select->selectedIndex();
+ node = select->item(index);
+ if (!node || !node->hasTagName(HTMLNames::optionTag))
+ return true;
+
+ HTMLOptionElement* option = static_cast<HTMLOptionElement*>(node);
+ String label = option->textIndentedToRespectGroupLabel();
+ SkRect r(rect);
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
+ // Values for text size and positioning determined by trial and error
+ paint.setTextSize(r.height() - SkIntToScalar(6));
+
+ SkCanvas* canvas = getCanvasFromInfo(info);
+ int saveCount = canvas->save();
+ r.fRight -= SkIntToScalar(RenderSkinCombo::extraWidth());
+ canvas->clipRect(r);
+ canvas->drawText(label.characters(), label.length() << 1,
+ r.fLeft + SkIntToScalar(5), r.fBottom - SkIntToScalar(5), paint);
+ canvas->restoreToCount(saveCount);
+
return true;
}
@@ -325,7 +326,7 @@ bool RenderThemeAndroid::paintSearchField(RenderObject*, const RenderObject::Pai
void RenderThemeAndroid::adjustListboxStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
style->setPaddingRight(Length(RenderSkinCombo::extraWidth(), Fixed));
- style->setMaxHeight(Length(style->fontSize() + LISTBOX_PADDING, Fixed));
+ style->setMaxHeight(Length(style->fontSize() + listboxPadding, Fixed));
// Make webkit draw invisible, since it will simply draw the first element
style->setColor(Color::transparent);
addIntrinsicMargins(style);
diff --git a/WebCore/platform/android/SSLKeyGeneratorAndroid.cpp b/WebCore/platform/android/SSLKeyGeneratorAndroid.cpp
index 0279909..287d5c4 100644
--- a/WebCore/platform/android/SSLKeyGeneratorAndroid.cpp
+++ b/WebCore/platform/android/SSLKeyGeneratorAndroid.cpp
@@ -23,31 +23,21 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "config.h"
#include "SSLKeyGenerator.h"
-#include "JavaSharedClient.h"
-#include "KeyGeneratorClient.h"
+#include "PlatformBridge.h"
namespace WebCore {
void getSupportedKeySizes(Vector<String>& keys)
{
- if (android::JavaSharedClient::GetKeyGeneratorClient()) {
- keys = android::JavaSharedClient::GetKeyGeneratorClient()->
- getSupportedKeyStrengthList();
- }
+ keys = PlatformBridge::getSupportedKeyStrengthList();
}
-String signedPublicKeyAndChallengeString(unsigned index,
- const String& challenge, const KURL& url)
+String signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url)
{
- if (android::JavaSharedClient::GetKeyGeneratorClient()) {
- return android::JavaSharedClient::GetKeyGeneratorClient()->
- getSignedPublicKeyAndChallengeString(index, challenge, url);
- }
- return String();
+ return PlatformBridge::getSignedPublicKeyAndChallengeString(index, challenge, url);
}
}
diff --git a/WebCore/platform/android/SharedTimerAndroid.cpp b/WebCore/platform/android/SharedTimerAndroid.cpp
index 36b9a0f..e4f3b36 100644
--- a/WebCore/platform/android/SharedTimerAndroid.cpp
+++ b/WebCore/platform/android/SharedTimerAndroid.cpp
@@ -23,13 +23,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define LOG_TAG "Timers"
-
#include "config.h"
#include "SharedTimer.h"
-#include "JavaSharedClient.h"
-#include "TimerClient.h"
+#define LOG_TAG "Timers"
+
+#include <TimerClient.h>
+#include <JavaSharedClient.h>
#include <utils/Log.h>
#include <wtf/CurrentTime.h>
@@ -49,11 +49,11 @@ void setSharedTimerFiredFunction(void (*f)())
// as the result of currentTime() is.
void setSharedTimerFireTime(double fireTime)
{
- long long timeInMS = (long long)((fireTime - WTF::currentTime()) * 1000);
+ long long timeInMs = static_cast<long long>((fireTime - WTF::currentTime()) * 1000);
- LOGV("setSharedTimerFireTime: in %ld millisec", timeInMS);
+ LOGV("setSharedTimerFireTime: in %ld millisec", timeInMs);
if (JavaSharedClient::GetTimerClient())
- JavaSharedClient::GetTimerClient()->setSharedTimer(timeInMS);
+ JavaSharedClient::GetTimerClient()->setSharedTimer(timeInMs);
}
void stopSharedTimer()
diff --git a/WebCore/platform/network/android/AuthenticationChallenge.h b/WebCore/platform/network/android/AuthenticationChallenge.h
index 6e6d95b..e272d60 100644
--- a/WebCore/platform/network/android/AuthenticationChallenge.h
+++ b/WebCore/platform/network/android/AuthenticationChallenge.h
@@ -28,27 +28,12 @@
#define AuthenticationChallenge_h
#include "AuthenticationChallengeBase.h"
-#include "ResourceHandle.h"
-#include <wtf/RefPtr.h>
namespace WebCore {
class ResourceHandle;
class AuthenticationChallenge : public AuthenticationChallengeBase {
-public:
- AuthenticationChallenge()
- {
- }
-
- AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error)
- : AuthenticationChallengeBase(protectionSpace, proposedCredential, previousFailureCount, response, error)
- {
- }
-
- ResourceHandle* sourceHandle() const { return m_sourceHandle.get(); }
-
- RefPtr<ResourceHandle> m_sourceHandle;
};
}
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp
index 3fea59d..08ac7c8 100644
--- a/WebCore/plugins/android/PluginViewAndroid.cpp
+++ b/WebCore/plugins/android/PluginViewAndroid.cpp
@@ -479,12 +479,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))
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 09e76ee..1628701 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -342,13 +342,17 @@ private:
unsigned desiredColumnCount() const;
#if PLATFORM(ANDROID)
public:
+#endif
Vector<IntRect>* columnRects() const;
+#if PLATFORM(ANDROID)
private:
#endif
void setDesiredColumnCountAndWidth(int count, int width);
#if PLATFORM(ANDROID)
public:
+#endif
int columnGap() const;
+#if PLATFORM(ANDROID)
private:
#endif
diff --git a/WebKit/Android.mk b/WebKit/Android.mk
index 990e896..07d030b 100644
--- a/WebKit/Android.mk
+++ b/WebKit/Android.mk
@@ -21,8 +21,9 @@ LOCAL_SRC_FILES := \
android/WebCoreSupport/DragClientAndroid.cpp \
android/WebCoreSupport/EditorClientAndroid.cpp \
android/WebCoreSupport/FrameLoaderClientAndroid.cpp \
- android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp \
android/WebCoreSupport/GeolocationPermissions.cpp \
+ android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp \
+ android/WebCoreSupport/PlatformBridge.cpp \
\
android/RenderSkinAndroid.cpp \
android/RenderSkinButton.cpp \
diff --git a/WebCore/platform/android/KeyGeneratorClient.h b/WebKit/android/WebCoreSupport/KeyGeneratorClient.h
index 1bcd8e8..1bcd8e8 100644
--- a/WebCore/platform/android/KeyGeneratorClient.h
+++ b/WebKit/android/WebCoreSupport/KeyGeneratorClient.h
diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
new file mode 100644
index 0000000..e4fe4ce
--- /dev/null
+++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * 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 "PlatformBridge.h"
+
+#include "JavaSharedClient.h"
+#include "KeyGeneratorClient.h"
+
+using namespace android;
+
+namespace WebCore {
+
+WTF::Vector<String> PlatformBridge::getSupportedKeyStrengthList()
+{
+ KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient();
+ if (!client)
+ return Vector<String>();
+
+ return client->getSupportedKeyStrengthList();
+}
+
+String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url)
+{
+ KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient();
+ if (!client)
+ return String();
+
+ return client->getSignedPublicKeyAndChallengeString(index, challenge, url);
+}
+
+} \ No newline at end of file
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 7874598..2684c52 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -190,6 +190,7 @@ struct WebViewCore::JavaGlue {
jmethodID m_geolocationPermissionsHidePrompt;
jmethodID m_addMessageToConsole;
jmethodID m_getPluginClass;
+ jmethodID m_createPluginJavaInstance;
jmethodID m_startFullScreenPluginActivity;
jmethodID m_createSurface;
jmethodID m_updateSurface;
@@ -269,8 +270,9 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_geolocationPermissionsHidePrompt = GetJMethod(env, clazz, "geolocationPermissionsHidePrompt", "()V");
m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;)V");
m_javaGlue->m_getPluginClass = GetJMethod(env, clazz, "getPluginClass", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Class;");
- m_javaGlue->m_startFullScreenPluginActivity = GetJMethod(env, clazz, "startFullScreenPluginActivity", "(Ljava/lang/String;Ljava/lang/String;I)V");
- m_javaGlue->m_createSurface = GetJMethod(env, clazz, "createSurface", "(Ljava/lang/String;Ljava/lang/String;IIIII)Landroid/webkit/ViewManager$ChildView;");
+ m_javaGlue->m_createPluginJavaInstance = GetJMethod(env, clazz, "createPluginJavaInstance", "(Ljava/lang/String;I)Landroid/webkit/plugin/WebkitPlugin;");
+ m_javaGlue->m_startFullScreenPluginActivity = GetJMethod(env, clazz, "startFullScreenPluginActivity", "(Ljava/lang/String;I)V");
+ m_javaGlue->m_createSurface = GetJMethod(env, clazz, "createSurface", "(Landroid/webkit/plugin/WebkitPlugin;IIII)Landroid/webkit/ViewManager$ChildView;");
m_javaGlue->m_updateSurface = GetJMethod(env, clazz, "updateSurface", "(Landroid/webkit/ViewManager$ChildView;IIII)V");
m_javaGlue->m_destroySurface = GetJMethod(env, clazz, "destroySurface", "(Landroid/webkit/ViewManager$ChildView;)V");
m_javaGlue->m_sendFindAgain = GetJMethod(env, clazz, "sendFindAgain", "()V");
@@ -2438,7 +2440,7 @@ void WebViewCore::setBackgroundColor(SkColor c)
view->setBaseBackgroundColor(bcolor);
}
-jclass WebViewCore::getPluginClass(const char* libName, const char* className)
+jclass WebViewCore::getPluginClass(const WebCore::String& libName, const char* className)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = m_javaGlue->object(env);
@@ -2447,7 +2449,7 @@ jclass WebViewCore::getPluginClass(const char* libName, const char* className)
if (!obj.get())
return NULL;
- jstring libString = env->NewStringUTF(libName);
+ jstring libString = env->NewString(libName.characters(), libName.length());
jstring classString = env->NewStringUTF(className);
jobject pluginClass = env->CallObjectMethod(obj.get(),
m_javaGlue->m_getPluginClass,
@@ -2461,8 +2463,24 @@ jclass WebViewCore::getPluginClass(const char* libName, const char* className)
}
}
-void WebViewCore::startFullScreenPluginActivity(const char* libName,
- const char* className, NPP npp)
+jobject WebViewCore::createPluginJavaInstance(const WebCore::String& libName, NPP npp)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return 0;
+
+ jstring libString = env->NewString(libName.characters(), libName.length());
+ jobject result = env->CallObjectMethod(obj.get(),
+ m_javaGlue->m_createPluginJavaInstance,
+ libString, (int) npp);
+ checkException(env);
+ return result;
+}
+
+void WebViewCore::startFullScreenPluginActivity(const char* libName, NPP npp)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = m_javaGlue->object(env);
@@ -2472,15 +2490,13 @@ void WebViewCore::startFullScreenPluginActivity(const char* libName,
return;
jstring libString = env->NewStringUTF(libName);
- jstring classString = env->NewStringUTF(className);
env->CallVoidMethod(obj.get(),
m_javaGlue->m_startFullScreenPluginActivity,
- libString, classString, (int) npp);
+ libString, (int) npp);
checkException(env);
}
-jobject WebViewCore::createSurface(const char* libName, const char* className,
- NPP npp, int x, int y, int width, int height)
+jobject WebViewCore::createSurface(jobject webkitPlugin, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = m_javaGlue->object(env);
@@ -2489,11 +2505,9 @@ jobject WebViewCore::createSurface(const char* libName, const char* className,
if (!obj.get())
return 0;
- jstring libString = env->NewStringUTF(libName);
- jstring classString = env->NewStringUTF(className);
jobject result = env->CallObjectMethod(obj.get(),
- m_javaGlue->m_createSurface, libString,
- classString,(int) npp, x, y, width, height);
+ m_javaGlue->m_createSurface,
+ webkitPlugin, x, y, width, height);
checkException(env);
return result;
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 1ff5678..19bca96 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -371,15 +371,16 @@ namespace android {
void requestKeyboard(bool);
// Generates a class loader that contains classes from the plugin's apk
- jclass getPluginClass(const char* libName, const char* className);
+ jclass getPluginClass(const WebCore::String& libName, const char* className);
+
+ // Creates a new instance of the plugin's java component
+ jobject createPluginJavaInstance(const WebCore::String& libName, NPP npp);
// Creates a full screen surface (i.e. View on an Activity) for a plugin
- void startFullScreenPluginActivity(const char* libName,
- const char* className, NPP npp);
+ void startFullScreenPluginActivity(const char* libName, NPP npp);
// Creates a Surface (i.e. View) for a plugin
- jobject createSurface(const char* libName, const char* className,
- NPP npp, int x, int y, int width, int height);
+ jobject createSurface(jobject webkitPlugin, int x, int y, int width, int height);
// Updates a Surface coordinates and dimensions for a plugin
void updateSurface(jobject childView, int x, int y, int width, int height);
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 88aa48f..4939637 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -905,29 +905,6 @@ void setNavBounds(const WebCore::IntRect& rect)
root->rootHistory()->setNavBounds(rect);
}
-/**
- * This function is only to be called by WebTextView, when there is a motion up
- * on an already focused text input. Unlike motionUp which may change our
- * cursor, it simply passes the click, so it can change the selection.
- * Variables are in content space, relative to the page.
- */
-void textInputMotionUp(int x, int y)
-{
- const CachedRoot* root = getFrameCache(DontAllowNewer);
- if (!root) {
- return;
- }
- const CachedFrame* frame;
- const CachedNode* node = root->currentCursor(&frame);
- if (node) {
- sendMotionUp(static_cast<WebCore::Frame*>(frame->framePointer()),
- static_cast<WebCore::Node*>(node->nodePointer()), x, y);
- if (!node->isReadOnly()) {
- displaySoftKeyboard(true);
- }
- }
-}
-
bool motionUp(int x, int y, int slop)
{
bool pageScrolled = false;
@@ -1733,12 +1710,6 @@ static jint nativeTextGeneration(JNIEnv *env, jobject obj)
return root ? root->textGeneration() : 0;
}
-static void nativeTextInputMotionUp(JNIEnv *env, jobject obj, int x, int y)
-{
- WebView* view = GET_NATIVE_VIEW(env, obj);
- view->textInputMotionUp(x, y);
-}
-
static bool nativeMotionUp(JNIEnv *env, jobject obj,
int x, int y, int slop)
{
@@ -2094,8 +2065,6 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeImageURI },
{ "nativeInstrumentReport", "()V",
(void*) nativeInstrumentReport },
- { "nativeTextInputMotionUp", "(II)V",
- (void*) nativeTextInputMotionUp },
{ "nativeMotionUp", "(III)Z",
(void*) nativeMotionUp },
{ "nativeMoveCursor", "(IIZ)Z",
diff --git a/WebKit/android/plugins/ANPSystemInterface.cpp b/WebKit/android/plugins/ANPSystemInterface.cpp
index 92085cc..42ec9e4 100644
--- a/WebKit/android/plugins/ANPSystemInterface.cpp
+++ b/WebKit/android/plugins/ANPSystemInterface.cpp
@@ -77,12 +77,9 @@ static jclass anp_loadJavaClass(NPP instance, const char* className) {
WebCore::PluginView* pluginView = pluginViewForInstance(instance);
PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
- const WebCore::String& libName = pluginView->plugin()->path();
- SkString skLibName;
- skLibName.setUTF16(libName.characters(), libName.length());
-
jclass result;
- result = pluginWidget->webViewCore()->getPluginClass(skLibName.c_str(), className);
+ result = pluginWidget->webViewCore()->getPluginClass(pluginView->plugin()->path(),
+ className);
return result;
}
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index dcd8943..9c8d25d 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -36,6 +36,7 @@
#include "SkFlipPixelRef.h"
#include "SkString.h"
#include "WebViewCore.h"
+#include "jni_utility.h"
#define DEBUG_VISIBLE_RECTS 1 // temporary debug printfs and fixes
@@ -52,8 +53,8 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view)
m_pluginBounds.setEmpty();
m_hasFocus = false;
m_zoomLevel = 0;
- m_javaClassName = NULL;
m_childView = NULL;
+ m_webkitPlugin = NULL;
}
PluginWidgetAndroid::~PluginWidgetAndroid() {
@@ -63,9 +64,16 @@ PluginWidgetAndroid::~PluginWidgetAndroid() {
m_core->destroySurface(m_childView);
}
}
- if (m_javaClassName) {
- free(m_javaClassName);
+
+ // cleanup any remaining JNI References
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ if (m_childView) {
+ env->DeleteGlobalRef(m_childView);
+ }
+ if (m_webkitPlugin) {
+ env->DeleteGlobalRef(m_webkitPlugin);
}
+
m_flipPixelRef->safeUnref();
}
@@ -74,6 +82,19 @@ void PluginWidgetAndroid::init(android::WebViewCore* core) {
m_core->addPlugin(this);
}
+jobject PluginWidgetAndroid::getJavaPluginInstance() {
+ if (m_webkitPlugin == NULL && m_core != NULL) {
+
+ jobject tempObj = m_core->createPluginJavaInstance(m_pluginView->plugin()->path(),
+ m_pluginView->instance());
+ if (tempObj) {
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ m_webkitPlugin = env->NewGlobalRef(tempObj);
+ }
+ }
+ return m_webkitPlugin;
+}
+
static SkBitmap::Config computeConfig(bool isTransparent) {
return isTransparent ? SkBitmap::kARGB_8888_Config
: SkBitmap::kRGB_565_Config;
@@ -105,15 +126,13 @@ void PluginWidgetAndroid::setWindow(NPWindow* window, bool isTransparent) {
// if the surface does not exist then create a new surface
} else if(!m_childView) {
-
- const String& libName = m_pluginView->plugin()->path();
- SkString skLibName;
- skLibName.setUTF16(libName.characters(), libName.length());
-
- m_childView = m_core->createSurface(skLibName.c_str(), m_javaClassName,
- m_pluginView->instance(),
- docPoint.x(), docPoint.y(),
- window->width, window->height);
+ jobject tempObj = m_core->createSurface(getJavaPluginInstance(),
+ docPoint.x(), docPoint.y(),
+ window->width, window->height);
+ if (tempObj) {
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ m_childView = env->NewGlobalRef(tempObj);
+ }
}
} else {
m_flipPixelRef->safeUnref();
@@ -122,44 +141,17 @@ void PluginWidgetAndroid::setWindow(NPWindow* window, bool isTransparent) {
}
}
-bool PluginWidgetAndroid::setPluginStubJavaClassName(const char* className) {
-
- if (m_javaClassName) {
- free(m_javaClassName);
- }
-
- // don't call strdup() if the className is to be set to NULL
- if (!className) {
- m_javaClassName = NULL;
- return true;
- }
-
- // make a local copy of the className
- m_javaClassName = strdup(className);
- return (m_javaClassName != NULL);
-}
-
void PluginWidgetAndroid::requestFullScreenMode() {
- if (!m_javaClassName) {
- return;
- }
-
const String& libName = m_pluginView->plugin()->path();
SkString skLibName;
skLibName.setUTF16(libName.characters(), libName.length());
- m_core->startFullScreenPluginActivity(skLibName.c_str(), m_javaClassName,
+ m_core->startFullScreenPluginActivity(skLibName.c_str(),
m_pluginView->instance());
}
bool PluginWidgetAndroid::setDrawingModel(ANPDrawingModel model) {
-
- // disallow the surface drawing model if no java class name has been given
- if (model == kSurface_ANPDrawingModel && m_javaClassName == NULL) {
- return false;
- }
-
m_drawingModel = model;
return true;
}
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h
index b7df4f0..da2291f 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -67,12 +67,6 @@ struct PluginWidgetAndroid {
*/
void setWindow(NPWindow* window, bool isTransparent);
- /* Called to notify us of the plugin's java class that implements the
- * PluginStub interface. A local copy is made of the className so the caller
- * can safely free the memory as soon as the function returns.
- */
- bool setPluginStubJavaClassName(const char* className);
-
/* Called whenever the plugin itself requests a new drawing model. If the
hardware does not support the requested model then false is returned,
otherwise true is returned.
@@ -141,6 +135,7 @@ private:
WebCore::IntPoint frameToDocumentCoords(int frameX, int frameY) const;
void computeVisibleFrameRect();
void scrollToVisibleFrameRect();
+ jobject getJavaPluginInstance();
WebCore::PluginView* m_pluginView;
android::WebViewCore* m_core;
@@ -153,8 +148,8 @@ private:
SkIRect m_requestedFrameRect;
bool m_hasFocus;
float m_zoomLevel;
- char* m_javaClassName;
jobject m_childView;
+ jobject m_webkitPlugin;
/* We limit the number of rectangles to minimize storage and ensure adequate
speed.
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index 71913fa..88c45f4 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -149,10 +149,10 @@ enum ANPDrawingModels {
kBitmap_ANPDrawingModel = 0,
/** Draw into a surface (e.g. raster, openGL, etc.) using the Java surface
interface. When this model is used the browser will invoke the Java
- class specified by kSetPluginStubJavaClassName_ANPSetValue which will
- return an instance of a android Java View. The instance is then embedded
- in the html. The plugin can then manipulate the view as it would any
- normal Java View in android.
+ class specified in the plugin's apk manifest. From that class the browser
+ will invoke the appropriate method to return an an instance of a android
+ Java View. The instance is then embedded in the html. The plugin can then
+ manipulate the view as it would any normal Java View in android.
Unlike the bitmap model, a surface model is opaque so no html content
behind the plugin will be visible. Unless the plugin needs to be
@@ -171,27 +171,13 @@ enum ANPDrawingModels {
};
typedef int32_t ANPDrawingModel;
-/** Set the name of the Java class found in the plugin's apk that implements the
- PluginStub interface. The value provided must be a null terminated char*
- that contains the fully qualified class name (e.g., your.package.className).
- A local copy is made of the char* so the caller can safely free the memory
- as soon as the function returns.
-
- This value must be set prior to selecting the Surface_ANPDrawingModel or
- requesting to enter full-screen mode.
-
- NPN_SetValue(inst, kSetPluginStubJavaClassName_ANPSetValue,
- (void*)nullTerminatedChar*)
- */
-#define kSetPluginStubJavaClassName_ANPSetValue ((NPPVariable)1001)
-
/** Request to receive/disable events. If the pointer is NULL then all flags will
be disabled. Otherwise, the event type will be enabled iff its corresponding
bit in the EventFlags bit field is set.
NPN_SetValue(inst, ANPAcceptEvents, (void*)EventFlags)
*/
-#define kAcceptEvents_ANPSetValue ((NPPVariable)1002)
+#define kAcceptEvents_ANPSetValue ((NPPVariable)1001)
/** The EventFlags are a set of bits used to determine which types of events the
plugin wishes to receive. For example, if the value is 0x03 then both key
@@ -674,8 +660,8 @@ struct ANPWindowInterfaceV0 : ANPInterface {
*/
void (*showKeyboard)(NPP instance, bool value);
/** Called when a plugin wishes to enter into full screen mode. The plugin's
- Java class (set using kSetPluginStubJavaClassName_ANPSetValue) will be
- called asynchronously to provide a View object to be displayed full screen.
+ Java class (defined in the plugin's apk manifest) will be called
+ asynchronously to provide a View object to be displayed full screen.
*/
void (*requestFullScreen)(NPP instance);
};