summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2009-08-04 09:25:54 -0400
committerPatrick Scott <phanna@android.com>2009-08-05 08:29:32 -0400
commitf1c0bbb9bf698154c206e842f94b72d277a96094 (patch)
tree70aa0bdf3c877788a1f4e037ad8c06d949c18cd9 /WebKit
parent2792e6b92c85f6a20d2203484d2aa72d6df78a22 (diff)
downloadexternal_webkit-f1c0bbb9bf698154c206e842f94b72d277a96094.zip
external_webkit-f1c0bbb9bf698154c206e842f94b72d277a96094.tar.gz
external_webkit-f1c0bbb9bf698154c206e842f94b72d277a96094.tar.bz2
Add a callback for parsing apple-touch-icon.
Call through FrameLoaderClient when an apple-touch-icon attribute is parsed. Instead of always downloaded the icon, just report the url so that if it is needed, it can downloaded by java. It is also a lot more code to let WebCore handle storage and retrieval of the icon.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp9
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h2
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp19
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.h2
4 files changed, 32 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/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);