diff options
author | Ben Murdoch <benm@google.com> | 2010-06-23 19:56:02 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-06-30 18:32:45 +0100 |
commit | 60950638e3cf833c59b11f87d2cf170bfb8e169b (patch) | |
tree | 73e06142367cf9bc0998afa49713023f47e3a32b /WebKit | |
parent | 5bde0f53b35681f9195cca182adfbcba8edc47f6 (diff) | |
download | external_webkit-60950638e3cf833c59b11f87d2cf170bfb8e169b.zip external_webkit-60950638e3cf833c59b11f87d2cf170bfb8e169b.tar.gz external_webkit-60950638e3cf833c59b11f87d2cf170bfb8e169b.tar.bz2 |
Detect if we're a webapp from the meta tag and send a message through
to java land if that is the case.
Requires a frameworks/base change.
b/2766917
Change-Id: I6d4034e6316e27c31a36a06063b5968c654fc756
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 10 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.h | 4 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 9 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index c8d9d4b..7a18221 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -530,4 +530,14 @@ void ChromeClientAndroid::needTouchEvents(bool needTouchEvents) } #endif +#if ENABLE(ANDROID_INSTALLABLE_WEB_APPS) +void ChromeClientAndroid::webAppCanBeInstalled() +{ + FrameView* frameView = m_webFrame->page()->mainFrame()->view(); + android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView); + if (core) + core->notifyWebAppCanBeInstalled(); +} +#endif + } diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 28f2546..517a439 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -172,6 +172,10 @@ namespace android { void layersSync(); #endif +#if ENABLE(ANDROID_INSTALLABLE_WEB_APPS) + virtual void webAppCanBeInstalled(); +#endif + private: android::WebFrame* m_webFrame; // The Geolocation permissions manager. diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index f95672a..955b654 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -256,6 +256,7 @@ struct WebViewCore::JavaGlue { jmethodID m_showRect; jmethodID m_centerFitRect; jmethodID m_setScrollbarModes; + jmethodID m_setInstallableWebApp; AutoJObject object(JNIEnv* env) { return getRealObject(env, m_obj); } @@ -346,6 +347,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_showRect = GetJMethod(env, clazz, "showRect", "(IIIIIIFFFF)V"); m_javaGlue->m_centerFitRect = GetJMethod(env, clazz, "centerFitRect", "(IIII)V"); m_javaGlue->m_setScrollbarModes = GetJMethod(env, clazz, "setScrollbarModes", "(II)V"); + m_javaGlue->m_setInstallableWebApp = GetJMethod(env, clazz, "setInstallableWebApp", "()V"); env->SetIntField(javaWebViewCore, gWebViewCoreFields.m_nativeClass, (jint)this); @@ -2865,6 +2867,13 @@ void WebViewCore::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode checkException(env); } +void WebViewCore::notifyWebAppCanBeInstalled() +{ + JNIEnv* env = JSC::Bindings::getJNIEnv(); + env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_setInstallableWebApp); + checkException(env); +} + //---------------------------------------------------------------------- // Native JNI methods //---------------------------------------------------------------------- diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 44d7bcc..42656d4 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -470,6 +470,8 @@ namespace android { // utility to split slow parts of the picture set void splitContent(); + void notifyWebAppCanBeInstalled(); + // these members are shared with webview.cpp static Mutex gFrameCacheMutex; CachedRoot* m_frameCacheKit; // nav data being built by webcore |