summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp9
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h2
-rw-r--r--WebKit/android/jni/JavaBridge.cpp16
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp19
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.h2
-rw-r--r--WebKit/android/jni/WebViewCore.cpp6
-rw-r--r--WebKit/android/plugins/ANPSystemInterface.cpp72
-rw-r--r--WebKit/android/plugins/android_npapi.h12
8 files changed, 138 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 92d3294..7554a84 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -243,6 +243,14 @@ void FrameLoaderClientAndroid::dispatchDidReceiveIcon() {
}
}
+void FrameLoaderClientAndroid::dispatchDidReceiveTouchIconURL(const String& url) {
+ ASSERT(m_frame);
+ // Do not report sub frame touch icons
+ if (m_frame->tree() && m_frame->tree()->parent())
+ return;
+ m_webFrame->didReceiveTouchIconURL(url);
+}
+
void FrameLoaderClientAndroid::dispatchDidStartProvisionalLoad() {
notImplemented();
}
@@ -1050,4 +1058,5 @@ void FrameLoaderClientAndroid::didAddIconForPageUrl(const String& pageUrl) {
dispatchDidReceiveIcon();
}
}
+
}
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
index d491750..e0de972 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
@@ -185,6 +185,8 @@ namespace android {
virtual void registerForIconNotification(bool listen = true);
+ virtual void dispatchDidReceiveTouchIconURL(const String& url);
+
// WebIconDatabaseClient api
virtual void didAddIconForPageUrl(const String& pageUrl);
diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp
index 7c4636f..3f9a056 100644
--- a/WebKit/android/jni/JavaBridge.cpp
+++ b/WebKit/android/jni/JavaBridge.cpp
@@ -76,6 +76,7 @@ public:
virtual bool cookiesEnabled();
virtual WTF::Vector<WebCore::String> getPluginDirectories();
+ virtual WebCore::String getPluginSharedDataDirectory();
virtual WTF::Vector<String> getSupportedKeyStrengthList();
virtual WebCore::String getSignedPublicKeyAndChallengeString(unsigned index,
@@ -107,6 +108,7 @@ private:
jmethodID mCookies;
jmethodID mCookiesEnabled;
jmethodID mGetPluginDirectories;
+ jmethodID mGetPluginSharedDataDirectory;
jmethodID mSignalFuncPtrQueue;
jmethodID mGetKeyStrengthList;
jmethodID mGetSignedPublicKey;
@@ -125,6 +127,7 @@ JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
mCookies = env->GetMethodID(clazz, "cookies", "(Ljava/lang/String;)Ljava/lang/String;");
mCookiesEnabled = env->GetMethodID(clazz, "cookiesEnabled", "()Z");
mGetPluginDirectories = env->GetMethodID(clazz, "getPluginDirectories", "()[Ljava/lang/String;");
+ mGetPluginSharedDataDirectory = env->GetMethodID(clazz, "getPluginSharedDataDirectory", "()Ljava/lang/String;");
mSignalFuncPtrQueue = env->GetMethodID(clazz, "signalServiceFuncPtrQueue", "()V");
mGetKeyStrengthList = env->GetMethodID(clazz, "getKeyStrengthList", "()[Ljava/lang/String;");
mGetSignedPublicKey = env->GetMethodID(clazz, "getSignedPublicKey", "(ILjava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
@@ -134,6 +137,8 @@ JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
LOG_ASSERT(mSetCookies, "Could not find method setCookies");
LOG_ASSERT(mCookies, "Could not find method cookies");
LOG_ASSERT(mCookiesEnabled, "Could not find method cookiesEnabled");
+ LOG_ASSERT(mGetPluginDirectories, "Could not find method getPluginDirectories");
+ LOG_ASSERT(mGetPluginSharedDataDirectory, "Could not find method getPluginSharedDataDirectory");
LOG_ASSERT(mGetKeyStrengthList, "Could not find method getKeyStrengthList");
LOG_ASSERT(mGetSignedPublicKey, "Could not find method getSignedPublicKey");
@@ -231,6 +236,17 @@ JavaBridge::getPluginDirectories()
return directories;
}
+WebCore::String
+JavaBridge::getPluginSharedDataDirectory()
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = getRealObject(env, mJavaObject);
+ jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory);
+ WebCore::String path = to_string(env, ret);
+ checkException(env);
+ return path;
+}
+
void
JavaBridge::setSharedTimerCallback(void (*f)())
{
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index b856e10..f47603b 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -136,6 +136,7 @@ struct WebFrame::JavaBrowserFrame
jmethodID mWindowObjectCleared;
jmethodID mSetProgress;
jmethodID mDidReceiveIcon;
+ jmethodID mDidReceiveTouchIconUrl;
jmethodID mUpdateVisitedHistory;
jmethodID mHandleUrl;
jmethodID mCreateWindow;
@@ -182,6 +183,8 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
"(I)V");
mJavaFrame->mDidReceiveIcon = env->GetMethodID(clazz, "didReceiveIcon",
"(Landroid/graphics/Bitmap;)V");
+ mJavaFrame->mDidReceiveTouchIconUrl = env->GetMethodID(clazz, "didReceiveTouchIconUrl",
+ "(Ljava/lang/String;)V");
mJavaFrame->mUpdateVisitedHistory = env->GetMethodID(clazz, "updateVisitedHistory",
"(Ljava/lang/String;Z)V");
mJavaFrame->mHandleUrl = env->GetMethodID(clazz, "handleUrl",
@@ -206,6 +209,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
LOG_ASSERT(mJavaFrame->mWindowObjectCleared, "Could not find method windowObjectCleared");
LOG_ASSERT(mJavaFrame->mSetProgress, "Could not find method setProgress");
LOG_ASSERT(mJavaFrame->mDidReceiveIcon, "Could not find method didReceiveIcon");
+ LOG_ASSERT(mJavaFrame->mDidReceiveTouchIconUrl, "Could not find method didReceiveTouchIconUrl");
LOG_ASSERT(mJavaFrame->mUpdateVisitedHistory, "Could not find method updateVisitedHistory");
LOG_ASSERT(mJavaFrame->mHandleUrl, "Could not find method handleUrl");
LOG_ASSERT(mJavaFrame->mCreateWindow, "Could not find method createWindow");
@@ -575,6 +579,21 @@ WebFrame::didReceiveIcon(WebCore::Image* icon)
}
void
+WebFrame::didReceiveTouchIconURL(const WebCore::String& url)
+{
+#ifdef ANDROID_INSTRUMENT
+ TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
+#endif
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
+ url.length());
+
+ env->CallVoidMethod(mJavaFrame->frame(env).get(),
+ mJavaFrame->mDidReceiveTouchIconUrl, jUrlStr);
+ checkException(env);
+}
+
+void
WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload)
{
#ifdef ANDROID_INSTRUMENT
diff --git a/WebKit/android/jni/WebCoreFrameBridge.h b/WebKit/android/jni/WebCoreFrameBridge.h
index 5bfd1fb..6b5c90c 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/WebKit/android/jni/WebCoreFrameBridge.h
@@ -89,6 +89,8 @@ class WebFrame : public WebCoreRefObject {
const WebCore::String userAgentForURL(const WebCore::KURL* url);
void didReceiveIcon(WebCore::Image* icon);
+
+ void didReceiveTouchIconURL(const WebCore::String& url);
void updateVisitedHistory(const WebCore::KURL& url, bool reload);
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 43a077f..35aeedb 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -885,6 +885,12 @@ void WebViewCore::notifyProgressFinished()
m_check_domtree_version = true;
updateFrameCache();
sendNotifyProgressFinished();
+
+ // trigger an event notifying the plugins that the page has loaded
+ ANPEvent event;
+ SkANP::InitEvent(&event, kLifecycle_ANPEventType);
+ event.data.lifecycle.action = kOnLoad_ANPLifecycleAction;
+ sendPluginEvent(event);
}
void WebViewCore::doMaxScroll(CacheBuilder::Direction dir)
diff --git a/WebKit/android/plugins/ANPSystemInterface.cpp b/WebKit/android/plugins/ANPSystemInterface.cpp
new file mode 100644
index 0000000..a5b9bcb
--- /dev/null
+++ b/WebKit/android/plugins/ANPSystemInterface.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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 APPLE COMPUTER, INC. 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.
+ */
+
+// must include config.h first for webkit to fiddle with new/delete
+#include "config.h"
+
+#include "android_npapi.h"
+#include "CString.h"
+#include "JavaSharedClient.h"
+#include "PluginClient.h"
+
+static const char* gApplicationDataDir = NULL;
+
+using namespace android;
+
+static const char* anp_getApplicationDataDirectory() {
+ if (NULL == gApplicationDataDir) {
+ PluginClient* client = JavaSharedClient::GetPluginClient();
+ if (!client)
+ return NULL;
+
+ WebCore::String path = client->getPluginSharedDataDirectory();
+ int length = path.length();
+ if (length == 0)
+ return NULL;
+
+ char* storage = (char*) malloc(length + 1);
+ if (NULL == storage)
+ return NULL;
+
+ memcpy(storage, path.utf8().data(), length);
+ storage[length] = '\0';
+
+ // save this assignment for last, so that if multiple threads call us
+ // (which should never happen), we never return an incomplete global.
+ // At worst, we would allocate storage for the path twice.
+ gApplicationDataDir = storage;
+ }
+ return gApplicationDataDir;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#define ASSIGN(obj, name) (obj)->name = anp_##name
+
+void ANPSystemInterfaceV0_Init(ANPInterface* v) {
+ ANPSystemInterfaceV0* i = reinterpret_cast<ANPSystemInterfaceV0*>(v);
+
+ ASSIGN(i, getApplicationDataDirectory);
+}
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index 80fd2c4..47a7494 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -117,6 +117,7 @@ typedef uint32_t ANPMatrixFlag;
#define kWindowInterfaceV0_ANPGetValue ((NPNVariable)1007)
#define kBitmapInterfaceV0_ANPGetValue ((NPNVariable)1008)
#define kSurfaceInterfaceV0_ANPGetValue ((NPNVariable)1009)
+#define kSystemInterfaceV0_ANPGetValue ((NPNVariable)1010)
/* queries for which drawing model is desired (for the draw event)
@@ -793,6 +794,7 @@ enum ANPLifecycleActions {
kGainFocus_ANPLifecycleAction = 2,
kLoseFocus_ANPLifecycleAction = 3,
kFreeMemory_ANPLifecycleAction = 4,
+ kOnLoad_ANPLifecycleAction = 5,
};
typedef uint32_t ANPLifecycleAction;
@@ -870,5 +872,15 @@ struct ANPEvent {
} data;
};
+///////////////////////////////////////////////////////////////////////////////
+// System properties
+
+struct ANPSystemInterfaceV0 : ANPInterface {
+ /** Return the path name for the current Application's plugin data directory,
+ * or NULL if not supported
+ */
+ const char* (*getApplicationDataDirectory)();
+};
+
#endif