Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2010-12-15 11:42:13 +0000
committerLakshmi Shanmugam2010-12-15 11:42:13 +0000
commitc42f65bcd5998765cd2aa4958086ca685ddde522 (patch)
tree740c2615c63d71cfe2dbf2ded31663ebe9228cba /bundles/org.eclipse.swt
parentf2154138d4b6d9d084593c43895f906b72788b05 (diff)
downloadeclipse.platform.swt-c42f65bcd5998765cd2aa4958086ca685ddde522.tar.gz
eclipse.platform.swt-c42f65bcd5998765cd2aa4958086ca685ddde522.tar.xz
eclipse.platform.swt-c42f65bcd5998765cd2aa4958086ca685ddde522.zip
Bug 220098 - Support for WebKit on Windows
Diffstat (limited to 'bundles/org.eclipse.swt')
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_win321
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c225
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c45
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h41
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c173
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPropertyBag.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/swt_webkit.rc45
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.cpp864
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.h26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.cpp72
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.h16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.cpp110
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.h96
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.cpp97
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.h29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java268
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java623
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java1281
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebPolicyDelegate.java208
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java388
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java599
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMDocument.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMEventListener.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebCookieManager.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDataSource.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDocumentRepresentation.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDownload.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebError.java50
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFrame.java46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFramePrivate.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebIBActions.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequest.java47
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequestPrivate.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebOpenPanelResultListener.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPolicyDecisionListener.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPreferences.java55
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallenge.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallengeSender.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLCredential.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLProtectionSpace.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLRequest.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLResponse.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebView.java99
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebViewPrivate.java46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/JSClassDefinition.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/WebKit_win32.java374
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties1
56 files changed, 6465 insertions, 54 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_win32 b/bundles/org.eclipse.swt/.classpath_win32
index a8cdf24d57..376d93086d 100755
--- a/bundles/org.eclipse.swt/.classpath_win32
+++ b/bundles/org.eclipse.swt/.classpath_win32
@@ -27,6 +27,7 @@
<classpathentry kind="src" path="Eclipse SWT Browser/win32"/>
<classpathentry kind="src" path="Eclipse SWT Mozilla/common"/>
<classpathentry kind="src" path="Eclipse SWT Mozilla/win32"/>
+ <classpathentry kind="src" path="Eclipse SWT WebKit/win32"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/win32"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/common"/>
<classpathentry kind="src" path="Eclipse SWT Theme/win32"/>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java
index 52d7e8e487..6f413bf0fa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java
@@ -18,6 +18,9 @@ WebBrowser createWebBrowser (int style) {
if ((style & SWT.MOZILLA) != 0) {
return new Mozilla ();
}
+ if ((style & SWT.WEBKIT) != 0) {
+ return new WebKit ();
+ }
return new IE ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c
index b4f0e9b5d6..6a75301484 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c
@@ -1255,6 +1255,18 @@ JNIEXPORT jint JNICALL COM_NATIVE(SysStringByteLen)
}
#endif
+#ifndef NO_SysStringLen
+JNIEXPORT jint JNICALL COM_NATIVE(SysStringLen)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ COM_NATIVE_ENTER(env, that, SysStringLen_FUNC);
+ rc = (jint)SysStringLen((BSTR)arg0);
+ COM_NATIVE_EXIT(env, that, SysStringLen_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_TYPEATTR_1sizeof
JNIEXPORT jint JNICALL COM_NATIVE(TYPEATTR_1sizeof)
(JNIEnv *env, jclass that)
@@ -1599,6 +1611,29 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__IIIIZ) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJJZ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIIIZ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2, jintLong arg3, jboolean arg4)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJJJZ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2, jintLong arg3, jboolean arg4)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__IIIIZ_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJJJZ_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jintLong, jintLong, jboolean))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__IIIIZ_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJJJZ_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IIII_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJII_3I) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIII_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jintArray arg4)
@@ -2239,6 +2274,29 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__IIJJ) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIJJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJJJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__IIJJ_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJJJ_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jlong))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__IIJJ_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJJJ_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IIJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jobject arg4, jlong arg5, jlongArray arg6)
@@ -2296,6 +2354,33 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__IIJJ_3J) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJJ_3J) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlongArray arg4)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJJJ_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jlong arg3, jlongArray arg4)
+#endif
+{
+ jlong *lparg4=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__IIJJ_3J_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJJJ_3J_FUNC);
+#endif
+ if (arg4) if ((lparg4 = (*env)->GetLongArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jlong, jlong *))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseLongArrayElements(env, arg4, lparg4, 0);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__IIJJ_3J_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJJJ_3J_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IIJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jobject arg3, jlongArray arg4)
@@ -3009,6 +3094,33 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2II) && !defined(JNI64)) || (!defined(NO_VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2II) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2II)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jint arg3, jint arg4)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2II)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jint arg3, jint arg4)
+#endif
+{
+ RECT _arg2, *lparg2=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2II_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2II_FUNC);
+#endif
+ if (arg2) if ((lparg2 = getRECTFields(env, arg2, &_arg2)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, RECT *, jint, jint))(*(jintLong **)arg1)[arg0])(arg1, lparg2, arg3, arg4);
+fail:
+ if (arg2 && lparg2) setRECTFields(env, arg2, lparg2);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2II_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2II_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2IZ) && !defined(JNI64)) || (!defined(NO_VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2IZ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2IZ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jint arg3, jboolean arg4)
@@ -3036,6 +3148,33 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JJ) && !defined(JNI64)) || (!defined(NO_VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jlong arg3, jlong arg4)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jlong arg3, jlong arg4)
+#endif
+{
+ RECT _arg2, *lparg2=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JJ_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JJ_FUNC);
+#endif
+ if (arg2) if ((lparg2 = getRECTFields(env, arg2, &_arg2)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, RECT *, jlong, jlong))(*(jintLong **)arg1)[arg0])(arg1, lparg2, arg3, arg4);
+fail:
+ if (arg2 && lparg2) setRECTFields(env, arg2, lparg2);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JJ_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JJ_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JZ) && !defined(JNI64)) || (!defined(NO_VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JZ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JZ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jlong arg3, jboolean arg4)
@@ -3170,6 +3309,29 @@ JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJZ)(JNIEnv *env, jclass that, jint
}
#endif
+#if (!defined(NO_VtblCall__IIZI) && !defined(JNI64)) || (!defined(NO_VtblCall__IJZJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IIZI)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jboolean arg2, jintLong arg3)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJZJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jboolean arg2, jintLong arg3)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__IIZI_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJZJ_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jboolean, jintLong))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__IIZI_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJZJ_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__II_3CIIII_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJ_3CIIII_3I) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__II_3CIIII_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jcharArray arg2, jint arg3, jint arg4, jint arg5, jint arg6, jintArray arg7)
@@ -3260,6 +3422,36 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__II_3CI_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJ_3CI_3I) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__II_3CI_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jcharArray arg2, jint arg3, jintArray arg4)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJ_3CI_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jcharArray arg2, jint arg3, jintArray arg4)
+#endif
+{
+ jchar *lparg2=NULL;
+ jint *lparg4=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__II_3CI_3I_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJ_3CI_3I_FUNC);
+#endif
+ if (arg2) if ((lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jchar *, jint, jint *))(*(jintLong **)arg1)[arg0])(arg1, lparg2, arg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
+ if (arg2 && lparg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__II_3CI_3I_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJ_3CI_3I_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__II_3CJIII_3J) && !defined(JNI64)) || (!defined(NO_VtblCall__IJ_3CJIII_3J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__II_3CJIII_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jcharArray arg2, jlong arg3, jint arg4, jint arg5, jint arg6, jlongArray arg7)
@@ -3350,6 +3542,39 @@ fail:
}
#endif
+#if (!defined(NO_VtblCall__II_3C_3I_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJ_3C_3I_3I) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__II_3C_3I_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jcharArray arg2, jintArray arg3, jintArray arg4)
+#else
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJ_3C_3I_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jcharArray arg2, jintArray arg3, jintArray arg4)
+#endif
+{
+ jchar *lparg2=NULL;
+ jint *lparg3=NULL;
+ jint *lparg4=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ COM_NATIVE_ENTER(env, that, VtblCall__II_3C_3I_3I_FUNC);
+#else
+ COM_NATIVE_ENTER(env, that, VtblCall__IJ_3C_3I_3I_FUNC);
+#endif
+ if (arg2) if ((lparg2 = (*env)->GetCharArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jchar *, jint *, jint *))(*(jintLong **)arg1)[arg0])(arg1, lparg2, lparg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseCharArrayElements(env, arg2, lparg2, 0);
+#ifndef JNI64
+ COM_NATIVE_EXIT(env, that, VtblCall__II_3C_3I_3I_FUNC);
+#else
+ COM_NATIVE_EXIT(env, that, VtblCall__IJ_3C_3I_3I_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#ifndef NO_VtblCall__IJIIIIJ
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IJIIIIJ)
(JNIEnv *env, jclass that, jint arg0, jlong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jlong arg6)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c
index 435385def1..7b1916910e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int COM_nativeFunctionCount = 175;
-int COM_nativeFunctionCallCount[175];
+int COM_nativeFunctionCount = 184;
+int COM_nativeFunctionCallCount[184];
char * COM_nativeFunctionNames[] = {
"AccessibleChildren",
"AccessibleObjectFromWindow",
@@ -149,6 +149,7 @@ char * COM_nativeFunctionNames[] = {
"SysAllocString",
"SysFreeString",
"SysStringByteLen",
+ "SysStringLen",
"TYPEATTR_1sizeof",
"TYPEDESC_1sizeof",
"VARDESC_1sizeof",
@@ -207,6 +208,11 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IJIILorg_eclipse_swt_internal_win32_POINT_2I",
#endif
#ifndef JNI64
+ "VtblCall__IIIIZ",
+#else
+ "VtblCall__IJJJZ",
+#endif
+#ifndef JNI64
"VtblCall__IIII_3I",
#else
"VtblCall__IJII_3I",
@@ -317,6 +323,11 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IJJI_3J",
#endif
#ifndef JNI64
+ "VtblCall__IIJJ",
+#else
+ "VtblCall__IJJJ",
+#endif
+#ifndef JNI64
"VtblCall__IIJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J",
#else
"VtblCall__IJJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J",
@@ -327,6 +338,11 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IJJJLorg_eclipse_swt_internal_win32_POINT_2I",
#endif
#ifndef JNI64
+ "VtblCall__IIJJ_3J",
+#else
+ "VtblCall__IJJJ_3J",
+#endif
+#ifndef JNI64
"VtblCall__IIJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J",
#else
"VtblCall__IJJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J",
@@ -452,11 +468,21 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2",
#endif
#ifndef JNI64
+ "VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2II",
+#else
+ "VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2II",
+#endif
+#ifndef JNI64
"VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2IZ",
#else
"VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2IZ",
#endif
#ifndef JNI64
+ "VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JJ",
+#else
+ "VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JJ",
+#endif
+#ifndef JNI64
"VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JZ",
#else
"VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JZ",
@@ -482,6 +508,11 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IJZ",
#endif
#ifndef JNI64
+ "VtblCall__IIZI",
+#else
+ "VtblCall__IJZJ",
+#endif
+#ifndef JNI64
"VtblCall__II_3CIIII_3I",
#else
"VtblCall__IJ_3CIIII_3I",
@@ -497,6 +528,11 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IJ_3CIII_3J",
#endif
#ifndef JNI64
+ "VtblCall__II_3CI_3I",
+#else
+ "VtblCall__IJ_3CI_3I",
+#endif
+#ifndef JNI64
"VtblCall__II_3CJIII_3J",
#else
"VtblCall__IJ_3CJIII_3J",
@@ -511,6 +547,11 @@ char * COM_nativeFunctionNames[] = {
#else
"VtblCall__IJ_3C_3C",
#endif
+#ifndef JNI64
+ "VtblCall__II_3C_3I_3I",
+#else
+ "VtblCall__IJ_3C_3I_3I",
+#endif
"VtblCall__IJIIIIJ",
#ifndef JNI64
"VtblCall__IJJIIIII",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h
index 0312728b1f..3a8cb4ae75 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h
@@ -157,6 +157,7 @@ typedef enum {
SysAllocString_FUNC,
SysFreeString_FUNC,
SysStringByteLen_FUNC,
+ SysStringLen_FUNC,
TYPEATTR_1sizeof_FUNC,
TYPEDESC_1sizeof_FUNC,
VARDESC_1sizeof_FUNC,
@@ -215,6 +216,11 @@ typedef enum {
VtblCall__IJIILorg_eclipse_swt_internal_win32_POINT_2I_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IIIIZ_FUNC,
+#else
+ VtblCall__IJJJZ_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IIII_3I_FUNC,
#else
VtblCall__IJII_3I_FUNC,
@@ -325,6 +331,11 @@ typedef enum {
VtblCall__IJJI_3J_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IIJJ_FUNC,
+#else
+ VtblCall__IJJJ_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IIJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J_FUNC,
#else
VtblCall__IJJJLorg_eclipse_swt_internal_ole_win32_GUID_2J_3J_FUNC,
@@ -335,6 +346,11 @@ typedef enum {
VtblCall__IJJJLorg_eclipse_swt_internal_win32_POINT_2I_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IIJJ_3J_FUNC,
+#else
+ VtblCall__IJJJ_3J_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IIJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J_FUNC,
#else
VtblCall__IJJLorg_eclipse_swt_internal_ole_win32_FORMATETC_2_3J_FUNC,
@@ -460,11 +476,21 @@ typedef enum {
VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2II_FUNC,
+#else
+ VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2II_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2IZ_FUNC,
#else
VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2IZ_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JJ_FUNC,
+#else
+ VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JJ_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2JZ_FUNC,
#else
VtblCall__IJLorg_eclipse_swt_internal_win32_RECT_2JZ_FUNC,
@@ -490,6 +516,11 @@ typedef enum {
VtblCall__IJZ_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IIZI_FUNC,
+#else
+ VtblCall__IJZJ_FUNC,
+#endif
+#ifndef JNI64
VtblCall__II_3CIIII_3I_FUNC,
#else
VtblCall__IJ_3CIIII_3I_FUNC,
@@ -505,6 +536,11 @@ typedef enum {
VtblCall__IJ_3CIII_3J_FUNC,
#endif
#ifndef JNI64
+ VtblCall__II_3CI_3I_FUNC,
+#else
+ VtblCall__IJ_3CI_3I_FUNC,
+#endif
+#ifndef JNI64
VtblCall__II_3CJIII_3J_FUNC,
#else
VtblCall__IJ_3CJIII_3J_FUNC,
@@ -519,6 +555,11 @@ typedef enum {
#else
VtblCall__IJ_3C_3C_FUNC,
#endif
+#ifndef JNI64
+ VtblCall__II_3C_3I_3I_FUNC,
+#else
+ VtblCall__IJ_3C_3I_3I_FUNC,
+#endif
VtblCall__IJIIIIJ_FUNC,
#ifndef JNI64
VtblCall__IJJIIIII_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c
index 7f6dab7ff3..78daed63b9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h
index 099dee8882..42ef159b8f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
index 45da37780e..95a99d2f8a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
@@ -37,6 +37,13 @@ AWT_LIB = $(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
AWT_LIBS = "$(JAVA_HOME)\jre\bin\jawt.lib"
AWT_OBJS = swt_awt.obj
+WEBKIT_DIR = C:\WebKit-r68077\WebKit-r68077
+WEBKIT_SUPPORT_DIR = C:\WebKit-r68077\WebKit-r68077\WebKitSupportLibrary\WebKitSupportLibrary
+WEBKIT_PREFIX = swt-webkit
+WEBKIT_LIB = $(WEBKIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
+WEBKIT_LIBS = $(WEBKIT_DIR)\lib\webkit.lib $(WEBKIT_SUPPORT_DIR)\win\lib\CFNetwork.lib $(WEBKIT_SUPPORT_DIR)\win\lib\CoreFoundation.lib
+WEBKIT_OBJS = webkit_win32.obj webkit_win32_stats.obj webkit_win32_custom.obj webkit_win32_structs.obj
+
WGL_PREFIX = swt-wgl
WGL_LIB = $(WGL_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
WGL_LIBS = opengl32.lib
@@ -62,6 +69,14 @@ MOZILLACFLAGS = -c \
-I"$(JAVA_HOME)/include/win32" \
-I"$(XULRUNNER_SDK)\include\mozilla-config.h" -I"$(XULRUNNER_SDK)\include"
+WEBKITCFLAGS = -c -O1\
+ -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) \
+ -I"$(JAVA_HOME)\include" -I"$(JAVA_HOME)\include\win32" \
+ -I"$(WEBKIT_DIR)" \
+ -I"$(WEBKIT_DIR)\WebKit\win" \
+ -I"$(WEBKIT_DIR)\JavaScriptCore\ForwardingHeaders" \
+ -I"$(WEBKIT_SUPPORT_DIR)\win\include"
+
#CFLAGS = $(cdebug) $(cflags) $(cvarsmt) $(CFLAGS) \
CFLAGS = -O1 -DNDEBUG $(cflags) $(cvarsmt) $(CFLAGS) \
-DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) -DUSE_ASSEMBLER \
@@ -70,6 +85,15 @@ RCFLAGS = $(rcflags) $(rcvars) $(RCFLAGS) -DSWT_FILE_VERSION=\"$(maj_ver).$(min_
all: make_swt make_awt make_gdip make_wgl
+webkit_win32_custom.obj: webkit_win32_custom.cpp
+ cl $(WEBKITCFLAGS) webkit_win32_custom.cpp
+webkit_win32_stats.obj: webkit_win32_stats.cpp
+ cl $(WEBKITCFLAGS) webkit_win32_stats.cpp
+webkit_win32_structs.obj: webkit_win32_structs.cpp
+ cl $(WEBKITCFLAGS) webkit_win32_structs.cpp
+webkit_win32.obj: webkit_win32.cpp
+ cl $(WEBKITCFLAGS) webkit_win32.cpp
+
xpcom_custom.obj: xpcom_custom.cpp
cl $(MOZILLACFLAGS) xpcom_custom.cpp
xpcom_stats.obj: xpcom_stats.cpp
@@ -118,6 +142,15 @@ make_awt: $(AWT_OBJS) swt_awt.res
link @templrf
del templrf
+make_webkit: $(WEBKIT_OBJS) swt_webkit.res
+ echo $(ldebug) $(dlllflags) >templrf
+ echo $(WEBKIT_LIBS) >>templrf
+ echo $(WEBKIT_OBJS) >>templrf
+ echo swt_webkit.res >>templrf
+ echo -out:$(WEBKIT_LIB) >>templrf
+ link @templrf
+ del templrf
+
make_wgl: $(WGL_OBJS) swt_wgl.res
echo $(ldebug) $(dlllflags) $(guilibsmt) >templrf
echo $(WGL_LIBS) >>templrf
@@ -145,6 +178,9 @@ swt_gdip.res:
swt_awt.res:
rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(AWT_LIB)\" -r -fo swt_awt.res swt_awt.rc
+swt_webkit.res:
+ rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(WEBKIT_LIB)\" -r -fo swt_webkit.res swt_webkit.rc
+
swt_wgl.res:
rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(WGL_LIB)\" -r -fo swt_wgl.res swt_wgl.rc
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
index fc48919765..ffa4735239 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
@@ -607,18 +607,52 @@ JNIEXPORT jint JNICALL OS_NATIVE(CREATESTRUCT_1sizeof)
}
#endif
-#ifndef NO_Call
-JNIEXPORT jint JNICALL OS_NATIVE(Call)
- (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#if (!defined(NO_Call__I) && !defined(JNI64)) || (!defined(NO_Call__J) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL OS_NATIVE(Call__I)(JNIEnv *env, jclass that, jintLong arg0)
+#else
+JNIEXPORT jint JNICALL OS_NATIVE(Call__J)(JNIEnv *env, jclass that, jintLong arg0)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, Call__I_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, Call__J_FUNC);
+#endif
+ rc = (jint)((jint (*)())arg0)();
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, Call__I_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, Call__J_FUNC);
+#endif
+ return rc;
+}
+#endif
+
+#if (!defined(NO_Call__ILorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2) && !defined(JNI64)) || (!defined(NO_Call__JLorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL OS_NATIVE(Call__ILorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#else
+JNIEXPORT jint JNICALL OS_NATIVE(Call__JLorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#endif
{
DLLVERSIONINFO _arg1, *lparg1=NULL;
jint rc = 0;
- OS_NATIVE_ENTER(env, that, Call_FUNC);
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, Call__ILorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, Call__JLorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2_FUNC);
+#endif
if (arg1) if ((lparg1 = getDLLVERSIONINFOFields(env, arg1, &_arg1)) == NULL) goto fail;
rc = (jint)((DLLGETVERSIONPROC)arg0)(lparg1);
fail:
if (arg1 && lparg1) setDLLVERSIONINFOFields(env, arg1, lparg1);
- OS_NATIVE_EXIT(env, that, Call_FUNC);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, Call__ILorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, Call__JLorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2_FUNC);
+#endif
return rc;
}
#endif
@@ -10847,6 +10881,48 @@ fail:
}
#endif
+#if (!defined(NO_MoveMemory___3D_3II) && !defined(JNI64)) || (!defined(NO_MoveMemory___3D_3JI) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL OS_NATIVE(MoveMemory___3D_3II)(JNIEnv *env, jclass that, jdoubleArray arg0, jintLongArray arg1, jint arg2)
+#else
+JNIEXPORT void JNICALL OS_NATIVE(MoveMemory___3D_3JI)(JNIEnv *env, jclass that, jdoubleArray arg0, jintLongArray arg1, jint arg2)
+#endif
+{
+ jdouble *lparg0=NULL;
+ jintLong *lparg1=NULL;
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, MoveMemory___3D_3II_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, MoveMemory___3D_3JI_FUNC);
+#endif
+ if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
+#ifdef JNI_VERSION_1_2
+ if (IS_JNI_1_2) {
+ if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
+ } else
+#endif
+ {
+ if (arg0) if ((lparg0 = (*env)->GetDoubleArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ }
+ MoveMemory((PVOID)lparg0, (CONST VOID *)lparg1, arg2);
+fail:
+#ifdef JNI_VERSION_1_2
+ if (IS_JNI_1_2) {
+ if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
+ } else
+#endif
+ {
+ if (arg0 && lparg0) (*env)->ReleaseDoubleArrayElements(env, arg0, lparg0, 0);
+ }
+ if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, MoveMemory___3D_3II_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, MoveMemory___3D_3JI_FUNC);
+#endif
+}
+#endif
+
#if (!defined(NO_MoveMemory___3FII) && !defined(JNI64)) || (!defined(NO_MoveMemory___3FJI) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(MoveMemory___3FII)(JNIEnv *env, jclass that, jfloatArray arg0, jintLong arg1, jint arg2)
@@ -17388,36 +17464,6 @@ fail:
}
#endif
-#if (!defined(NO_VtblCall__III_3I_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJI_3J_3I) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__III_3I_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jintLongArray arg3, jintArray arg4)
-#else
-JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IJI_3J_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jintLongArray arg3, jintArray arg4)
-#endif
-{
- jintLong *lparg3=NULL;
- jint *lparg4=NULL;
- jint rc = 0;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, VtblCall__III_3I_3I_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, VtblCall__IJI_3J_3I_FUNC);
-#endif
- if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
- if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
- rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jint, jintLong *, jint *))(*(jintLong **)arg1)[arg0])(arg1, arg2, lparg3, lparg4);
-fail:
- if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0);
-#ifndef JNI64
- OS_NATIVE_EXIT(env, that, VtblCall__III_3I_3I_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, VtblCall__IJI_3J_3I_FUNC);
-#endif
- return rc;
-}
-#endif
-
#if (!defined(NO_VtblCall__III_3J) && !defined(JNI64)) || (!defined(NO_VtblCall__IJI_3J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__III_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jlongArray arg3)
@@ -17491,6 +17537,33 @@ JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IJJI)(JNIEnv *env, jclass that, jint
}
#endif
+#if (!defined(NO_VtblCall__IIJII_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJII_3I) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IIJII_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jintArray arg5)
+#else
+JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IJJII_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jintArray arg5)
+#endif
+{
+ jint *lparg5=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, VtblCall__IIJII_3I_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, VtblCall__IJJII_3I_FUNC);
+#endif
+ if (arg5) if ((lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jint, jint, jint *))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4, lparg5);
+fail:
+ if (arg5 && lparg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, VtblCall__IIJII_3I_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, VtblCall__IJJII_3I_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IIJII_3J) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJII_3J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IIJII_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jlongArray arg5)
@@ -17568,6 +17641,36 @@ JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IJJJJ)(JNIEnv *env, jclass that, jint
}
#endif
+#if (!defined(NO_VtblCall__IIJ_3I_3I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJJ_3J_3J) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IIJ_3I_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jintLongArray arg3, jintLongArray arg4)
+#else
+JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IJJ_3J_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jintLongArray arg3, jintLongArray arg4)
+#endif
+{
+ jintLong *lparg3=NULL;
+ jintLong *lparg4=NULL;
+ jint rc = 0;
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, VtblCall__IIJ_3I_3I_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, VtblCall__IJJ_3J_3J_FUNC);
+#endif
+ if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetIntLongArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jintLong *, jintLong *))(*(jintLong **)arg1)[arg0])(arg1, arg2, lparg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseIntLongArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, VtblCall__IIJ_3I_3I_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, VtblCall__IJJ_3J_3J_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO_VtblCall__IILorg_eclipse_swt_internal_win32_PROPERTYKEY_2I) && !defined(JNI64)) || (!defined(NO_VtblCall__IJLorg_eclipse_swt_internal_win32_PROPERTYKEY_2I) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL OS_NATIVE(VtblCall__IILorg_eclipse_swt_internal_win32_PROPERTYKEY_2I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jobject arg2, jint arg3)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
index 60cc211391..ce04a26fc1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1009;
-int OS_nativeFunctionCallCount[1009];
+int OS_nativeFunctionCount = 1012;
+int OS_nativeFunctionCallCount[1012];
char * OS_nativeFunctionNames[] = {
"ACCEL_1sizeof",
"ACTCTX_1sizeof",
@@ -53,7 +53,16 @@ char * OS_nativeFunctionNames[] = {
"COMBOBOXINFO_1sizeof",
"COMPOSITIONFORM_1sizeof",
"CREATESTRUCT_1sizeof",
- "Call",
+#ifndef JNI64
+ "Call__I",
+#else
+ "Call__J",
+#endif
+#ifndef JNI64
+ "Call__ILorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2",
+#else
+ "Call__JLorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2",
+#endif
"CallNextHookEx",
"CallWindowProcA",
"CallWindowProcW",
@@ -1093,6 +1102,11 @@ char * OS_nativeFunctionNames[] = {
"MoveMemory___3DJI",
#endif
#ifndef JNI64
+ "MoveMemory___3D_3II",
+#else
+ "MoveMemory___3D_3JI",
+#endif
+#ifndef JNI64
"MoveMemory___3FII",
#else
"MoveMemory___3FJI",
@@ -1802,11 +1816,6 @@ char * OS_nativeFunctionNames[] = {
"VtblCall__IJI_3I",
#endif
#ifndef JNI64
- "VtblCall__III_3I_3I",
-#else
- "VtblCall__IJI_3J_3I",
-#endif
-#ifndef JNI64
"VtblCall__III_3J",
#else
"VtblCall__IJI_3J",
@@ -1822,6 +1831,11 @@ char * OS_nativeFunctionNames[] = {
"VtblCall__IJJI",
#endif
#ifndef JNI64
+ "VtblCall__IIJII_3I",
+#else
+ "VtblCall__IJJII_3I",
+#endif
+#ifndef JNI64
"VtblCall__IIJII_3J",
#else
"VtblCall__IJJII_3J",
@@ -1837,6 +1851,11 @@ char * OS_nativeFunctionNames[] = {
"VtblCall__IJJJJ",
#endif
#ifndef JNI64
+ "VtblCall__IIJ_3I_3I",
+#else
+ "VtblCall__IJJ_3J_3J",
+#endif
+#ifndef JNI64
"VtblCall__IILorg_eclipse_swt_internal_win32_PROPERTYKEY_2I",
#else
"VtblCall__IJLorg_eclipse_swt_internal_win32_PROPERTYKEY_2I",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
index 58b2e699cc..077523b5d4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
@@ -61,7 +61,16 @@ typedef enum {
COMBOBOXINFO_1sizeof_FUNC,
COMPOSITIONFORM_1sizeof_FUNC,
CREATESTRUCT_1sizeof_FUNC,
- Call_FUNC,
+#ifndef JNI64
+ Call__I_FUNC,
+#else
+ Call__J_FUNC,
+#endif
+#ifndef JNI64
+ Call__ILorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2_FUNC,
+#else
+ Call__JLorg_eclipse_swt_internal_win32_DLLVERSIONINFO_2_FUNC,
+#endif
CallNextHookEx_FUNC,
CallWindowProcA_FUNC,
CallWindowProcW_FUNC,
@@ -1101,6 +1110,11 @@ typedef enum {
MoveMemory___3DJI_FUNC,
#endif
#ifndef JNI64
+ MoveMemory___3D_3II_FUNC,
+#else
+ MoveMemory___3D_3JI_FUNC,
+#endif
+#ifndef JNI64
MoveMemory___3FII_FUNC,
#else
MoveMemory___3FJI_FUNC,
@@ -1810,11 +1824,6 @@ typedef enum {
VtblCall__IJI_3I_FUNC,
#endif
#ifndef JNI64
- VtblCall__III_3I_3I_FUNC,
-#else
- VtblCall__IJI_3J_3I_FUNC,
-#endif
-#ifndef JNI64
VtblCall__III_3J_FUNC,
#else
VtblCall__IJI_3J_FUNC,
@@ -1830,6 +1839,11 @@ typedef enum {
VtblCall__IJJI_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IIJII_3I_FUNC,
+#else
+ VtblCall__IJJII_3I_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IIJII_3J_FUNC,
#else
VtblCall__IJJII_3J_FUNC,
@@ -1845,6 +1859,11 @@ typedef enum {
VtblCall__IJJJJ_FUNC,
#endif
#ifndef JNI64
+ VtblCall__IIJ_3I_3I_FUNC,
+#else
+ VtblCall__IJJ_3J_3J_FUNC,
+#endif
+#ifndef JNI64
VtblCall__IILorg_eclipse_swt_internal_win32_PROPERTYKEY_2I_FUNC,
#else
VtblCall__IJLorg_eclipse_swt_internal_win32_PROPERTYKEY_2I_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
index 1b9c11bcb0..64686811b0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
@@ -645,6 +645,8 @@ public static final native int /*long*/ SysAllocString(char [] sz);
public static final native void SysFreeString(int /*long*/ bstr);
/** @param bstr cast=(BSTR) */
public static final native int SysStringByteLen(int /*long*/ bstr);
+/** @param bstr cast=(BSTR) */
+public static final native int SysStringLen(int /*long*/ bstr);
/**
* @param pvargDest cast=(VARIANTARG FAR* )
* @param pvarSrc cast=(VARIANTARG FAR* )
@@ -680,6 +682,7 @@ public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int a
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int[] arg2);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, long[] arg2);
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long[] arg2);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, long[] arg2);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1, int[] arg2);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int[] arg2);
@@ -716,6 +719,7 @@ public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int a
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, boolean arg1);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, boolean arg0);
+public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, boolean arg0, int /*long*/ arg1);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, CAUUID arg0);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, CONTROLINFO arg0);
@@ -733,6 +737,8 @@ public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, GUID
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, GUID arg0, int arg1, int arg2, int arg3, int[] arg4);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, GUID arg0, long arg1, int arg2, int arg3, int[] arg4);
+public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1);
+
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, GUID arg0, int arg1, int arg2, int arg3, int arg4);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, GUID arg0, int arg1, int arg2, long arg3, long arg4);
@@ -743,6 +749,9 @@ public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, LICIN
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, RECT arg0, int arg1, boolean arg2);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, RECT arg0, long arg1, boolean arg2);
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, RECT arg0, int arg1, int arg2);
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, RECT arg0, long arg1, long arg2);
+
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, RECT arg0, RECT arg1);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, RECT arg0);
@@ -755,6 +764,11 @@ public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int a
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, DISPPARAMS arg3, int arg4, EXCEPINFO arg5, int arg6);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, DISPPARAMS arg3, long arg4, EXCEPINFO arg5, long arg6);
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] pszPropName, int[] pVar, int[] pErrorLog);
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] pszPropName, int pVar, int[] pErrorLog);
+
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ type, int /*long*/ listener, boolean useCapture);
+
/** @param pStg cast=(IStorage *) */
public static final native int WriteClassStg(int /*long*/ pStg, GUID rclsid);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPropertyBag.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPropertyBag.java
new file mode 100644
index 0000000000..336bed5cac
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IPropertyBag.java
@@ -0,0 +1,17 @@
+package org.eclipse.swt.internal.ole.win32;
+
+public class IPropertyBag extends IUnknown {
+
+public IPropertyBag(int /*long*/ address) {
+ super(address);
+}
+
+public int Read (int /*long*/ pszPropName, int /*long*/ pVar, int /*long*/[] pErrorLog) {
+ return COM.VtblCall(3, getAddress(), pszPropName, pVar, pErrorLog);
+}
+
+public int Write (int /*long*/ propName, int /*long*/[] var, int /*long*/[] errorLog) {
+ return COM.VtblCall(4, getAddress(), propName, var, errorLog);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index 048a9aa3d8..c0774d7a47 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -1298,6 +1298,7 @@ public class OS extends C {
public static final int PD_ALLPAGES = 0x0;
public static final int PD_COLLATE = 0x10;
public static final int PD_PAGENUMS = 0x2;
+ public static final int PD_PRINTSETUP = 0x00000040;
public static final int PD_PRINTTOFILE = 0x20;
public static final int PD_RETURNDC = 0x100;
public static final int PD_RETURNDEFAULT = 0x00000400;
@@ -3479,6 +3480,7 @@ public static final native int BufferedPaintInit ();
public static final native int BufferedPaintSetAlpha (int /*long*/ hBufferedPaint, RECT prc, byte alpha);
/** @method flags=dynamic */
public static final native int BufferedPaintUnInit ();
+public static final native int Call (int /*long*/ address);
/** @param address cast=(DLLGETVERSIONPROC) */
public static final native int Call (int /*long*/ address, DLLVERSIONINFO arg0);
/**
@@ -5004,6 +5006,11 @@ public static final native void MoveMemory (double[] Destination, int /*long*/ S
* @param Destination cast=(PVOID),flags=no_in critical
* @param SourcePtr cast=(CONST VOID *)
*/
+public static final native void MoveMemory (double[] Destination, int /*long*/[] SourcePtr, int Length);
+/**
+ * @param Destination cast=(PVOID),flags=no_in critical
+ * @param SourcePtr cast=(CONST VOID *)
+ */
public static final native void MoveMemory (float[] Destination, int /*long*/ SourcePtr, int Length);
/**
* @param Destination cast=(PVOID),flags=no_in critical
@@ -6626,6 +6633,7 @@ public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, int
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long arg0);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int[] arg3);
+public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, int[] arg3);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, long[] arg3);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1, int arg2, long[] arg3);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long[] arg3);
@@ -6635,7 +6643,7 @@ public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, shor
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, int[] arg0);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long[] arg0);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int /*long*/[] arg1);
-public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, int arg0, int /*long*/[] arg1, int[] arg2);
+public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, long arg0, int /*long*/[] arg1, int /*long*/[] arg2);
public static final native int VtblCall (int fnNumber, int /*long*/ ppVtbl, TF_DISPLAYATTRIBUTE arg0);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1, long arg2);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/swt_webkit.rc b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/swt_webkit.rc
new file mode 100644
index 0000000000..8a642d17c8
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/swt_webkit.rc
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "windows.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION SWT_COMMA_VERSION
+ PRODUCTVERSION 0,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40000L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Eclipse Foundation\0"
+ VALUE "FileDescription", "SWT for Windows native library\0"
+ VALUE "FileVersion", SWT_FILE_VERSION
+ VALUE "InternalName", "SWT\0"
+ VALUE "LegalCopyright", "Copyright (c) 2010 IBM Corp. All Rights Reserved.\0"
+ VALUE "OriginalFilename", SWT_ORG_FILENAME
+ VALUE "ProductName", "Standard Widget Toolkit\0"
+ VALUE "ProductVersion", "0,0,0,0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.cpp b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.cpp
new file mode 100644
index 0000000000..2e90a15a0c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.cpp
@@ -0,0 +1,864 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "swt.h"
+#include "webkit_win32_structs.h"
+#include "webkit_win32_stats.h"
+
+#define WebKit_win32_NATIVE(func) Java_org_eclipse_swt_internal_webkit_WebKit_1win32_##func
+
+#ifndef NO_CFArrayGetCount
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFArrayGetCount)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFArrayGetCount)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFArrayGetCount_FUNC);
+ rc = (jint)CFArrayGetCount((CFArrayRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFArrayGetCount_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFArrayGetValueAtIndex
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFArrayGetValueAtIndex)(JNIEnv *env, jclass that, jintLong arg0, jint arg1);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFArrayGetValueAtIndex)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFArrayGetValueAtIndex_FUNC);
+ rc = (jintLong)CFArrayGetValueAtIndex((CFArrayRef)arg0, (CFIndex)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, CFArrayGetValueAtIndex_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFDataCreate
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFDataCreate)(JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFDataCreate)
+ (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2)
+{
+ jbyte *lparg1=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFDataCreate_FUNC);
+ if (arg1) if ((lparg1 = env->GetByteArrayElements(arg1, NULL)) == NULL) goto fail;
+ rc = (jintLong)CFDataCreate((CFAllocatorRef)arg0, (const UInt8 *)lparg1, (CFIndex)arg2);
+fail:
+ if (arg1 && lparg1) env->ReleaseByteArrayElements(arg1, lparg1, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFDataCreate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFDataGetBytePtr
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFDataGetBytePtr)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFDataGetBytePtr)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFDataGetBytePtr_FUNC);
+ rc = (jintLong)CFDataGetBytePtr((CFDataRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFDataGetBytePtr_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFDataGetLength
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFDataGetLength)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFDataGetLength)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFDataGetLength_FUNC);
+ rc = (jint)CFDataGetLength((CFDataRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFDataGetLength_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFDictionaryCreate
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFDictionaryCreate)(JNIEnv *env, jclass that, jint arg0, jintLongArray arg1, jintLongArray arg2, jint arg3, jintLong arg4, jintLong arg5);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFDictionaryCreate)
+ (JNIEnv *env, jclass that, jint arg0, jintLongArray arg1, jintLongArray arg2, jint arg3, jintLong arg4, jintLong arg5)
+{
+ jintLong *lparg1=NULL;
+ jintLong *lparg2=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFDictionaryCreate_FUNC);
+ if (arg1) if ((lparg1 = env->GetIntLongArrayElements(arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = env->GetIntLongArrayElements(arg2, NULL)) == NULL) goto fail;
+ rc = (jintLong)CFDictionaryCreate((CFAllocatorRef)arg0, (const void **)lparg1, (const void **)lparg2, (CFIndex)arg3, (const CFDictionaryKeyCallBacks *)arg4, (const CFDictionaryValueCallBacks *)arg5);
+fail:
+ if (arg2 && lparg2) env->ReleaseIntLongArrayElements(arg2, lparg2, 0);
+ if (arg1 && lparg1) env->ReleaseIntLongArrayElements(arg1, lparg1, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFDictionaryCreate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFDictionaryGetCount
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFDictionaryGetCount)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFDictionaryGetCount)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFDictionaryGetCount_FUNC);
+ rc = (jint)CFDictionaryGetCount((CFDictionaryRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFDictionaryGetCount_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieCreateWithResponseHeaderFields
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieCreateWithResponseHeaderFields)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieCreateWithResponseHeaderFields)
+ (JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieCreateWithResponseHeaderFields_FUNC);
+ rc = (jintLong)CFHTTPCookieCreateWithResponseHeaderFields((CFAllocatorRef)arg0, (CFDictionaryRef)arg1, (CFURLRef)arg2);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieCreateWithResponseHeaderFields_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieGetFlags
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieGetFlags)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieGetFlags)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieGetFlags_FUNC);
+ rc = (jintLong)CFHTTPCookieGetFlags((CFHTTPCookieRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieGetFlags_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieGetName
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieGetName)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieGetName)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieGetName_FUNC);
+ rc = (jintLong)CFHTTPCookieGetName((CFHTTPCookieRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieGetName_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieGetValue
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieGetValue)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieGetValue)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieGetValue_FUNC);
+ rc = (jintLong)CFHTTPCookieGetValue((CFHTTPCookieRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieGetValue_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieStorageCopyCookies
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageCopyCookies)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageCopyCookies)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieStorageCopyCookies_FUNC);
+ rc = (jintLong)CFHTTPCookieStorageCopyCookies((CFHTTPCookieStorageRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieStorageCopyCookies_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieStorageCopyCookiesForURL
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageCopyCookiesForURL)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageCopyCookiesForURL)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieStorageCopyCookiesForURL_FUNC);
+ rc = (jintLong)CFHTTPCookieStorageCopyCookiesForURL((CFHTTPCookieStorageRef)arg0, (CFURLRef)arg1, (Boolean)arg2);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieStorageCopyCookiesForURL_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFHTTPCookieStorageDeleteCookie
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageDeleteCookie)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageDeleteCookie)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieStorageDeleteCookie_FUNC);
+ CFHTTPCookieStorageDeleteCookie((CFHTTPCookieStorageRef)arg0, (CFHTTPCookieRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieStorageDeleteCookie_FUNC);
+}
+#endif
+
+#ifndef NO_CFHTTPCookieStorageSetCookie
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageSetCookie)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFHTTPCookieStorageSetCookie)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ WebKit_win32_NATIVE_ENTER(env, that, CFHTTPCookieStorageSetCookie_FUNC);
+ CFHTTPCookieStorageSetCookie((CFHTTPCookieStorageRef)arg0, (CFHTTPCookieRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, CFHTTPCookieStorageSetCookie_FUNC);
+}
+#endif
+
+#ifndef NO_CFRelease
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFRelease)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFRelease)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ WebKit_win32_NATIVE_ENTER(env, that, CFRelease_FUNC);
+ CFRelease((CFTypeRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFRelease_FUNC);
+}
+#endif
+
+#ifndef NO_CFRetain
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFRetain)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFRetain)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFRetain_FUNC);
+ rc = (jint)CFRetain((CFTypeRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFRetain_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFStringCreateWithCharacters
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFStringCreateWithCharacters)(JNIEnv *env, jclass that, jintLong arg0, jcharArray arg1, jint arg2);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFStringCreateWithCharacters)
+ (JNIEnv *env, jclass that, jintLong arg0, jcharArray arg1, jint arg2)
+{
+ jchar *lparg1=NULL;
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFStringCreateWithCharacters_FUNC);
+ if (arg1) if ((lparg1 = env->GetCharArrayElements(arg1, NULL)) == NULL) goto fail;
+ rc = (jint)CFStringCreateWithCharacters((CFAllocatorRef)arg0, (const UniChar *)lparg1, (CFIndex)arg2);
+fail:
+ if (arg1 && lparg1) env->ReleaseCharArrayElements(arg1, lparg1, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFStringCreateWithCharacters_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFStringGetCharacterAtIndex
+extern "C" JNIEXPORT jchar JNICALL WebKit_win32_NATIVE(CFStringGetCharacterAtIndex)(JNIEnv *env, jclass that, jintLong arg0, jint arg1);
+JNIEXPORT jchar JNICALL WebKit_win32_NATIVE(CFStringGetCharacterAtIndex)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ jchar rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFStringGetCharacterAtIndex_FUNC);
+ rc = (jchar)CFStringGetCharacterAtIndex((CFStringRef)arg0, (CFIndex)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, CFStringGetCharacterAtIndex_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFStringGetCharactersPtr
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFStringGetCharactersPtr)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFStringGetCharactersPtr)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFStringGetCharactersPtr_FUNC);
+ rc = (jintLong)CFStringGetCharactersPtr((CFStringRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFStringGetCharactersPtr_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFStringGetLength
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFStringGetLength)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(CFStringGetLength)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFStringGetLength_FUNC);
+ rc = (jint)CFStringGetLength((CFStringRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFStringGetLength_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFURLCreateWithString
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFURLCreateWithString)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFURLCreateWithString)
+ (JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFURLCreateWithString_FUNC);
+ rc = (jintLong)CFURLCreateWithString((CFAllocatorRef)arg0, (CFStringRef)arg1, (CFURLRef)arg2);
+ WebKit_win32_NATIVE_EXIT(env, that, CFURLCreateWithString_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFURLRequestCopyHTTPRequestBody
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFURLRequestCopyHTTPRequestBody)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFURLRequestCopyHTTPRequestBody)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, CFURLRequestCopyHTTPRequestBody_FUNC);
+ rc = (jintLong)CFURLRequestCopyHTTPRequestBody((CFURLRequestRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, CFURLRequestCopyHTTPRequestBody_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_CFURLRequestSetHTTPRequestBody
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFURLRequestSetHTTPRequestBody)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(CFURLRequestSetHTTPRequestBody)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ WebKit_win32_NATIVE_ENTER(env, that, CFURLRequestSetHTTPRequestBody_FUNC);
+ CFURLRequestSetHTTPRequestBody((CFMutableURLRequestRef)arg0, (CFDataRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, CFURLRequestSetHTTPRequestBody_FUNC);
+}
+#endif
+
+#ifndef NO_JSClassCreate
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSClassCreate)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSClassCreate)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSClassCreate_FUNC);
+ rc = (jintLong)JSClassCreate((const JSClassDefinition*)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSClassCreate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSClassDefinition_1sizeof
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSClassDefinition_1sizeof)(JNIEnv *env, jclass that);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSClassDefinition_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSClassDefinition_1sizeof_FUNC);
+ rc = (jint)JSClassDefinition_sizeof();
+ WebKit_win32_NATIVE_EXIT(env, that, JSClassDefinition_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSClassRetain
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSClassRetain)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSClassRetain)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSClassRetain_FUNC);
+ rc = (jintLong)JSClassRetain((JSClassRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSClassRetain_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSContextGetGlobalObject
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSContextGetGlobalObject)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSContextGetGlobalObject)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSContextGetGlobalObject_FUNC);
+ rc = (jintLong)JSContextGetGlobalObject((JSContextRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSContextGetGlobalObject_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSEvaluateScript
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSEvaluateScript)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jint arg4, jintLongArray arg5);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSEvaluateScript)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jint arg4, jintLongArray arg5)
+{
+ jintLong *lparg5=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSEvaluateScript_FUNC);
+ if (arg5) if ((lparg5 = env->GetIntLongArrayElements(arg5, NULL)) == NULL) goto fail;
+ rc = (jintLong)JSEvaluateScript((JSContextRef)arg0, (JSStringRef)arg1, (JSObjectRef)arg2, (JSStringRef)arg3, arg4, (JSValueRef *)lparg5);
+fail:
+ if (arg5 && lparg5) env->ReleaseIntLongArrayElements(arg5, lparg5, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSEvaluateScript_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSGlobalContextCreate
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSGlobalContextCreate)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSGlobalContextCreate)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSGlobalContextCreate_FUNC);
+ rc = (jint)JSGlobalContextCreate((JSClassRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSGlobalContextCreate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSGlobalContextRetain
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSGlobalContextRetain)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSGlobalContextRetain)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSGlobalContextRetain_FUNC);
+ rc = (jint)JSGlobalContextRetain((JSGlobalContextRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSGlobalContextRetain_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectGetPrivate
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetPrivate)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetPrivate)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectGetPrivate_FUNC);
+ rc = (jintLong)JSObjectGetPrivate((JSObjectRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectGetPrivate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectGetProperty
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetProperty)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLongArray arg3);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetProperty)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLongArray arg3)
+{
+ jintLong *lparg3=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectGetProperty_FUNC);
+ if (arg3) if ((lparg3 = env->GetIntLongArrayElements(arg3, NULL)) == NULL) goto fail;
+ rc = (jintLong)JSObjectGetProperty((JSContextRef)arg0, (JSObjectRef)arg1, (JSStringRef)arg2, (JSValueRef*)lparg3);
+fail:
+ if (arg3 && lparg3) env->ReleaseIntLongArrayElements(arg3, lparg3, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectGetProperty_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectGetPropertyAtIndex
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetPropertyAtIndex)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLongArray arg3);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetPropertyAtIndex)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLongArray arg3)
+{
+ jintLong *lparg3=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectGetPropertyAtIndex_FUNC);
+ if (arg3) if ((lparg3 = env->GetIntLongArrayElements(arg3, NULL)) == NULL) goto fail;
+ rc = (jintLong)JSObjectGetPropertyAtIndex((JSContextRef)arg0, (JSObjectRef)arg1, (unsigned)arg2, (JSValueRef*)lparg3);
+fail:
+ if (arg3 && lparg3) env->ReleaseIntLongArrayElements(arg3, lparg3, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectGetPropertyAtIndex_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectIsFunction
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSObjectIsFunction)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSObjectIsFunction)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectIsFunction_FUNC);
+ rc = (jint)JSObjectIsFunction((JSContextRef)arg0, (JSObjectRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectIsFunction_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectMake
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSObjectMake)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSObjectMake)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectMake_FUNC);
+ rc = (jint)JSObjectMake((JSContextRef)arg0, (JSClassRef)arg1, (void *)arg2);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectMake_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectMakeArray
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectMakeArray)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2, jintLongArray arg3);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectMakeArray)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2, jintLongArray arg3)
+{
+ jintLong *lparg2=NULL;
+ jintLong *lparg3=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectMakeArray_FUNC);
+ if (arg2) if ((lparg2 = env->GetIntLongArrayElements(arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = env->GetIntLongArrayElements(arg3, NULL)) == NULL) goto fail;
+ rc = (jintLong)JSObjectMakeArray((JSContextRef)arg0, (size_t)arg1, (const struct OpaqueJSValue * const*)lparg2, (JSValueRef*)lparg3);
+fail:
+ if (arg3 && lparg3) env->ReleaseIntLongArrayElements(arg3, lparg3, 0);
+ if (arg2 && lparg2) env->ReleaseIntLongArrayElements(arg2, lparg2, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectMakeArray_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectMakeFunctionWithCallback
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSObjectMakeFunctionWithCallback)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSObjectMakeFunctionWithCallback)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectMakeFunctionWithCallback_FUNC);
+ rc = (jint)JSObjectMakeFunctionWithCallback((JSContextRef)arg0, (JSStringRef)arg1, (JSObjectCallAsFunctionCallback)arg2);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectMakeFunctionWithCallback_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSObjectSetProperty
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(JSObjectSetProperty)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLongArray arg5);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(JSObjectSetProperty)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLongArray arg5)
+{
+ jintLong *lparg5=NULL;
+ WebKit_win32_NATIVE_ENTER(env, that, JSObjectSetProperty_FUNC);
+ if (arg5) if ((lparg5 = env->GetIntLongArrayElements(arg5, NULL)) == NULL) goto fail;
+ JSObjectSetProperty((JSContextRef)arg0, (JSObjectRef)arg1, (JSStringRef)arg2, (JSValueRef)arg3, (JSPropertyAttributes)arg4, (JSValueRef *)lparg5);
+fail:
+ if (arg5 && lparg5) env->ReleaseIntLongArrayElements(arg5, lparg5, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSObjectSetProperty_FUNC);
+}
+#endif
+
+#ifndef NO_JSStringCreateWithUTF8CString
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSStringCreateWithUTF8CString)(JNIEnv *env, jclass that, jbyteArray arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSStringCreateWithUTF8CString)
+ (JNIEnv *env, jclass that, jbyteArray arg0)
+{
+ jbyte *lparg0=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSStringCreateWithUTF8CString_FUNC);
+ if (arg0) if ((lparg0 = env->GetByteArrayElements(arg0, NULL)) == NULL) goto fail;
+ rc = (jintLong)JSStringCreateWithUTF8CString((const char*)lparg0);
+fail:
+ if (arg0 && lparg0) env->ReleaseByteArrayElements(arg0, lparg0, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSStringCreateWithUTF8CString_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSStringGetLength
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringGetLength)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringGetLength)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSStringGetLength_FUNC);
+ rc = (jint)JSStringGetLength((JSStringRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSStringGetLength_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSStringGetMaximumUTF8CStringSize
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSStringGetMaximumUTF8CStringSize)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSStringGetMaximumUTF8CStringSize)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSStringGetMaximumUTF8CStringSize_FUNC);
+ rc = (jintLong)JSStringGetMaximumUTF8CStringSize((JSStringRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSStringGetMaximumUTF8CStringSize_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSStringGetUTF8CString
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringGetUTF8CString)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringGetUTF8CString)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2)
+{
+ jbyte *lparg1=NULL;
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSStringGetUTF8CString_FUNC);
+ if (arg1) if ((lparg1 = env->GetByteArrayElements(arg1, NULL)) == NULL) goto fail;
+ rc = (jint)JSStringGetUTF8CString((JSStringRef)arg0, (char *)lparg1, (size_t)arg2);
+fail:
+ if (arg1 && lparg1) env->ReleaseByteArrayElements(arg1, lparg1, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSStringGetUTF8CString_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSStringIsEqualToUTF8CString
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringIsEqualToUTF8CString)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringIsEqualToUTF8CString)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSStringIsEqualToUTF8CString_FUNC);
+ if (arg1) if ((lparg1 = env->GetByteArrayElements(arg1, NULL)) == NULL) goto fail;
+ rc = (jint)JSStringIsEqualToUTF8CString((JSStringRef)arg0, (const char *)lparg1);
+fail:
+ if (arg1 && lparg1) env->ReleaseByteArrayElements(arg1, lparg1, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSStringIsEqualToUTF8CString_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSStringRelease
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(JSStringRelease)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(JSStringRelease)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ WebKit_win32_NATIVE_ENTER(env, that, JSStringRelease_FUNC);
+ JSStringRelease((JSStringRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSStringRelease_FUNC);
+}
+#endif
+
+#ifndef NO_JSValueGetType
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSValueGetType)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSValueGetType)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueGetType_FUNC);
+ rc = (jint)JSValueGetType((JSContextRef)arg0, (JSValueRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueGetType_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueIsObjectOfClass
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSValueIsObjectOfClass)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSValueIsObjectOfClass)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueIsObjectOfClass_FUNC);
+ rc = (jint)JSValueIsObjectOfClass((JSContextRef)arg0, (JSValueRef)arg1, (JSClassRef)arg2);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueIsObjectOfClass_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueMakeBoolean
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeBoolean)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeBoolean)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueMakeBoolean_FUNC);
+ rc = (jintLong)JSValueMakeBoolean((JSContextRef)arg0, (bool)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueMakeBoolean_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueMakeNull
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeNull)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeNull)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueMakeNull_FUNC);
+ rc = (jintLong)JSValueMakeNull((JSContextRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueMakeNull_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueMakeNumber
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeNumber)(JNIEnv *env, jclass that, jintLong arg0, jdouble arg1);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeNumber)
+ (JNIEnv *env, jclass that, jintLong arg0, jdouble arg1)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueMakeNumber_FUNC);
+ rc = (jintLong)JSValueMakeNumber((JSContextRef)arg0, (double)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueMakeNumber_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueMakeString
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeString)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeString)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueMakeString_FUNC);
+ rc = (jintLong)JSValueMakeString((JSContextRef)arg0, (JSStringRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueMakeString_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueMakeUndefined
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeUndefined)(JNIEnv *env, jclass that, jintLong arg0);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeUndefined)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueMakeUndefined_FUNC);
+ rc = (jintLong)JSValueMakeUndefined((JSContextRef)arg0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueMakeUndefined_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueProtect
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(JSValueProtect)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(JSValueProtect)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueProtect_FUNC);
+ JSValueProtect((JSContextRef)arg0, (JSValueRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueProtect_FUNC);
+}
+#endif
+
+#ifndef NO_JSValueToBoolean
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSValueToBoolean)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSValueToBoolean)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueToBoolean_FUNC);
+ rc = (jint)JSValueToBoolean((JSContextRef)arg0, (JSValueRef)arg1);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueToBoolean_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueToNumber
+extern "C" JNIEXPORT jdouble JNICALL WebKit_win32_NATIVE(JSValueToNumber)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2);
+JNIEXPORT jdouble JNICALL WebKit_win32_NATIVE(JSValueToNumber)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2)
+{
+ jintLong *lparg2=NULL;
+ jdouble rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueToNumber_FUNC);
+ if (arg2) if ((lparg2 = env->GetIntLongArrayElements(arg2, NULL)) == NULL) goto fail;
+ rc = (jdouble)JSValueToNumber((JSContextRef)arg0, (JSValueRef)arg1, (JSValueRef*)lparg2);
+fail:
+ if (arg2 && lparg2) env->ReleaseIntLongArrayElements(arg2, lparg2, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueToNumber_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_JSValueToStringCopy
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueToStringCopy)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueToStringCopy)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2)
+{
+ jintLong *lparg2=NULL;
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, JSValueToStringCopy_FUNC);
+ if (arg2) if ((lparg2 = env->GetIntLongArrayElements(arg2, NULL)) == NULL) goto fail;
+ rc = (jintLong)JSValueToStringCopy((JSContextRef)arg0, (JSValueRef)arg1, (JSValueRef*)lparg2);
+fail:
+ if (arg2 && lparg2) env->ReleaseIntLongArrayElements(arg2, lparg2, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, JSValueToStringCopy_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_WebKitCreateInstance
+extern "C" JNIEXPORT jint JNICALL WebKit_win32_NATIVE(WebKitCreateInstance)(JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jbyteArray arg2, jintLongArray arg3);
+JNIEXPORT jint JNICALL WebKit_win32_NATIVE(WebKitCreateInstance)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jbyteArray arg2, jintLongArray arg3)
+{
+ jbyte *lparg0=NULL;
+ jbyte *lparg2=NULL;
+ jintLong *lparg3=NULL;
+ jint rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, WebKitCreateInstance_FUNC);
+ if (arg0) if ((lparg0 = env->GetByteArrayElements(arg0, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = env->GetByteArrayElements(arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = env->GetIntLongArrayElements(arg3, NULL)) == NULL) goto fail;
+/*
+ rc = (jint)WebKitCreateInstance(lparg0, arg1, lparg2, lparg3);
+*/
+ {
+ LOAD_FUNCTION(fp, WebKitCreateInstance)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)(jbyte *, jintLong, jbyte *, jintLong *))fp)(lparg0, arg1, lparg2, lparg3);
+ }
+ }
+fail:
+ if (arg3 && lparg3) env->ReleaseIntLongArrayElements(arg3, lparg3, 0);
+ if (arg2 && lparg2) env->ReleaseByteArrayElements(arg2, lparg2, 0);
+ if (arg0 && lparg0) env->ReleaseByteArrayElements(arg0, lparg0, 0);
+ WebKit_win32_NATIVE_EXIT(env, that, WebKitCreateInstance_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_kCFCopyStringDictionaryKeyCallBacks
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(kCFCopyStringDictionaryKeyCallBacks)(JNIEnv *env, jclass that);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(kCFCopyStringDictionaryKeyCallBacks)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, kCFCopyStringDictionaryKeyCallBacks_FUNC);
+ rc = (jintLong)&kCFCopyStringDictionaryKeyCallBacks;
+ WebKit_win32_NATIVE_EXIT(env, that, kCFCopyStringDictionaryKeyCallBacks_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_kCFTypeDictionaryValueCallBacks
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(kCFTypeDictionaryValueCallBacks)(JNIEnv *env, jclass that);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(kCFTypeDictionaryValueCallBacks)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ WebKit_win32_NATIVE_ENTER(env, that, kCFTypeDictionaryValueCallBacks_FUNC);
+ rc = (jintLong)&kCFTypeDictionaryValueCallBacks;
+ WebKit_win32_NATIVE_EXIT(env, that, kCFTypeDictionaryValueCallBacks_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_memmove
+extern "C" JNIEXPORT void JNICALL WebKit_win32_NATIVE(memmove)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2);
+JNIEXPORT void JNICALL WebKit_win32_NATIVE(memmove)
+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
+{
+ JSClassDefinition _arg1, *lparg1=NULL;
+ WebKit_win32_NATIVE_ENTER(env, that, memmove_FUNC);
+ if (arg1) if ((lparg1 = getJSClassDefinitionFields(env, arg1, &_arg1)) == NULL) goto fail;
+ memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
+fail:
+ WebKit_win32_NATIVE_EXIT(env, that, memmove_FUNC);
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.h
new file mode 100644
index 0000000000..583f87673c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32.h
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef INC_webkit_win32_H
+#define INC_webkit_win32_H
+
+#include <ole2.h>
+#include <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSStringRef.h>
+#include <CFNetwork/CFHTTPCookiesPriv.h>
+#include <CFNetwork/CFURLRequestPriv.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebKitCOMAPI.h>
+#include "webkit_win32_custom.h"
+
+#endif /* INC_webkit_win32_H */
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.cpp b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.cpp
new file mode 100644
index 0000000000..71f8535e2c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.cpp
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "swt.h"
+#include "webkit_win32.h"
+#include "webkit_win32_stats.h"
+
+#define WebKit_win32_NATIVE(func) Java_org_eclipse_swt_internal_webkit_WebKit_1win32_##func
+
+#ifndef NO_willPerformClientRedirectToURL_1CALLBACK
+static jintLong willPerformClientRedirectToURL_CALLBACK;
+static HRESULT CALLBACK willPerformClientRedirectToURL(void* ppVTable, jintLong webView, BSTR url, double delaySeconds, DATE fireDate, jintLong frame)
+{
+ return ((HRESULT (CALLBACK *)(void*, jintLong, BSTR, double*, DATE*, jintLong))willPerformClientRedirectToURL_CALLBACK)(ppVTable, webView, url, &delaySeconds, &fireDate, frame);
+}
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(willPerformClientRedirectToURL_1CALLBACK) (JNIEnv *env, jclass that, jintLong func);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(willPerformClientRedirectToURL_1CALLBACK) (JNIEnv *env, jclass that, jintLong func)
+{
+ willPerformClientRedirectToURL_CALLBACK = func;
+ return (jintLong)willPerformClientRedirectToURL;
+}
+#endif
+
+#ifndef NO_JSObjectCallAsFunctionProc_1CALLBACK
+static jintLong JSObjectCallAsFunctionProc_CALLBACK;
+static JSValueRef JSObjectCallAsFunctionProc(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ return ((JSValueRef (CALLBACK *)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*))JSObjectCallAsFunctionProc_CALLBACK)(ctx, function, thisObject, argumentCount, arguments, exception);
+}
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectCallAsFunctionProc_1CALLBACK) (JNIEnv *env, jclass that, jintLong func);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectCallAsFunctionProc_1CALLBACK) (JNIEnv *env, jclass that, jintLong func)
+{
+ JSObjectCallAsFunctionProc_CALLBACK = func;
+ return (jintLong)JSObjectCallAsFunctionProc;
+}
+#endif
+
+#ifndef NO_JSObjectGetPropertyProc_1CALLBACK
+static jintLong JSObjectGetPropertyProc_CALLBACK;
+static JSValueRef JSObjectGetPropertyProc(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ return ((JSValueRef (CALLBACK *)(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*))JSObjectGetPropertyProc_CALLBACK)(ctx, object, propertyName, exception);
+}
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetPropertyProc_1CALLBACK) (JNIEnv *env, jclass that, jintLong func);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectGetPropertyProc_1CALLBACK) (JNIEnv *env, jclass that, jintLong func)
+{
+ JSObjectGetPropertyProc_CALLBACK = func;
+ return (jintLong)JSObjectGetPropertyProc;
+}
+#endif
+
+#ifndef NO_JSObjectHasPropertyProc_1CALLBACK
+static jintLong JSObjectHasPropertyProc_CALLBACK;
+static bool JSObjectHasPropertyProc(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
+{
+ return ((bool (CALLBACK *)(JSContextRef, JSObjectRef, JSStringRef))JSObjectHasPropertyProc_CALLBACK)(ctx, object, propertyName);
+}
+extern "C" JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectHasPropertyProc_1CALLBACK) (JNIEnv *env, jclass that, jintLong func);
+JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSObjectHasPropertyProc_1CALLBACK) (JNIEnv *env, jclass that, jintLong func)
+{
+ JSObjectHasPropertyProc_CALLBACK = func;
+ return (jintLong)JSObjectHasPropertyProc;
+}
+#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.h
new file mode 100644
index 0000000000..aaf00f4f02
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_custom.h
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/* Libraries for dynamic loaded functions */
+#define WebKitCreateInstance_LIB "webkit.dll"
+
+
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.cpp
new file mode 100644
index 0000000000..a1b72604a1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.cpp
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "swt.h"
+#include "webkit_win32_stats.h"
+
+#ifdef NATIVE_STATS
+
+int WebKit_win32_nativeFunctionCount = 64;
+int WebKit_win32_nativeFunctionCallCount[64];
+char * WebKit_win32_nativeFunctionNames[] = {
+ "CFArrayGetCount",
+ "CFArrayGetValueAtIndex",
+ "CFDataCreate",
+ "CFDataGetBytePtr",
+ "CFDataGetLength",
+ "CFDictionaryCreate",
+ "CFDictionaryGetCount",
+ "CFHTTPCookieCreateWithResponseHeaderFields",
+ "CFHTTPCookieGetFlags",
+ "CFHTTPCookieGetName",
+ "CFHTTPCookieGetValue",
+ "CFHTTPCookieStorageCopyCookies",
+ "CFHTTPCookieStorageCopyCookiesForURL",
+ "CFHTTPCookieStorageDeleteCookie",
+ "CFHTTPCookieStorageSetCookie",
+ "CFRelease",
+ "CFRetain",
+ "CFStringCreateWithCharacters",
+ "CFStringGetCharacterAtIndex",
+ "CFStringGetCharactersPtr",
+ "CFStringGetLength",
+ "CFURLCreateWithString",
+ "CFURLRequestCopyHTTPRequestBody",
+ "CFURLRequestSetHTTPRequestBody",
+ "JSClassCreate",
+ "JSClassDefinition_1sizeof",
+ "JSClassRetain",
+ "JSContextGetGlobalObject",
+ "JSEvaluateScript",
+ "JSGlobalContextCreate",
+ "JSGlobalContextRetain",
+ "JSObjectCallAsFunctionProc_1CALLBACK",
+ "JSObjectGetPrivate",
+ "JSObjectGetProperty",
+ "JSObjectGetPropertyAtIndex",
+ "JSObjectGetPropertyProc_1CALLBACK",
+ "JSObjectHasPropertyProc_1CALLBACK",
+ "JSObjectIsFunction",
+ "JSObjectMake",
+ "JSObjectMakeArray",
+ "JSObjectMakeFunctionWithCallback",
+ "JSObjectSetProperty",
+ "JSStringCreateWithUTF8CString",
+ "JSStringGetLength",
+ "JSStringGetMaximumUTF8CStringSize",
+ "JSStringGetUTF8CString",
+ "JSStringIsEqualToUTF8CString",
+ "JSStringRelease",
+ "JSValueGetType",
+ "JSValueIsObjectOfClass",
+ "JSValueMakeBoolean",
+ "JSValueMakeNull",
+ "JSValueMakeNumber",
+ "JSValueMakeString",
+ "JSValueMakeUndefined",
+ "JSValueProtect",
+ "JSValueToBoolean",
+ "JSValueToNumber",
+ "JSValueToStringCopy",
+ "WebKitCreateInstance",
+ "kCFCopyStringDictionaryKeyCallBacks",
+ "kCFTypeDictionaryValueCallBacks",
+ "memmove",
+ "willPerformClientRedirectToURL_1CALLBACK",
+};
+
+#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func
+
+JNIEXPORT jint JNICALL STATS_NATIVE(WebKit_1win32_1GetFunctionCount)
+ (JNIEnv *env, jclass that)
+{
+ return WebKit_win32_nativeFunctionCount;
+}
+
+JNIEXPORT jstring JNICALL STATS_NATIVE(WebKit_1win32_1GetFunctionName)
+ (JNIEnv *env, jclass that, jint index)
+{
+ return env->NewStringUTF(WebKit_win32_nativeFunctionNames[index]);
+}
+
+JNIEXPORT jint JNICALL STATS_NATIVE(WebKit_1win32_1GetFunctionCallCount)
+ (JNIEnv *env, jclass that, jint index)
+{
+ return WebKit_win32_nativeFunctionCallCount[index];
+}
+
+#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.h
new file mode 100644
index 0000000000..a6996cb411
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_stats.h
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifdef NATIVE_STATS
+extern int WebKit_win32_nativeFunctionCount;
+extern int WebKit_win32_nativeFunctionCallCount[];
+extern char* WebKit_win32_nativeFunctionNames[];
+#define WebKit_win32_NATIVE_ENTER(env, that, func) WebKit_win32_nativeFunctionCallCount[func]++;
+#define WebKit_win32_NATIVE_EXIT(env, that, func)
+#else
+#ifndef WebKit_win32_NATIVE_ENTER
+#define WebKit_win32_NATIVE_ENTER(env, that, func)
+#endif
+#ifndef WebKit_win32_NATIVE_EXIT
+#define WebKit_win32_NATIVE_EXIT(env, that, func)
+#endif
+#endif
+
+typedef enum {
+ CFArrayGetCount_FUNC,
+ CFArrayGetValueAtIndex_FUNC,
+ CFDataCreate_FUNC,
+ CFDataGetBytePtr_FUNC,
+ CFDataGetLength_FUNC,
+ CFDictionaryCreate_FUNC,
+ CFDictionaryGetCount_FUNC,
+ CFHTTPCookieCreateWithResponseHeaderFields_FUNC,
+ CFHTTPCookieGetFlags_FUNC,
+ CFHTTPCookieGetName_FUNC,
+ CFHTTPCookieGetValue_FUNC,
+ CFHTTPCookieStorageCopyCookies_FUNC,
+ CFHTTPCookieStorageCopyCookiesForURL_FUNC,
+ CFHTTPCookieStorageDeleteCookie_FUNC,
+ CFHTTPCookieStorageSetCookie_FUNC,
+ CFRelease_FUNC,
+ CFRetain_FUNC,
+ CFStringCreateWithCharacters_FUNC,
+ CFStringGetCharacterAtIndex_FUNC,
+ CFStringGetCharactersPtr_FUNC,
+ CFStringGetLength_FUNC,
+ CFURLCreateWithString_FUNC,
+ CFURLRequestCopyHTTPRequestBody_FUNC,
+ CFURLRequestSetHTTPRequestBody_FUNC,
+ JSClassCreate_FUNC,
+ JSClassDefinition_1sizeof_FUNC,
+ JSClassRetain_FUNC,
+ JSContextGetGlobalObject_FUNC,
+ JSEvaluateScript_FUNC,
+ JSGlobalContextCreate_FUNC,
+ JSGlobalContextRetain_FUNC,
+ JSObjectCallAsFunctionProc_1CALLBACK_FUNC,
+ JSObjectGetPrivate_FUNC,
+ JSObjectGetProperty_FUNC,
+ JSObjectGetPropertyAtIndex_FUNC,
+ JSObjectGetPropertyProc_1CALLBACK_FUNC,
+ JSObjectHasPropertyProc_1CALLBACK_FUNC,
+ JSObjectIsFunction_FUNC,
+ JSObjectMake_FUNC,
+ JSObjectMakeArray_FUNC,
+ JSObjectMakeFunctionWithCallback_FUNC,
+ JSObjectSetProperty_FUNC,
+ JSStringCreateWithUTF8CString_FUNC,
+ JSStringGetLength_FUNC,
+ JSStringGetMaximumUTF8CStringSize_FUNC,
+ JSStringGetUTF8CString_FUNC,
+ JSStringIsEqualToUTF8CString_FUNC,
+ JSStringRelease_FUNC,
+ JSValueGetType_FUNC,
+ JSValueIsObjectOfClass_FUNC,
+ JSValueMakeBoolean_FUNC,
+ JSValueMakeNull_FUNC,
+ JSValueMakeNumber_FUNC,
+ JSValueMakeString_FUNC,
+ JSValueMakeUndefined_FUNC,
+ JSValueProtect_FUNC,
+ JSValueToBoolean_FUNC,
+ JSValueToNumber_FUNC,
+ JSValueToStringCopy_FUNC,
+ WebKitCreateInstance_FUNC,
+ kCFCopyStringDictionaryKeyCallBacks_FUNC,
+ kCFTypeDictionaryValueCallBacks_FUNC,
+ memmove_FUNC,
+ willPerformClientRedirectToURL_1CALLBACK_FUNC,
+} WebKit_win32_FUNCS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.cpp b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.cpp
new file mode 100644
index 0000000000..eb7e448a21
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.cpp
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "swt.h"
+#include "webkit_win32_structs.h"
+
+#ifndef NO_JSClassDefinition
+typedef struct JSClassDefinition_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID version, attributes, className, parentClass, staticValues, staticFunctions, initialize, finalize, hasProperty, getProperty, setProperty, deleteProperty, getPropertyNames, callAsFunction, callAsConstructor, hasInstance, convertToType;
+} JSClassDefinition_FID_CACHE;
+
+JSClassDefinition_FID_CACHE JSClassDefinitionFc;
+
+void cacheJSClassDefinitionFields(JNIEnv *env, jobject lpObject)
+{
+ if (JSClassDefinitionFc.cached) return;
+ JSClassDefinitionFc.clazz = env->GetObjectClass(lpObject);
+ JSClassDefinitionFc.version = env->GetFieldID(JSClassDefinitionFc.clazz, "version", "I");
+ JSClassDefinitionFc.attributes = env->GetFieldID(JSClassDefinitionFc.clazz, "attributes", "I");
+ JSClassDefinitionFc.className = env->GetFieldID(JSClassDefinitionFc.clazz, "className", I_J);
+ JSClassDefinitionFc.parentClass = env->GetFieldID(JSClassDefinitionFc.clazz, "parentClass", I_J);
+ JSClassDefinitionFc.staticValues = env->GetFieldID(JSClassDefinitionFc.clazz, "staticValues", I_J);
+ JSClassDefinitionFc.staticFunctions = env->GetFieldID(JSClassDefinitionFc.clazz, "staticFunctions", I_J);
+ JSClassDefinitionFc.initialize = env->GetFieldID(JSClassDefinitionFc.clazz, "initialize", I_J);
+ JSClassDefinitionFc.finalize = env->GetFieldID(JSClassDefinitionFc.clazz, "finalize", I_J);
+ JSClassDefinitionFc.hasProperty = env->GetFieldID(JSClassDefinitionFc.clazz, "hasProperty", I_J);
+ JSClassDefinitionFc.getProperty = env->GetFieldID(JSClassDefinitionFc.clazz, "getProperty", I_J);
+ JSClassDefinitionFc.setProperty = env->GetFieldID(JSClassDefinitionFc.clazz, "setProperty", I_J);
+ JSClassDefinitionFc.deleteProperty = env->GetFieldID(JSClassDefinitionFc.clazz, "deleteProperty", I_J);
+ JSClassDefinitionFc.getPropertyNames = env->GetFieldID(JSClassDefinitionFc.clazz, "getPropertyNames", I_J);
+ JSClassDefinitionFc.callAsFunction = env->GetFieldID(JSClassDefinitionFc.clazz, "callAsFunction", I_J);
+ JSClassDefinitionFc.callAsConstructor = env->GetFieldID(JSClassDefinitionFc.clazz, "callAsConstructor", I_J);
+ JSClassDefinitionFc.hasInstance = env->GetFieldID(JSClassDefinitionFc.clazz, "hasInstance", I_J);
+ JSClassDefinitionFc.convertToType = env->GetFieldID(JSClassDefinitionFc.clazz, "convertToType", I_J);
+ JSClassDefinitionFc.cached = 1;
+}
+
+JSClassDefinition *getJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct)
+{
+ if (!JSClassDefinitionFc.cached) cacheJSClassDefinitionFields(env, lpObject);
+ lpStruct->version = env->GetIntField(lpObject, JSClassDefinitionFc.version);
+ lpStruct->attributes = (JSClassAttributes)env->GetIntField(lpObject, JSClassDefinitionFc.attributes);
+ lpStruct->className = (const char*)env->GetIntLongField(lpObject, JSClassDefinitionFc.className);
+ lpStruct->parentClass = (JSClassRef)env->GetIntLongField(lpObject, JSClassDefinitionFc.parentClass);
+ lpStruct->staticValues = (const JSStaticValue*)env->GetIntLongField(lpObject, JSClassDefinitionFc.staticValues);
+ lpStruct->staticFunctions = (const JSStaticFunction*)env->GetIntLongField(lpObject, JSClassDefinitionFc.staticFunctions);
+ lpStruct->initialize = (JSObjectInitializeCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.initialize);
+ lpStruct->finalize = (JSObjectFinalizeCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.finalize);
+ lpStruct->hasProperty = (JSObjectHasPropertyCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.hasProperty);
+ lpStruct->getProperty = (JSObjectGetPropertyCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.getProperty);
+ lpStruct->setProperty = (JSObjectSetPropertyCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.setProperty);
+ lpStruct->deleteProperty = (JSObjectDeletePropertyCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.deleteProperty);
+ lpStruct->getPropertyNames = (JSObjectGetPropertyNamesCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.getPropertyNames);
+ lpStruct->callAsFunction = (JSObjectCallAsFunctionCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.callAsFunction);
+ lpStruct->callAsConstructor = (JSObjectCallAsConstructorCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.callAsConstructor);
+ lpStruct->hasInstance = (JSObjectHasInstanceCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.hasInstance);
+ lpStruct->convertToType = (JSObjectConvertToTypeCallback)env->GetIntLongField(lpObject, JSClassDefinitionFc.convertToType);
+ return lpStruct;
+}
+
+void setJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct)
+{
+ if (!JSClassDefinitionFc.cached) cacheJSClassDefinitionFields(env, lpObject);
+ env->SetIntField(lpObject, JSClassDefinitionFc.version, (jint)lpStruct->version);
+ env->SetIntField(lpObject, JSClassDefinitionFc.attributes, (jint)lpStruct->attributes);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.className, (jintLong)lpStruct->className);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.parentClass, (jintLong)lpStruct->parentClass);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.staticValues, (jintLong)lpStruct->staticValues);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.staticFunctions, (jintLong)lpStruct->staticFunctions);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.initialize, (jintLong)lpStruct->initialize);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.finalize, (jintLong)lpStruct->finalize);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.hasProperty, (jintLong)lpStruct->hasProperty);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.getProperty, (jintLong)lpStruct->getProperty);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.setProperty, (jintLong)lpStruct->setProperty);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.deleteProperty, (jintLong)lpStruct->deleteProperty);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.getPropertyNames, (jintLong)lpStruct->getPropertyNames);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.callAsFunction, (jintLong)lpStruct->callAsFunction);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.callAsConstructor, (jintLong)lpStruct->callAsConstructor);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.hasInstance, (jintLong)lpStruct->hasInstance);
+ env->SetIntLongField(lpObject, JSClassDefinitionFc.convertToType, (jintLong)lpStruct->convertToType);
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.h
new file mode 100644
index 0000000000..da76659df5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library/webkit_win32_structs.h
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "webkit_win32.h"
+
+#ifndef NO_JSClassDefinition
+void cacheJSClassDefinitionFields(JNIEnv *env, jobject lpObject);
+JSClassDefinition *getJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct);
+void setJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct);
+#define JSClassDefinition_sizeof() sizeof(JSClassDefinition)
+#else
+#define cacheJSClassDefinitionFields(a,b)
+#define getJSClassDefinitionFields(a,b,c) NULL
+#define setJSClassDefinitionFields(a,b,c)
+#define JSClassDefinition_sizeof() 0
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java
new file mode 100644
index 0000000000..596db47482
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java
@@ -0,0 +1,268 @@
+package org.eclipse.swt.browser;
+
+import java.io.File;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.Compatibility;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.COMObject;
+import org.eclipse.swt.internal.ole.win32.GUID;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+import org.eclipse.swt.internal.webkit.IWebDownload;
+import org.eclipse.swt.internal.webkit.IWebMutableURLRequest;
+import org.eclipse.swt.internal.webkit.IWebURLResponse;
+import org.eclipse.swt.internal.webkit.WebKit_win32;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+
+public class WebDownloadDelegate {
+ COMObject iWebDownloadDelegate;
+ int refCount = 0;
+
+ Browser browser;
+ int status = -1;
+ int size;
+ long totalSize;
+ String url;
+
+ static final int DOWNLOAD_FINISHED = 0;
+ static final int DOWNLOAD_CANCELLED = 1;
+ static final int DOWNLOAD_ERROR = 3;
+
+WebDownloadDelegate() {
+ createCOMInterfaces();
+}
+
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+
+void createCOMInterfaces () {
+ iWebDownloadDelegate = new COMObject (new int[] {2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return decideDestinationWithSuggestedFilename(args[0], args[1]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method5 (int /*long*/[] args) {return didCreateDestination(args[0], args[1]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return didFailWithError(args[0], args[1]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method8 (int /*long*/[] args) {return didReceiveDataOfLength(args[0], args[1]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return didReceiveResponse(args[0], args[1]);}
+ public int /*long*/ method10 (int /*long*/[] args){return COM.E_NOTIMPL;}
+ public int /*long*/ method11 (int /*long*/[] args){return COM.E_NOTIMPL;}
+ public int /*long*/ method12 (int /*long*/[] args){return willSendRequest(args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method13 (int /*long*/[] args){return didBegin(args[0]);}
+ public int /*long*/ method14 (int /*long*/[] args){return didFinish(args[0]);}
+ };
+}
+
+int decideDestinationWithSuggestedFilename(int /*long*/ download, int /*long*/ filename) {
+ String name = WebKit.extractBSTR(filename);
+ FileDialog dialog = new FileDialog(browser.getShell(), SWT.SAVE);
+ dialog.setText(SWT.getMessage ("SWT_FileDownload")); //$NON-NLS-1$
+ dialog.setFileName(name);
+ dialog.setOverwrite(true);
+ String path = dialog.open();
+ IWebDownload iwebdownload = new IWebDownload(download);
+ iwebdownload.setDeletesFileUponFailure(false);
+ if (path == null) {
+ /* cancel pressed */
+ // cancelling the download here causes crash, so set the cancelled status and call cancel in didCreateDestination
+ // iwebdownload.cancel();
+ status = DOWNLOAD_CANCELLED;
+ iwebdownload.setDestination(WebKit.createBSTR(""), true); //$NON-NLS-1$
+ } else {
+ File file = new File(path);
+ if (file.exists()) file.delete();
+ iwebdownload.setDestination(WebKit.createBSTR(path), true);
+ openDownloadWindow(download, path);
+ }
+ return COM.S_OK;
+}
+
+int didBegin(int /*long*/ download) {
+ new IWebDownload(download).AddRef();
+ status = -1;
+ size = 0;
+ totalSize = 0;
+ url = null;
+ return COM.S_OK;
+}
+
+int didCreateDestination(int /*long*/ download, int /*long*/ destination) {
+ if (status == DOWNLOAD_CANCELLED) {
+ /* user cancelled download in the file dialog */
+ IWebDownload iwebdownload = new IWebDownload(download);
+ iwebdownload.cancel();
+ new IWebDownload(download).Release();
+ }
+ return COM.S_OK;
+}
+
+int didFailWithError(int /*long*/ download, int /*long*/ error) {
+ new IWebDownload(download).Release();
+ status = DOWNLOAD_ERROR;
+ return COM.S_OK;
+}
+
+int didFinish(int /*long*/ download) {
+ new IWebDownload(download).Release();
+ status = DOWNLOAD_FINISHED;
+ return COM.S_OK;
+}
+
+int didReceiveDataOfLength(int /*long*/ download, int /*long*/ length) {
+ size += length;
+ return COM.S_OK;
+ }
+
+int didReceiveResponse(int /*long*/ download, int /*long*/ response) {
+ if (response != 0) {
+ IWebURLResponse urlResponse = new IWebURLResponse(response);
+ long [] size = new long [1];
+ int hr = urlResponse.expectedContentLength(size);
+ if (hr == COM.S_OK) totalSize = size[0];
+ int /*long*/[] result = new int /*long*/ [1];
+ hr = urlResponse.URL(result);
+ if (hr == COM.S_OK && result[0] !=0) {
+ url = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ }
+ }
+ return COM.S_OK;
+}
+
+void disposeCOMInterfaces () {
+ System.out.println ("======== disposing iWebDownloadDelegate");
+ if (iWebDownloadDelegate != null) {
+ iWebDownloadDelegate.dispose ();
+ iWebDownloadDelegate = null;
+ }
+}
+
+int /*long*/ getAddress () {
+ return iWebDownloadDelegate.getAddress ();
+}
+
+void openDownloadWindow (final int /*long*/ webkitDownload, String name) {
+ final Shell shell = new Shell ();
+ shell.setText (Compatibility.getMessage ("SWT_FileDownload")); //$NON-NLS-1$
+ GridLayout gridLayout = new GridLayout ();
+ gridLayout.marginHeight = 15;
+ gridLayout.marginWidth = 15;
+ gridLayout.verticalSpacing = 20;
+ shell.setLayout (gridLayout);
+
+ Label nameLabel = new Label (shell, SWT.WRAP);
+ nameLabel.setText (Compatibility.getMessage ("SWT_Download_Location", new Object[] {name, url})); //$NON-NLS-1$
+ GridData data = new GridData ();
+ Monitor monitor = browser.getMonitor ();
+ int maxWidth = monitor.getBounds ().width / 2;
+ int width = nameLabel.computeSize (SWT.DEFAULT, SWT.DEFAULT).x;
+ data.widthHint = Math.min (width, maxWidth);
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ nameLabel.setLayoutData (data);
+
+ final Label statusLabel = new Label (shell, SWT.NONE);
+ statusLabel.setText (Compatibility.getMessage ("SWT_Download_Started")); //$NON-NLS-1$
+ data = new GridData (GridData.FILL_BOTH);
+ statusLabel.setLayoutData (data);
+
+ final Button cancel = new Button (shell, SWT.PUSH);
+ cancel.setText (Compatibility.getMessage ("SWT_Cancel")); //$NON-NLS-1$
+ data = new GridData ();
+ data.horizontalAlignment = GridData.CENTER;
+ cancel.setLayoutData (data);
+ final Listener cancelListener = new Listener () {
+ public void handleEvent (Event event) {
+ IWebDownload iwebdownload = new IWebDownload(webkitDownload);
+ iwebdownload.cancel();
+ status = DOWNLOAD_CANCELLED;
+ iwebdownload.Release();
+ }
+ };
+ cancel.addListener (SWT.Selection, cancelListener);
+
+ final Display display = browser.getDisplay ();
+ final int INTERVAL = 500;
+ display.timerExec (INTERVAL, new Runnable () {
+ public void run () {
+ if (shell.isDisposed () || status == DOWNLOAD_FINISHED || status == DOWNLOAD_CANCELLED) {
+ shell.dispose ();
+ display.timerExec (-1, this);
+ return;
+ }
+ if (status == DOWNLOAD_ERROR) {
+ statusLabel.setText (Compatibility.getMessage ("SWT_Download_Error")); //$NON-NLS-1$
+ display.timerExec (-1, this);
+ cancel.removeListener (SWT.Selection, cancelListener);
+ cancel.addListener (SWT.Selection, new Listener () {
+ public void handleEvent (Event event) {
+ shell.dispose ();
+ }
+ });
+ return;
+ }
+ long current = size / 1024L;
+ long total = totalSize / 1024L;
+ String message = Compatibility.getMessage ("SWT_Download_Status", new Object[] {new Long(current), new Long(total)}); //$NON-NLS-1$
+ statusLabel.setText (message);
+ display.timerExec (INTERVAL, this);
+ }
+ });
+ shell.pack ();
+ shell.open ();
+}
+
+int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG;
+ GUID guid = new GUID ();
+ COM.MoveMemory (guid, riid, GUID.sizeof);
+
+ if (COM.IsEqualGUID (guid, COM.IIDIUnknown)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebDownloadDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebDownloadDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID (guid, WebKit_win32.IID_IWebDownloadDelegate)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebDownloadDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebDownloadDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+
+ COM.MoveMemory (ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ return COM.E_NOINTERFACE;
+}
+
+int Release () {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces ();
+ }
+ return refCount;
+}
+
+void setBrowser(Browser browser) {
+ this.browser = browser;
+}
+
+int willSendRequest(int /*long*/ download, int /*long*/ request, int /*long*/ redirectResponse, int /*long*/ finalRequest) {
+ IWebMutableURLRequest req = new IWebMutableURLRequest(request);
+ req.AddRef();
+ OS.MoveMemory (finalRequest, new int /*long*/[] {request}, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java
new file mode 100644
index 0000000000..fed6754f2c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java
@@ -0,0 +1,623 @@
+package org.eclipse.swt.browser;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.Compatibility;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.COMObject;
+import org.eclipse.swt.internal.ole.win32.GUID;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+import org.eclipse.swt.internal.webkit.IWebDataSource;
+import org.eclipse.swt.internal.webkit.IWebError;
+import org.eclipse.swt.internal.webkit.IWebFrame;
+import org.eclipse.swt.internal.webkit.IWebMutableURLRequest;
+import org.eclipse.swt.internal.webkit.IWebURLRequest;
+import org.eclipse.swt.internal.webkit.IWebView;
+import org.eclipse.swt.internal.webkit.WebKit_win32;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+
+public class WebFrameLoadDelegate {
+ COMObject iWebFrameLoadDelegate;
+ int refCount = 0;
+
+ Browser browser;
+ String html;
+ String url;
+
+ static final String OBJECTNAME_EXTERNAL = "external"; //$NON-NLS-1$
+
+WebFrameLoadDelegate() {
+ createCOMInterfaces();
+}
+
+void addEventHandlers (boolean top) {
+ if (top) {
+ StringBuffer buffer = new StringBuffer ("window.SWTkeyhandler = function SWTkeyhandler(e) {"); //$NON-NLS-1$
+ buffer.append ("try {e.returnValue = HandleWebKitEvent(e.type, e.keyCode, e.charCode, e.altKey, e.ctrlKey, e.shiftKey, e.metaKey);} catch (e) {}};"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('keydown', SWTkeyhandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('keypress', SWTkeyhandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('keyup', SWTkeyhandler, true);"); //$NON-NLS-1$
+ browser.execute (buffer.toString ());
+
+ buffer = new StringBuffer ("window.SWTmousehandler = function SWTmousehandler(e) {"); //$NON-NLS-1$
+ buffer.append ("try {e.returnValue = HandleWebKitEvent(e.type, e.screenX, e.screenY, e.detail, e.button + 1, e.altKey, e.ctrlKey, e.shiftKey, e.metaKey, e.relatedTarget != null);} catch (e) {}};"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('mousedown', SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('mouseup', SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('mousemove', SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('mousewheel', SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('dragstart', SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('mouseover', SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("document.addEventListener('mouseout', SWTmousehandler, true);"); //$NON-NLS-1$
+
+ browser.execute (buffer.toString ());
+ } else {
+ StringBuffer buffer = new StringBuffer ("for (var i = 0; i < frames.length; i++) {"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('keydown', window.SWTkeyhandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('keypress', window.SWTkeyhandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('keyup', window.SWTkeyhandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('mousedown', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('mouseup', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('mousemove', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('mouseover', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('mouseout', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('mousewheel', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ("frames[i].document.addEventListener('dragstart', window.SWTmousehandler, true);"); //$NON-NLS-1$
+ buffer.append ('}');
+ browser.execute (buffer.toString ());
+ }
+}
+
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+
+void createCOMInterfaces () {
+ iWebFrameLoadDelegate = new COMObject (new int[] {2, 0, 0, 2, 2, 3, 2, 3, 3, 2, 3, 2, 5, 2, 2, 3, 4}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return didStartProvisionalLoadForFrame (args[0], args[1]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method5 (int /*long*/[] args) {return didFailProvisionalLoadWithError (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return didCommitLoadForFrame (args[0], args[1]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return didReceiveTitle (args[0], args[1], args[2]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method9 (int /*long*/[] args) {return didFinishLoadForFrame (args[0], args[1]);}
+ public int /*long*/ method10 (int /*long*/[] args){return COM.E_NOTIMPL;}
+ public int /*long*/ method11 (int /*long*/[] args){return didChangeLocationWithinPageForFrame (args[0], args[1]);}
+ public int /*long*/ method12 (int /*long*/[] args){return COM.S_OK;}
+ public int /*long*/ method13 (int /*long*/[] args){return COM.E_NOTIMPL;}
+ public int /*long*/ method14 (int /*long*/[] args){return COM.S_OK;}
+ public int /*long*/ method15 (int /*long*/[] args){return COM.S_OK;}
+ public int /*long*/ method16 (int /*long*/[] args){return didClearWindowObject(args[0], args[1], args[2], args[3]);}
+ };
+
+ /* Callbacks that take double parameters require custom callbacks that instead pass pointers to the doubles. */
+ int /*long*/ ppVtable = iWebFrameLoadDelegate.ppVtable;
+ int /*long*/[] pVtable = new int /*long*/[1];
+ COM.MoveMemory (pVtable, ppVtable, OS.PTR_SIZEOF);
+ int /*long*/[] funcs = new int /*long*/[17];
+ COM.MoveMemory (funcs, pVtable[0], OS.PTR_SIZEOF * funcs.length);
+ funcs[12] = WebKit_win32.willPerformClientRedirectToURL_CALLBACK (funcs[12]);
+ COM.MoveMemory (pVtable[0], funcs, OS.PTR_SIZEOF * funcs.length);
+}
+
+int didChangeLocationWithinPageForFrame(int /*long*/ webView, int /*long*/ frame) {
+ IWebFrame iwebframe = new IWebFrame(frame);
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = iwebframe.dataSource(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebDataSource dataSource = new IWebDataSource(result[0]);
+ result[0] = 0;
+ hr = dataSource.request(result);
+ dataSource.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebURLRequest request = new IWebURLRequest(result[0]);
+ result[0] = 0;
+ hr = request.URL(result);
+ request.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String url2 = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ if (url2.length() == 0) return COM.S_OK;
+ /*
+ * If the URI indicates that the page is being rendered from memory
+ * (via setText()) then set it to about:blank to be consistent with IE.
+ */
+ if (url2.equals (WebKit.URI_FILEROOT)) {
+ url2 = WebKit.ABOUT_BLANK;
+ } else {
+ int length = WebKit.URI_FILEROOT.length ();
+ if (url2.startsWith (WebKit.URI_FILEROOT) && url2.charAt (length) == '#') {
+ url2 = WebKit.ABOUT_BLANK + url2.substring (length);
+ }
+ }
+ final Display display = browser.getDisplay();
+ result[0] = 0;
+ IWebView iWebView = new IWebView(webView);
+ hr = iWebView.mainFrame(result);
+ boolean top = false;
+ if (hr == COM.S_OK && result[0] != 0) {
+ top = frame == result[0];
+ new IWebFrame(result[0]).Release();
+ }
+ if (top) {
+ StatusTextEvent statusText = new StatusTextEvent(browser);
+ statusText.display = display;
+ statusText.widget = browser;
+ statusText.text = url2;
+ StatusTextListener[] statusTextListeners = browser.webBrowser.statusTextListeners;
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed(statusText);
+ }
+ }
+
+ LocationEvent location = new LocationEvent(browser);
+ location.display = display;
+ location.widget = browser;
+ location.location = url2;
+ location.top = top;
+ LocationListener[] locationListeners = browser.webBrowser.locationListeners;
+ for (int i = 0; i < locationListeners.length; i++) {
+ locationListeners[i].changed(location);
+ }
+ return COM.S_OK;
+}
+
+int didClearWindowObject(int /*long*/ webView, int /*long*/ context, int /*long*/ windowScriptObject, int /*long*/ frame) {
+ WebKit_win32.JSGlobalContextRetain(context);
+ int /*long*/ globalObject = WebKit_win32.JSContextGetGlobalObject (context);
+ int /*long*/ privateData = ((WebKit)browser.webBrowser).webViewData;
+ int /*long*/ externalObject = WebKit_win32.JSObjectMake (context, WebKit.ExternalClass, privateData);
+ byte[] bytes = null;
+ try {
+ bytes = (OBJECTNAME_EXTERNAL + '\0').getBytes (WebKit.CHARSET_UTF8);
+ } catch (UnsupportedEncodingException e) {
+ bytes = (OBJECTNAME_EXTERNAL + '\0').getBytes ();
+ }
+ int /*long*/ name = WebKit_win32.JSStringCreateWithUTF8CString (bytes);
+ WebKit_win32.JSObjectSetProperty (context, globalObject, name, externalObject, 0, null);
+ WebKit_win32.JSStringRelease (name);
+
+ Enumeration elements = browser.webBrowser.functions.elements ();
+ while (elements.hasMoreElements ()) {
+ BrowserFunction current = (BrowserFunction)elements.nextElement ();
+ browser.execute (current.functionString);
+ }
+
+ IWebView iwebView = new IWebView(webView);
+ int /*long*/[] mainFrame = new int /*long*/[1];
+ iwebView.mainFrame(mainFrame);
+ boolean top = mainFrame[0] == frame;
+ addEventHandlers (top);
+ return COM.S_OK;
+}
+
+int didCommitLoadForFrame(int /*long*/ webview, int /*long*/ frame) {
+ IWebFrame iWebFrame = new IWebFrame(frame);
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = iWebFrame.dataSource(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebDataSource dataSource = new IWebDataSource(result[0]);
+ result[0] = 0;
+ hr = dataSource.request(result);
+ dataSource.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebMutableURLRequest request = new IWebMutableURLRequest(result[0]);
+ result[0] = 0;
+ hr = request.URL(result);
+ request.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String url2 = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ if (url2.length() == 0) return COM.S_OK;
+ /*
+ * If the URI indicates that the page is being rendered from memory
+ * (via setText()) then set it to about:blank to be consistent with IE.
+ */
+ if (url2.equals (WebKit.URI_FILEROOT)) {
+ url2 = WebKit.ABOUT_BLANK;
+ } else {
+ int length = WebKit.URI_FILEROOT.length ();
+ if (url2.startsWith (WebKit.URI_FILEROOT) && url2.charAt (length) == '#') {
+ url2 = WebKit.ABOUT_BLANK + url2.substring (length);
+ }
+ }
+ Display display = browser.getDisplay();
+ result[0] = 0;
+ IWebView iwebView = new IWebView(webview);
+ hr = iwebView.mainFrame(result);
+ boolean top = false;
+ if (hr == COM.S_OK && result[0] != 0) {
+ top = frame == result[0];
+ new IWebFrame(result[0]).Release();
+ }
+ if (top) {
+ /* reset resource status variables */
+ this.url = url2;
+
+ /*
+ * Each invocation of setText() causes webView_didCommitLoadForFrame to be invoked
+ * twice, once for the initial navigate to about:blank, and once for the auto-navigate
+ * to about:blank that WebKit does when loadHTMLString is invoked. If this is the
+ * first webView_didCommitLoadForFrame callback received for a setText() invocation
+ * then do not send any events or re-install registered BrowserFunctions.
+ */
+ if (url2.startsWith(WebKit.ABOUT_BLANK) && html != null) return COM.S_OK;
+
+ /* re-install registered functions */
+ Enumeration elements = browser.webBrowser.functions.elements ();
+ while (elements.hasMoreElements ()) {
+ BrowserFunction function = (BrowserFunction)elements.nextElement ();
+ browser.webBrowser.execute (function.functionString);
+ }
+
+ ProgressEvent progress = new ProgressEvent(browser);
+ progress.display = display;
+ progress.widget = browser;
+ progress.current = 1;
+ progress.total = WebKit.MAX_PROGRESS;
+ ProgressListener[] progressListeners = browser.webBrowser.progressListeners;
+ for (int i = 0; i < progressListeners.length; i++) {
+ progressListeners[i].changed(progress);
+ }
+ if (browser.isDisposed()) return COM.S_OK;
+
+ StatusTextEvent statusText = new StatusTextEvent(browser);
+ statusText.display = display;
+ statusText.widget = browser;
+ statusText.text = url2;
+ StatusTextListener[] statusTextListeners = browser.webBrowser.statusTextListeners;
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed(statusText);
+ }
+ if (browser.isDisposed()) return COM.S_OK;
+ }
+ LocationEvent location = new LocationEvent(browser);
+ location.display = display;
+ location.widget = browser;
+ location.location = url2;
+ location.top = top;
+ LocationListener[] locationListeners = browser.webBrowser.locationListeners;
+ for (int i = 0; i < locationListeners.length; i++) {
+ locationListeners[i].changed(location);
+ }
+ return COM.S_OK;
+}
+
+int didFailProvisionalLoadWithError(int /*long*/ webView, int /*long*/ error, int /*long*/ frame) {
+ IWebError iweberror = new IWebError(error);
+ int [] errorCode = new int [1];
+ int hr = iweberror.code(errorCode);
+ if (WebKit_win32.WebURLErrorBadURL < errorCode[0]) return COM.S_OK;;
+
+ String failingURLString = null;
+ int /*long*/[] failingURL = new int /*long*/[1];
+ hr = iweberror.failingURL (failingURL);
+ if (hr == COM.S_OK && failingURL[0] != 0) {
+ failingURLString = WebKit.extractBSTR(failingURL[0]);
+ COM.SysFreeString(failingURL[0]);
+ }
+ if (failingURLString != null && WebKit_win32.WebURLErrorServerCertificateNotYetValid <= errorCode[0] && errorCode[0] <= WebKit_win32.WebURLErrorSecureConnectionFailed) {
+ /* handle invalid certificate error */
+ int /*long*/[] result = new int /*long*/[1];
+ hr = iweberror.localizedDescription(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String description = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ int /*long*/[] certificate = new int /*long*/[1];
+ hr = iweberror.sslPeerCertificate(certificate);
+ if (hr != COM.S_OK || certificate[0] == 0) {
+ return COM.S_OK;
+ }
+ if (showCertificateDialog(webView, failingURLString, description, certificate[0])){
+ IWebFrame iWebFrame = new IWebFrame(frame);
+ hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebMutableURLRequest, 0, WebKit_win32.IID_IWebMutableURLRequest, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ certificate[0] = 0;
+ return COM.S_OK;
+ }
+ IWebMutableURLRequest request = new IWebMutableURLRequest (result[0]);
+ request.setURL(failingURL[0]);
+ request.setAllowsAnyHTTPSCertificate();
+ iWebFrame.loadRequest(request.getAddress());
+ request.Release();
+ }
+ certificate[0] = 0;
+ return COM.S_OK;
+ }
+
+ /* handle other types of errors */
+ int /*long*/[] result = new int /*long*/[1];
+ hr = iweberror.localizedDescription(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String description = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ if (!browser.isDisposed()) {
+ String message = failingURLString != null ? failingURLString + "\n\n" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ message += Compatibility.getMessage ("SWT_Page_Load_Failed", new Object[] {description}); //$NON-NLS-1$
+ MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.ICON_ERROR);
+ messageBox.setMessage(message);
+ messageBox.open();
+ }
+ return COM.S_OK;
+}
+
+int didFinishLoadForFrame(int /*long*/ webview, int /*long*/ frame) {
+ IWebView iWebView = new IWebView(webview);
+ int /*long*/[] iWebFrame = new int /*long*/[1];
+ int hr = iWebView.mainFrame(iWebFrame);
+ if (hr != COM.S_OK || iWebFrame[0] == 0) {
+ return COM.S_OK;
+ }
+ boolean top = frame == iWebFrame[0];
+ new IWebFrame(iWebFrame[0]).Release();
+ if (top) {
+ /*
+ * If html is not null then there is html from a previous setText() call
+ * waiting to be set into the about:blank page once it has completed loading.
+ */
+ if (html != null) {
+ if (getUrl().startsWith(WebKit.ABOUT_BLANK)) {
+ ((WebKit)browser.webBrowser).loadingText = true;
+ int /*long*/ string = WebKit.createBSTR(html);
+ int /*long*/ URLString;
+ if (((WebKit)browser.webBrowser).untrustedText) {
+ URLString = WebKit.createBSTR(WebKit.ABOUT_BLANK);
+ } else {
+ URLString = WebKit.createBSTR(WebKit.URI_FILEROOT);
+ }
+ IWebFrame mainFrame = new IWebFrame(frame);
+ mainFrame.loadHTMLString(string, URLString);
+ html = null;
+ }
+ }
+
+ /*
+ * The loadHTMLString() invocation above will trigger a second webView_didFinishLoadForFrame
+ * callback when it is completed. If text was just set into the browser then wait for this
+ * second callback to come before sending the title or completed events.
+ */
+ if (!((WebKit)browser.webBrowser).loadingText) {
+ if (browser.isDisposed()) return COM.S_OK;
+ /*
+ * To be consistent with other platforms a title event should be fired when a
+ * page has completed loading. A page with a <title> tag will do this
+ * automatically when the didReceiveTitle callback is received. However a page
+ * without a <title> tag will not do this by default, so fire the event
+ * here with the page's url as the title.
+ */
+ Display display = browser.getDisplay();
+ IWebFrame mainFrame = new IWebFrame(frame);
+ int /*long*/[] result = new int /*long*/[1];
+ hr = mainFrame.dataSource(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebDataSource dataSource = new IWebDataSource(result[0]);
+ result[0] = 0;
+ hr = dataSource.pageTitle(result);
+ dataSource.Release();
+ if (hr != COM.S_OK) {
+ return COM.S_OK;
+ }
+ String title = null;
+ if (result[0] != 0) {
+ title = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ }
+ if (title == null || title.length() == 0) { /* page has no title */
+ TitleEvent newEvent = new TitleEvent(browser);
+ newEvent.display = display;
+ newEvent.widget = browser;
+ newEvent.title = getUrl();
+ TitleListener[] titleListeners = browser.webBrowser.titleListeners;
+ for (int i = 0; i < titleListeners.length; i++) {
+ titleListeners[i].changed(newEvent);
+ }
+ if (browser.isDisposed()) return COM.S_OK;
+ }
+
+ ProgressEvent progress = new ProgressEvent(browser);
+ progress.display = display;
+ progress.widget = browser;
+ progress.current = WebKit.MAX_PROGRESS;
+ progress.total = WebKit.MAX_PROGRESS;
+ ProgressListener[] progressListeners = browser.webBrowser.progressListeners;
+ for (int i = 0; i < progressListeners.length; i++) {
+ progressListeners[i].completed(progress);
+ }
+ }
+ ((WebKit)browser.webBrowser).loadingText = false;
+ if (browser.isDisposed()) return COM.S_OK;
+ }
+ return COM.S_OK;
+}
+
+int didReceiveTitle(int /*long*/ webView, int /*long*/ title, int /*long*/ frame) {
+ int /*long*/[] mainFrame = new int /*long*/[1];
+ IWebView iWebView = new IWebView(webView);
+ int hr = iWebView.mainFrame(mainFrame);
+ if (hr != COM.S_OK || frame == 0) {
+ return COM.S_OK;
+ }
+ if (frame == mainFrame[0]) {
+ String newTitle = WebKit.extractBSTR(title);
+ TitleEvent newEvent = new TitleEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ newEvent.title = newTitle;
+ TitleListener[] titleListeners = browser.webBrowser.titleListeners;
+ for (int i = 0; i < titleListeners.length; i++) {
+ titleListeners[i].changed(newEvent);
+ }
+ }
+ new IWebFrame(mainFrame[0]).Release();
+ return COM.S_OK;
+}
+
+int didStartProvisionalLoadForFrame(int /*long*/ webView, int /*long*/ frame) {
+ return COM.S_OK;
+}
+
+void disposeCOMInterfaces () {
+ System.out.println ("======== disposing iWebResourceLoadDelegate");
+ if (iWebFrameLoadDelegate != null) {
+ iWebFrameLoadDelegate.dispose ();
+ iWebFrameLoadDelegate = null;
+ }
+}
+
+int /*long*/ getAddress () {
+ return iWebFrameLoadDelegate.getAddress ();
+}
+
+String getUrl () {
+ /* WebKit auto-navigates to about:blank at startup */
+ if (url == null || url.length() == 0) return WebKit.ABOUT_BLANK;
+ return url;
+}
+
+int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG;
+ GUID guid = new GUID ();
+ COM.MoveMemory (guid, riid, GUID.sizeof);
+
+ if (COM.IsEqualGUID (guid, COM.IIDIUnknown)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebFrameLoadDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebFrameLoadDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID (guid, WebKit_win32.IID_IWebFrameLoadDelegate)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebFrameLoadDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebFrameLoadDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+
+ COM.MoveMemory (ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ return COM.E_NOINTERFACE;
+}
+
+int Release () {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces ();
+ }
+ return refCount;
+}
+
+void setBrowser (Browser browser) {
+ this.browser = browser;
+}
+
+boolean showCertificateDialog (int /*long*/ webView, final String failingUrlString, final String description, int /*long*/ certificate) {
+ Shell parent = browser.getShell ();
+ final Shell shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
+ shell.setText(Compatibility.getMessage("SWT_InvalidCert_Title")); //$NON-NLS-1$
+ shell.setLayout (new GridLayout ());
+ Label label = new Label (shell, SWT.WRAP);
+ //if unable to get host, show the url
+ String host = failingUrlString;
+ try {
+ host = new URL(failingUrlString).getHost();
+ } catch (MalformedURLException e) {
+
+ }
+ String message = "\n";
+ message += Compatibility.getMessage ("SWT_InvalidCert_Message", new String[] {host}); //$NON-NLS-1$
+ message += "\n\n" + Compatibility.getMessage (description);
+ message += "\n" + Compatibility.getMessage("SWT_InvalidCert_Connect"); //$NON-NLS-1$
+ message += "\n";
+ label.setText(message);
+
+ GridData data = new GridData ();
+ Monitor monitor = browser.getMonitor ();
+ int maxWidth = monitor.getBounds ().width * 1 / 3;
+ int width = label.computeSize (SWT.DEFAULT, SWT.DEFAULT).x;
+ data.widthHint = Math.min (width, maxWidth);
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ label.setLayoutData (data);
+
+ final boolean[] result = new boolean[1];
+ final Button[] buttons = new Button[3];
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ if (event.widget == buttons[2]) {
+ //showCertificate() //:TODO Not sure how to show the certificate
+ } else {
+ result[0] = event.widget == buttons[0];
+ shell.close();
+ }
+ }
+ };
+
+ Composite composite = new Composite (shell, SWT.NONE);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.END;
+ composite.setLayoutData (data);
+ composite.setLayout (new GridLayout (3, true));
+ buttons[0] = new Button (composite, SWT.PUSH);
+ buttons[0].setText (SWT.getMessage("SWT_Continue")); //$NON-NLS-1$
+ buttons[0].setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
+ buttons[0].addListener (SWT.Selection, listener);
+ buttons[1] = new Button (composite, SWT.PUSH);
+ buttons[1].setText (SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+ buttons[1].setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
+ buttons[1].addListener (SWT.Selection, listener);
+ buttons[2] = new Button (composite, SWT.PUSH);
+ buttons[2].setText (SWT.getMessage("SWT_ViewCertificate")); //$NON-NLS-1$
+ buttons[2].setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
+ buttons[2].addListener (SWT.Selection, listener);
+
+ shell.setDefaultButton (buttons[0]);
+ shell.pack ();
+
+ Rectangle parentSize = parent.getBounds();
+ Rectangle shellSize = shell.getBounds();
+ int x, y;
+ x = parent.getLocation().x + (parentSize.width - shellSize.width)/2;
+ y = parent.getLocation().y + (parentSize.height - shellSize.height)/2;
+ shell.setLocation(x, y);
+ shell.open ();
+ Display display = browser.getDisplay ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ return result[0];
+}
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
new file mode 100644
index 0000000000..df8437c6eb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
@@ -0,0 +1,1281 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.Callback;
+import org.eclipse.swt.internal.Library;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.webkit.IWebCookieManager;
+import org.eclipse.swt.internal.webkit.IWebDataSource;
+import org.eclipse.swt.internal.webkit.IWebDocumentRepresentation;
+import org.eclipse.swt.internal.webkit.IWebFrame;
+import org.eclipse.swt.internal.webkit.IWebIBActions;
+import org.eclipse.swt.internal.webkit.IWebMutableURLRequest;
+import org.eclipse.swt.internal.webkit.IWebPreferences;
+import org.eclipse.swt.internal.webkit.IWebView;
+import org.eclipse.swt.internal.webkit.IWebViewPrivate;
+import org.eclipse.swt.internal.webkit.JSClassDefinition;
+import org.eclipse.swt.internal.webkit.WebKit_win32;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.internal.win32.RECT;
+import org.eclipse.swt.internal.win32.TCHAR;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Widget;
+
+public class WebKit extends WebBrowser {
+ IWebView webView;
+ int /*long*/ webViewWindowHandle, webViewData;
+
+ WebDownloadDelegate webDownloadDelegate;
+ WebFrameLoadDelegate webFrameLoadDelegate;
+ WebPolicyDelegate webPolicyDelegate;
+ WebResourceLoadDelegate webResourceLoadDelegate;
+ WebUIDelegate webUIDelegate;
+
+ int refCount = 0;
+ int lastKeyCode, lastCharCode;
+
+ boolean loadingText = false;
+ boolean untrustedText;
+ boolean ignoreDispose;
+ boolean traverseOut = false;
+ String lastNavigateURL;
+ BrowserFunction eventFunction;
+ protected boolean traverseNext = true;
+
+ static int /*long*/ ExternalClass;
+ static boolean webkitRegistered = false;
+ static Callback JSObjectHasPropertyProc;
+ static Callback JSObjectGetPropertyProc;
+ static Callback JSObjectCallAsFunctionProc;
+ static final int MAX_PROGRESS = 100;
+ static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
+ static final String CHARSET_UTF8 = "UTF-8"; //$NON-NLS-1$
+ static final String CLASSNAME_EXTERNAL = "External"; //$NON-NLS-1$
+ static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ static final String FUNCTIONNAME_CALLJAVA = "callJava"; //$NON-NLS-1$
+ static final String HEADER_SETCOOKIE = "Set-Cookie"; //$NON-NLS-1$
+ static final String POST = "POST"; //$NON-NLS-1$
+ static final String PROPERTY_LENGTH = "length"; //$NON-NLS-1$
+ static final String PROTOCOL_HTTPS = "https://"; //$NON-NLS-1$
+ static final String PROTOCOL_FILE = "file://"; //$NON-NLS-1$
+ static final String PROTOCOL_HTTP = "http://"; //$NON-NLS-1$
+ static final String USER_AGENT = "user-agent"; //$NON-NLS-1$
+ static final String URI_FILEROOT = "file:///"; //$NON-NLS-1$
+
+ /* event strings */
+ static final String DOMEVENT_DRAGSTART = "dragstart"; //$NON-NLS-1$
+ static final String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$
+ static final String DOMEVENT_KEYPRESS = "keypress"; //$NON-NLS-1$
+ static final String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$
+ static final String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$
+ static final String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$
+ static final String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$
+ static final String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$
+ static final String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$
+ static final String DOMEVENT_MOUSEWHEEL = "mousewheel"; //$NON-NLS-1$
+
+ static final char SEPARATOR_FILE = System.getProperty ("file.separator").charAt(0); //$NON-NLS-1$
+
+static {
+ /* ensure that webkit's COM objects are registered */
+ TCHAR lpLibFileName = new TCHAR (0, "WebKit.dll", true); //$NON-NLS-1$
+ int /*long*/ hModule = OS.LoadLibrary (lpLibFileName);
+ if (hModule != 0) {
+ String name = "DllRegisterServer\0"; //$NON-NLS-1$
+ byte [] lpProcName = new byte[name.length ()];
+ for (int i = 0; i < lpProcName.length; i++) {
+ lpProcName[i] = (byte)name.charAt (i);
+ }
+ int /*long*/ DllRegisterServer = OS.GetProcAddress (hModule, lpProcName);
+ if (DllRegisterServer != 0) {
+ OS.Call (DllRegisterServer);
+ webkitRegistered = true;
+ }
+ OS.FreeLibrary (hModule);
+ Library.loadLibrary ("swt-webkit"); //$NON-NLS-1$
+ }
+
+ JSObjectHasPropertyProc = new Callback (WebKit.class, "JSObjectHasPropertyProc", 3); //$NON-NLS-1$
+ if (JSObjectHasPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ JSObjectGetPropertyProc = new Callback (WebKit.class, "JSObjectGetPropertyProc", 4); //$NON-NLS-1$
+ if (JSObjectGetPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ JSObjectCallAsFunctionProc = new Callback (WebKit.class, "JSObjectCallAsFunctionProc", 6); //$NON-NLS-1$
+ if (JSObjectCallAsFunctionProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ NativeClearSessions = new Runnable() {
+ public void run() {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebCookieManager, 0, WebKit_win32.IID_IWebCookieManager, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebCookieManager cookieManager = new IWebCookieManager(result[0]);
+ int /*long*/[] storage = new int /*long*/[1];
+ hr = cookieManager.cookieStorage(storage);
+ cookieManager.Release();
+ if (hr != COM.S_OK || storage[0] == 0) {
+ return;
+ }
+ int /*long*/ cookies = WebKit_win32.CFHTTPCookieStorageCopyCookies(storage[0]);
+ if (cookies != 0) {
+ int count = WebKit_win32.CFArrayGetCount(cookies);
+ for (int i = 0; i < count; i++) {
+ int /*long*/ cookie = WebKit_win32.CFArrayGetValueAtIndex(cookies, i);
+ int /*long*/ flags = WebKit_win32.CFHTTPCookieGetFlags(cookie);
+ if ((flags & WebKit_win32.CFHTTPCookieSessionOnlyFlag) != 0) {
+ WebKit_win32.CFHTTPCookieStorageDeleteCookie(storage[0], cookie);
+ }
+ }
+ WebKit_win32.CFRelease(cookies);
+ }
+// WebKit_win32.CFRelease(storage[0]); //intentionally commented, causes crash
+ }
+ };
+
+ NativeGetCookie = new Runnable () {
+ public void run () {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebCookieManager, 0, WebKit_win32.IID_IWebCookieManager, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebCookieManager cookieManager = new IWebCookieManager(result[0]);
+ int /*long*/[] storage = new int /*long*/[1];
+ hr = cookieManager.cookieStorage(storage);
+ cookieManager.Release();
+ if (hr != COM.S_OK || storage[0] == 0) {
+ return;
+ }
+ char [] array = CookieUrl.toCharArray();
+ int /*long*/ string = WebKit_win32.CFStringCreateWithCharacters(0, array, array.length);
+ if (string != 0) {
+ int /*long*/ cfUrl = WebKit_win32.CFURLCreateWithString(0, string, 0);
+ if (cfUrl != 0) {
+ boolean secure = CookieUrl.startsWith(PROTOCOL_HTTPS);
+ int /*long*/ cookiesArray = WebKit_win32.CFHTTPCookieStorageCopyCookiesForURL(storage[0], cfUrl, secure);
+ if (cookiesArray != 0) {
+ int count = WebKit_win32.CFArrayGetCount(cookiesArray);
+ for (int i = 0; i < count; i++) {
+ int /*long*/ cookie = WebKit_win32.CFArrayGetValueAtIndex(cookiesArray, i);
+ if (cookie != 0) {
+ int /*long*/ cookieName = WebKit_win32.CFHTTPCookieGetName(cookie);
+ if (cookieName != 0) {
+ char[] name = stringFromCFString(cookieName);
+ if (CookieName.equals(new String(name))) {
+ int /*long*/ value = WebKit_win32.CFHTTPCookieGetValue(cookie);
+ if (value != 0) CookieValue = new String (stringFromCFString(value));
+ break;
+ }
+ }
+ }
+ }
+ WebKit_win32.CFRelease(cookiesArray);
+ }
+ WebKit_win32.CFRelease(cfUrl);
+ }
+ WebKit_win32.CFRelease(string);
+ }
+// WebKit_win32.CFRelease(storage[0]); //intentionally commented, causes crash
+ }
+ };
+
+ NativeSetCookie = new Runnable () {
+ public void run () {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebCookieManager, 0, WebKit_win32.IID_IWebCookieManager, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebCookieManager cookieManager = new IWebCookieManager(result[0]);
+ int /*long*/[] storage = new int /*long*/[1];
+ hr = cookieManager.cookieStorage(storage);
+ cookieManager.Release();
+ if (hr != COM.S_OK || storage[0] == 0) {
+ return;
+ }
+
+ char [] array = CookieUrl.toCharArray();
+ int /*long*/ string = WebKit_win32.CFStringCreateWithCharacters(0, array, array.length);
+ if (string != 0) {
+ int /*long*/ cfUrl = WebKit_win32.CFURLCreateWithString(0, string, 0);
+ if (cfUrl != 0) {
+ array = CookieValue.toCharArray();
+ int /*long*/ value = WebKit_win32.CFStringCreateWithCharacters(0, array, array.length);
+ if (value != 0) {
+ array = HEADER_SETCOOKIE.toCharArray();
+ int /*long*/ key = WebKit_win32.CFStringCreateWithCharacters(0, array, array.length);
+ if (key != 0) {
+ int /*long*/ headers = WebKit_win32.CFDictionaryCreate(0, new int /*long*/ []{key}, new int /*long*/ []{value}, 1, WebKit_win32.kCFCopyStringDictionaryKeyCallBacks(), WebKit_win32.kCFTypeDictionaryValueCallBacks());
+ if (headers != 0) {
+ int /*long*/ cookies = WebKit_win32.CFHTTPCookieCreateWithResponseHeaderFields(0, headers, cfUrl);
+ if (cookies != 0) {
+ int /*long*/ cookie = WebKit_win32.CFArrayGetValueAtIndex(cookies, 0);
+ if (cookie != 0) {
+ WebKit_win32.CFHTTPCookieStorageSetCookie(storage[0], cookie);
+ CookieResult = true;
+ }
+ WebKit_win32.CFRelease(cookies);
+ }
+ WebKit_win32.CFRelease(headers);
+ }
+ WebKit_win32.CFRelease(key);
+ }
+ WebKit_win32.CFRelease(value);
+ }
+ WebKit_win32.CFRelease(cfUrl);
+ }
+ WebKit_win32.CFRelease(string);
+ }
+// WebKit_win32.CFRelease(storage[0]); //intentionally commented, causes crash
+ }
+ };
+
+ if (NativePendingCookies != null) {
+ SetPendingCookies (NativePendingCookies);
+ }
+ NativePendingCookies = null;
+}
+
+static int /*long*/ createBSTR (String string) {
+ char[] data = (string + '\0').toCharArray ();
+ return COM.SysAllocString (data);
+}
+
+static String extractBSTR (int /*long*/ bstrString) {
+ int size = COM.SysStringByteLen (bstrString);
+ if (size == 0) return EMPTY_STRING;
+ char[] buffer = new char[(size + 1) / 2]; // add one to avoid rounding errors
+ COM.MoveMemory (buffer, bstrString, size);
+ return new String (buffer);
+}
+
+static Browser findBrowser (int /*long*/ webView) {
+ if (webView == 0) return null;
+ IWebView iwebView = new IWebView(webView);
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = iwebView.hostWindow(result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ Widget widget = Display.getCurrent ().findWidget (result[0]);
+ if (widget != null && widget instanceof Browser) return (Browser)widget;
+ }
+ return null;
+}
+
+static int /*long*/ JSObjectCallAsFunctionProc (int /*long*/ ctx, int /*long*/ function, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) {
+ WebKit_win32.JSGlobalContextRetain(ctx);
+ if (WebKit_win32.JSValueIsObjectOfClass (ctx, thisObject, ExternalClass) == 0) {
+ return WebKit_win32.JSValueMakeUndefined (ctx);
+ }
+ int /*long*/ ptr = WebKit_win32.JSObjectGetPrivate (thisObject);
+ int /*long*/[] handle = new int /*long*/[1];
+ C.memmove (handle, ptr, C.PTR_SIZEOF);
+ Browser browser = findBrowser (handle[0]);
+ if (browser == null) return WebKit_win32.JSValueMakeUndefined (ctx);
+ WebKit webkit = (WebKit)browser.webBrowser;
+ int /*long*/ result = webkit.callJava (ctx, function, thisObject, argumentCount, arguments, exception);
+ return result;
+}
+
+static int /*long*/ JSObjectGetPropertyProc (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/ exception) {
+ byte[] bytes = null;
+ try {
+ bytes = (FUNCTIONNAME_CALLJAVA + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ bytes = (FUNCTIONNAME_CALLJAVA + '\0').getBytes ();
+ }
+ int /*long*/ name = WebKit_win32.JSStringCreateWithUTF8CString (bytes);
+ int /*long*/ addr = WebKit_win32.JSObjectCallAsFunctionProc_CALLBACK(WebKit.JSObjectCallAsFunctionProc.getAddress());
+ int /*long*/ function = WebKit_win32.JSObjectMakeFunctionWithCallback (ctx, name, addr);
+ WebKit_win32.JSStringRelease (name);
+ return function;
+}
+
+static int /*long*/ JSObjectHasPropertyProc (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName) {
+ byte[] bytes = null;
+ try {
+ bytes = (FUNCTIONNAME_CALLJAVA + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ bytes = (FUNCTIONNAME_CALLJAVA + '\0').getBytes ();
+ }
+ int result = WebKit_win32.JSStringIsEqualToUTF8CString (propertyName, bytes);
+ return result;
+}
+
+static char[] stringFromCFString(int /*long*/ cfString) {
+ if (cfString == 0) return null;
+
+ int length = WebKit_win32.CFStringGetLength(cfString);
+ int /*long*/ ptr = WebKit_win32.CFStringGetCharactersPtr(cfString);
+ char [] string = new char[length];
+ if (ptr != 0) {
+ OS.MoveMemory(string, ptr, C.PTR_SIZEOF);
+ } else {
+ for (int j = 0; j < length; j++) {
+ string[j] = WebKit_win32.CFStringGetCharacterAtIndex(cfString, j);
+ }
+ }
+ return string;
+}
+
+static String stringFromJSString(int /*long*/ jsString) {
+ if (jsString == 0) return null;
+ int length = WebKit_win32.JSStringGetLength(jsString);
+ byte [] string = new byte[length + 1];
+ WebKit_win32.JSStringGetUTF8CString(jsString, string, length + 1);
+ return new String(string);
+}
+
+public boolean back () {
+ int /*long*/[] result = new int /*long*/[1];
+ webView.goBack(result);
+ return result[0] == 0 ? false : true;
+}
+
+int /*long*/ callJava (int /*long*/ ctx, int /*long*/ func, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) {
+ Object returnValue = null;
+ if (argumentCount == 2) {
+ int /*long*/[] result = new int /*long*/[1];
+ C.memmove (result, arguments, C.PTR_SIZEOF);
+ int type = WebKit_win32.JSValueGetType (ctx, result[0]);
+ if (type == WebKit_win32.kJSTypeNumber) {
+ int index = ((Double)convertToJava (ctx, result[0])).intValue ();
+ result[0] = 0;
+ if (index > 0) {
+ Object key = new Integer (index);
+ BrowserFunction function = (BrowserFunction)functions.get (key);
+ if (function != null) {
+ try {
+ C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF);
+ Object temp = convertToJava (ctx, result[0]);
+ if (temp instanceof Object[]) {
+ Object[] args = (Object[])temp;
+ try {
+ returnValue = function.function (args);
+ } catch (Exception e) {
+ /* exception during function invocation */
+ returnValue = WebBrowser.CreateErrorString (e.getLocalizedMessage ());
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ /* invalid argument value type */
+ if (function.isEvaluate) {
+ /* notify the function so that a java exception can be thrown */
+ function.function (new String[] {WebBrowser.CreateErrorString (new SWTException (SWT.ERROR_INVALID_RETURN_VALUE).getLocalizedMessage ())});
+ }
+ returnValue = WebBrowser.CreateErrorString (e.getLocalizedMessage ());
+ }
+ }
+ }
+ }
+ }
+ return convertToJS (ctx, returnValue);
+}
+
+public boolean close () {
+ return shouldClose ();
+}
+
+Object convertToJava (int /*long*/ ctx, int /*long*/ value) {
+ int type = WebKit_win32.JSValueGetType (ctx, value);
+ switch (type) {
+ case WebKit_win32.kJSTypeBoolean: {
+ int result = WebKit_win32.JSValueToBoolean (ctx, value);
+ return new Boolean (result != 0);
+ }
+ case WebKit_win32.kJSTypeNumber: {
+ double result = WebKit_win32.JSValueToNumber (ctx, value, null);
+ return new Double(result);
+ }
+ case WebKit_win32.kJSTypeString: {
+ int /*long*/ string = WebKit_win32.JSValueToStringCopy (ctx, value, null);
+ if (string == 0) return ""; //$NON-NLS-1$
+ int /*long*/ length = WebKit_win32.JSStringGetMaximumUTF8CStringSize (string);
+ byte[] bytes = new byte[(int)/*64*/length];
+ length = WebKit_win32.JSStringGetUTF8CString (string, bytes, length);
+ WebKit_win32.JSStringRelease (string);
+ try {
+ /* length-1 is needed below to exclude the terminator character */
+ return new String (bytes, 0, (int)/*64*/length - 1, CHARSET_UTF8);
+ } catch (UnsupportedEncodingException e) {
+ return new String (bytes);
+ }
+ }
+ case WebKit_win32.kJSTypeNull:
+ // FALL THROUGH
+ case WebKit_win32.kJSTypeUndefined: return null;
+ case WebKit_win32.kJSTypeObject: {
+ byte[] bytes = null;
+ try {
+ bytes = (PROPERTY_LENGTH + '\0').getBytes (CHARSET_UTF8);
+ } catch (UnsupportedEncodingException e) {
+ bytes = (PROPERTY_LENGTH + '\0').getBytes ();
+ }
+ int /*long*/ propertyName = WebKit_win32.JSStringCreateWithUTF8CString (bytes);
+ int /*long*/ valuePtr = WebKit_win32.JSObjectGetProperty (ctx, value, propertyName, null);
+ WebKit_win32.JSStringRelease (propertyName);
+ type = WebKit_win32.JSValueGetType (ctx, valuePtr);
+ if (type == WebKit_win32.kJSTypeNumber) {
+ int length = (int)WebKit_win32.JSValueToNumber (ctx, valuePtr, null);
+ Object[] result = new Object[length];
+ for (int i = 0; i < length; i++) {
+ int /*long*/ current = WebKit_win32.JSObjectGetPropertyAtIndex (ctx, value, i, null);
+ if (current != 0) {
+ result[i] = convertToJava (ctx, current);
+ }
+ }
+ return result;
+ }
+ }
+ }
+ SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ return null;
+}
+int /*long*/ convertToJS (int /*long*/ ctx, Object value) {
+ if (value == null) {
+ return WebKit_win32.JSValueMakeNull (ctx);
+ }
+ if (value instanceof String) {
+ byte[] bytes = null;
+ try {
+ bytes = ((String)value + '\0').getBytes (CHARSET_UTF8);
+ } catch (UnsupportedEncodingException e) {
+ bytes = ((String)value + '\0').getBytes ();
+ }
+ int /*long*/ stringRef = WebKit_win32.JSStringCreateWithUTF8CString (bytes);
+ int /*long*/ result = WebKit_win32.JSValueMakeString (ctx, stringRef);
+ WebKit_win32.JSStringRelease (stringRef);
+ return result;
+ }
+ if (value instanceof Boolean) {
+ return WebKit_win32.JSValueMakeBoolean (ctx, ((Boolean)value).booleanValue () ? 1 : 0);
+ }
+ if (value instanceof Number) {
+ return WebKit_win32.JSValueMakeNumber (ctx, ((Number)value).doubleValue ());
+ }
+ if (value instanceof Object[]) {
+ Object[] arrayValue = (Object[]) value;
+ int length = arrayValue.length;
+ int /*long*/[] arguments = new int /*long*/[length];
+ for (int i = 0; i < length; i++) {
+ Object javaObject = arrayValue[i];
+ int /*long*/ jsObject = convertToJS (ctx, javaObject);
+ arguments[i] = jsObject;
+ }
+ return WebKit_win32.JSObjectMakeArray (ctx, length, arguments, null);
+ }
+ SWT.error (SWT.ERROR_INVALID_RETURN_VALUE);
+ return 0;
+}
+
+public void create (Composite parent, int style) {
+ if (!webkitRegistered) {
+ browser.dispose ();
+ String errorString = " [WebKit.dll could not be found/registered]"; //$NON-NLS-1$
+ SWT.error (SWT.ERROR_NO_HANDLES, null, errorString);
+ return;
+ }
+ if (Device.DEBUG) {
+ System.out.println ("WebKit...");
+ }
+
+ if (ExternalClass == 0) {
+ JSClassDefinition jsClassDefinition = new JSClassDefinition ();
+ byte[] bytes = (CLASSNAME_EXTERNAL + '\0').getBytes();
+ jsClassDefinition.className = C.malloc (bytes.length);
+ OS.memmove (jsClassDefinition.className, bytes, bytes.length);
+
+ //custom callbacks for hasProperty, getProperty and callAsFunction
+ int /*long*/ addr = WebKit_win32.JSObjectHasPropertyProc_CALLBACK(JSObjectHasPropertyProc.getAddress());
+ jsClassDefinition.hasProperty = addr;
+ addr = WebKit_win32.JSObjectGetPropertyProc_CALLBACK(JSObjectGetPropertyProc.getAddress());
+ jsClassDefinition.getProperty = addr;
+
+ int /*long*/ classDefinitionPtr = C.malloc (JSClassDefinition.sizeof);
+ WebKit_win32.memmove (classDefinitionPtr, jsClassDefinition, JSClassDefinition.sizeof);
+ ExternalClass = WebKit_win32.JSClassCreate (classDefinitionPtr);
+ WebKit_win32.JSClassRetain(ExternalClass);
+ }
+
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebView, 0, WebKit_win32.IID_IWebView, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ webView = new IWebView (result[0]);
+ webViewData = C.malloc (C.PTR_SIZEOF);
+ C.memmove (webViewData, new int /*long*/[] {webView.getAddress()}, C.PTR_SIZEOF);
+ hr = webView.setHostWindow (browser.handle);
+ if (hr != COM.S_OK) {
+ return;
+ }
+ hr = webView.initWithFrame (new RECT (), 100, 100);
+ if (hr != COM.S_OK) {
+ return;
+ }
+ result[0] = 0;
+ hr = webView.QueryInterface (WebKit_win32.IID_IWebViewPrivate, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebViewPrivate webViewPrivate = new IWebViewPrivate (result[0]);
+ result[0] = 0;
+ hr = webViewPrivate.viewWindow (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ webViewPrivate.Release ();
+ webViewWindowHandle = result[0];
+
+ result[0] = 0;
+ webFrameLoadDelegate = new WebFrameLoadDelegate ();
+ hr = webView.setFrameLoadDelegate (webFrameLoadDelegate.getAddress ());
+ if (hr != COM.S_OK) {
+ return;
+ }
+ webFrameLoadDelegate.setBrowser(browser);
+
+ webUIDelegate = new WebUIDelegate ();
+ hr = webView.setUIDelegate (webUIDelegate.getAddress ());
+ if (hr != COM.S_OK) {
+ return;
+ }
+ webUIDelegate.setBrowser(browser);
+
+ webResourceLoadDelegate = new WebResourceLoadDelegate ();
+ hr = webView.setResourceLoadDelegate (webResourceLoadDelegate.getAddress ());
+ if (hr != COM.S_OK) {
+ return;
+ }
+ webResourceLoadDelegate.setBrowser(browser);
+
+ webDownloadDelegate = new WebDownloadDelegate ();
+ hr = webView.setDownloadDelegate (webDownloadDelegate.getAddress ());
+ if (hr != COM.S_OK) {
+ return;
+ }
+ webDownloadDelegate.setBrowser(browser);
+
+ webPolicyDelegate = new WebPolicyDelegate ();
+ hr = webView.setPolicyDelegate (webPolicyDelegate.getAddress());
+ if (hr != COM.S_OK) {
+ return;
+ }
+ webPolicyDelegate.setBrowser(browser);
+
+ result[0] = 0;
+ webView.preferences(result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebPreferences preferences = new IWebPreferences(result[0]);
+ preferences.setJavaScriptCanOpenWindowsAutomatically(true);
+ preferences.setJavaEnabled(false); //disable applets
+ preferences.Release();
+ }
+
+ final Listener filter = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Traverse: {
+ traverseNext = event.detail != SWT.TRAVERSE_TAB_PREVIOUS;
+ break;
+ }
+ }
+ }
+ };
+ Listener listener = new Listener() {
+ public void handleEvent(Event e) {
+ switch (e.type) {
+ case SWT.Activate: {
+ browser.getDisplay().removeFilter(SWT.Traverse, filter);
+ break;
+ }
+ case SWT.Deactivate: {
+ browser.getDisplay().removeFilter(SWT.Traverse, filter);
+ browser.getDisplay().addFilter(SWT.Traverse, filter);
+ break;
+ }
+ case SWT.Dispose: {
+ browser.getDisplay().removeFilter(SWT.Traverse, filter);
+ /* make this handler run after other dispose listeners */
+ if (ignoreDispose) {
+ ignoreDispose = false;
+ break;
+ }
+ ignoreDispose = true;
+ browser.notifyListeners (e.type, e);
+ e.type = SWT.NONE;
+ onDispose();
+ break;
+ }
+ case SWT.FocusIn: {
+ onFocus();
+ break;
+ }
+ case SWT.Resize: {
+ Rectangle bounds = browser.getClientArea();
+ OS.SetWindowPos (webViewWindowHandle, 0, bounds.x, bounds.y, bounds.width, bounds.height, OS.SWP_DRAWFRAME);
+ //not required, browser.setVisible() takes care of this
+ //OS.ShowWindow (webViewWindowHandle, browser.getVisible () ? OS.SW_SHOW : OS.SW_HIDE);
+ break;
+ }
+ case SWT.Traverse: {
+ if (traverseOut) {
+ e.doit = true;
+ traverseOut = false;
+ } else {
+ e.doit = false;
+ }
+ break;
+ }
+ }
+ }
+ };
+ browser.addListener(SWT.Dispose, listener);
+ browser.addListener(SWT.KeyDown, listener); /* needed for tabbing into the Browser */
+ browser.addListener(SWT.FocusIn, listener);
+ browser.addListener(SWT.Resize, listener);
+ browser.addListener(SWT.Traverse, listener);
+ browser.addListener(SWT.Activate, listener);
+ browser.addListener(SWT.Deactivate, listener);
+ if (!browser.isFocusControl()) {
+ browser.getDisplay().addFilter(SWT.Traverse, filter);
+ }
+
+ eventFunction = new BrowserFunction (browser, "HandleWebKitEvent") { //$NON-NLS-1$
+ public Object function(Object[] arguments) {
+ return handleEvent (arguments) ? Boolean.TRUE : Boolean.FALSE;
+ };
+ };
+}
+
+public boolean execute (String script) {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.mainFrame(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return false;
+ }
+ IWebFrame frame = new IWebFrame(result[0]);
+ int /*long*/ context = frame.globalContext();
+ if (context == 0) {
+ return false;
+ }
+ byte[] bytes = null;
+ try {
+ bytes = (script + '\0').getBytes("UTF-8"); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ bytes = (script + '\0').getBytes();
+ }
+ int /*long*/ scriptString = WebKit_win32.JSStringCreateWithUTF8CString(bytes);
+ if (scriptString == 0) return false;
+ try {
+ bytes = (getUrl() + '\0').getBytes("UTF-8"); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ bytes = (getUrl() + '\0').getBytes();
+ }
+ int /*long*/ urlString = WebKit_win32.JSStringCreateWithUTF8CString(bytes);
+ if (urlString == 0) return false;
+ WebKit_win32.JSEvaluateScript(context, scriptString, 0, urlString, 0, null);
+ WebKit_win32.JSStringRelease(urlString);
+ WebKit_win32.JSStringRelease(scriptString);
+ return hr != COM.S_OK;
+}
+
+public boolean forward () {
+ int /*long*/[] result = new int /*long*/[1];
+ webView.goForward(result);
+ return result[0] != 0;
+}
+
+public String getBrowserType () {
+ return "webkit"; //$NON-NLS-1$
+}
+
+public String getText () {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.mainFrame(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return EMPTY_STRING;
+ }
+ IWebFrame mainFrame = new IWebFrame(result[0]);
+ result[0] = 0;
+ hr = mainFrame.dataSource(result);
+ mainFrame.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return EMPTY_STRING;
+ }
+ IWebDataSource dataSource = new IWebDataSource(result[0]);
+ result[0] = 0;
+ hr = dataSource.representation(result);
+ dataSource.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return EMPTY_STRING;
+ }
+ IWebDocumentRepresentation representation = new IWebDocumentRepresentation(result[0]);
+ result[0] = 0;
+ hr = representation.documentSource(result);
+ representation.Release();
+ if (hr != COM.S_OK || result[0] == 0) {
+ return EMPTY_STRING;
+ }
+ String source = extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ return source;
+}
+
+public String getUrl () {
+ return webFrameLoadDelegate.getUrl();
+}
+
+boolean handleEvent (Object[] arguments) {
+
+ /*
+ * DOM events are currently received by hooking DOM listeners
+ * in javascript that invoke this method via a BrowserFunction.
+ * Document.addListener is not implemented on WebKit on windows.
+ * The argument lists received here are:
+ *
+ * For key events:
+ * argument 0: type (String)
+ * argument 1: keyCode (Double)
+ * argument 2: charCode (Double)
+ * argument 3: altKey (Boolean)
+ * argument 4: ctrlKey (Boolean)
+ * argument 5: shiftKey (Boolean)
+ * argument 6: metaKey (Boolean)
+ * returns doit
+ *
+ * For mouse events
+ * argument 0: type (String)
+ * argument 1: screenX (Double)
+ * argument 2: screenY (Double)
+ * argument 3: detail (Double)
+ * argument 4: button (Double)
+ * argument 5: altKey (Boolean)
+ * argument 6: ctrlKey (Boolean)
+ * argument 7: shiftKey (Boolean)
+ * argument 8: metaKey (Boolean)
+ * argument 9: hasRelatedTarget (Boolean)
+ * returns doit
+ */
+
+ String type = (String)arguments[0];
+ if (type.equals (DOMEVENT_KEYDOWN)) {
+ int keyCode = translateKey (((Double)arguments[1]).intValue ());
+ lastKeyCode = keyCode;
+ switch (keyCode) {
+ case SWT.SHIFT:
+ case SWT.CONTROL:
+ case SWT.ALT:
+ case SWT.CAPS_LOCK:
+ case SWT.NUM_LOCK:
+ case SWT.SCROLL_LOCK:
+ case SWT.COMMAND:
+// case SWT.ESC:
+// case SWT.TAB:
+ case SWT.PAUSE:
+// case SWT.BS:
+ case SWT.INSERT:
+ case SWT.DEL:
+ case SWT.HOME:
+ case SWT.END:
+ case SWT.PAGE_UP:
+ case SWT.PAGE_DOWN:
+ case SWT.ARROW_DOWN:
+ case SWT.ARROW_UP:
+ case SWT.ARROW_LEFT:
+ case SWT.ARROW_RIGHT:
+ case SWT.F1:
+ case SWT.F2:
+ case SWT.F3:
+ case SWT.F4:
+ case SWT.F5:
+ case SWT.F6:
+ case SWT.F7:
+ case SWT.F8:
+ case SWT.F9:
+ case SWT.F10:
+ case SWT.F11:
+ case SWT.F12: {
+ /* keypress events will not be received for these keys, so send KeyDowns for them now */
+
+ Event keyEvent = new Event ();
+ keyEvent.widget = browser;
+ keyEvent.type = type.equals (DOMEVENT_KEYDOWN) ? SWT.KeyDown : SWT.KeyUp;
+ keyEvent.keyCode = keyCode;
+ switch (keyCode) {
+ case SWT.BS: keyEvent.character = SWT.BS; break;
+ case SWT.DEL: keyEvent.character = SWT.DEL; break;
+ case SWT.ESC: keyEvent.character = SWT.ESC; break;
+ case SWT.TAB: keyEvent.character = SWT.TAB; break;
+ }
+ lastCharCode = keyEvent.character;
+ keyEvent.stateMask =
+ (((Boolean)arguments[3]).booleanValue () ? SWT.ALT : 0) |
+ (((Boolean)arguments[4]).booleanValue () ? SWT.CTRL : 0) |
+ (((Boolean)arguments[5]).booleanValue () ? SWT.SHIFT : 0) |
+ (((Boolean)arguments[6]).booleanValue () ? SWT.COMMAND : 0);
+ keyEvent.stateMask &= ~keyCode; /* remove current keydown if it's a state key */
+ if (!sendKeyEvent (keyEvent) || browser.isDisposed ()) return false;
+ break;
+ }
+ }
+ return true;
+ }
+
+ if (type.equals (DOMEVENT_KEYPRESS)) {
+ System.out.println("keypress");
+ /*
+ * if keydown could not determine a keycode for this key then it's a
+ * key for which key events are not sent (eg.- the Windows key)
+ */
+ if (lastKeyCode == 0) return true;
+
+ lastCharCode = ((Double)arguments[2]).intValue ();
+ if (((Boolean)arguments[4]).booleanValue () && (0 <= lastCharCode && lastCharCode <= 0x7F)) {
+ if ('a' <= lastCharCode && lastCharCode <= 'z') lastCharCode -= 'a' - 'A';
+ if (64 <= lastCharCode && lastCharCode <= 95) lastCharCode -= 64;
+ }
+
+ Event keyEvent = new Event ();
+ keyEvent.widget = browser;
+ keyEvent.type = SWT.KeyDown;
+ keyEvent.keyCode = lastKeyCode;
+ keyEvent.character = (char)lastCharCode;
+ keyEvent.stateMask =
+ (((Boolean)arguments[3]).booleanValue () ? SWT.ALT : 0) |
+ (((Boolean)arguments[4]).booleanValue () ? SWT.CTRL : 0) |
+ (((Boolean)arguments[5]).booleanValue () ? SWT.SHIFT : 0) |
+ (((Boolean)arguments[6]).booleanValue () ? SWT.COMMAND : 0);
+ return sendKeyEvent (keyEvent) && !browser.isDisposed ();
+ }
+
+ if (type.equals(DOMEVENT_KEYUP)) {
+ int keyCode = translateKey (((Double)arguments[1]).intValue ());
+ if (keyCode == 0) {
+ /* indicates a key for which key events are not sent */
+ return true;
+ }
+ if (keyCode != lastKeyCode) {
+ /* keyup does not correspond to the last keydown */
+ lastKeyCode = keyCode;
+ lastCharCode = 0;
+ }
+
+ Event keyEvent = new Event ();
+ keyEvent.widget = browser;
+ keyEvent.type = SWT.KeyUp;
+ keyEvent.keyCode = lastKeyCode;
+ keyEvent.character = (char)lastCharCode;
+ keyEvent.stateMask =
+ (((Boolean)arguments[3]).booleanValue () ? SWT.ALT : 0) |
+ (((Boolean)arguments[4]).booleanValue () ? SWT.CTRL : 0) |
+ (((Boolean)arguments[5]).booleanValue () ? SWT.SHIFT : 0) |
+ (((Boolean)arguments[6]).booleanValue () ? SWT.COMMAND : 0);
+ switch (lastKeyCode) {
+ case SWT.SHIFT:
+ case SWT.CONTROL:
+ case SWT.ALT:
+ case SWT.COMMAND: {
+ keyEvent.stateMask |= lastKeyCode;
+ }
+ }
+ browser.notifyListeners (keyEvent.type, keyEvent);
+ lastKeyCode = lastCharCode = 0;
+ return keyEvent.doit && !browser.isDisposed ();
+ }
+
+ /* mouse events */
+
+ /*
+ * MouseOver and MouseOut events are fired any time the mouse enters or exits
+ * any element within the Browser. To ensure that SWT events are only
+ * fired for mouse movements into or out of the Browser, do not fire an
+ * event if there is a related target element.
+ */
+ if (type.equals (DOMEVENT_MOUSEOVER) || type.equals (DOMEVENT_MOUSEOUT)) {
+ if (((Boolean)arguments[9]).booleanValue ()) return true;
+ }
+
+ /*
+ * The position of mouse events is received in screen-relative coordinates
+ * in order to handle pages with frames, since frames express their event
+ * coordinates relative to themselves rather than relative to their top-
+ * level page. Convert screen-relative coordinates to be browser-relative.
+ */
+ Point position = new Point (((Double)arguments[1]).intValue (), ((Double)arguments[2]).intValue ());
+ position = browser.getDisplay ().map (null, browser, position);
+
+ Event mouseEvent = new Event ();
+ mouseEvent.widget = browser;
+ mouseEvent.x = position.x;
+ mouseEvent.y = position.y;
+ int mask =
+ (((Boolean)arguments[5]).booleanValue () ? SWT.ALT : 0) |
+ (((Boolean)arguments[6]).booleanValue () ? SWT.CTRL : 0) |
+ (((Boolean)arguments[7]).booleanValue () ? SWT.SHIFT : 0) |
+ (((Boolean)arguments[8]).booleanValue () ? SWT.COMMAND : 0);
+ mouseEvent.stateMask = mask;
+
+ if (type.equals (DOMEVENT_MOUSEDOWN)) {
+ mouseEvent.type = SWT.MouseDown;
+ mouseEvent.count = ((Double)arguments[3]).intValue ();
+ mouseEvent.button = ((Double)arguments[4]).intValue ();
+ browser.notifyListeners (mouseEvent.type, mouseEvent);
+ if (browser.isDisposed ()) return true;
+ if (((Double)arguments[3]).intValue () == 2) {
+ mouseEvent = new Event ();
+ mouseEvent.type = SWT.MouseDoubleClick;
+ mouseEvent.widget = browser;
+ mouseEvent.x = position.x;
+ mouseEvent.y = position.y;
+ mouseEvent.stateMask = mask;
+ mouseEvent.count = ((Double)arguments[3]).intValue ();
+ mouseEvent.button = ((Double)arguments[4]).intValue ();
+ browser.notifyListeners (mouseEvent.type, mouseEvent);
+ }
+ return true;
+ }
+
+ if (type.equals (DOMEVENT_MOUSEUP)) {
+ mouseEvent.type = SWT.MouseUp;
+ mouseEvent.count = ((Double)arguments[3]).intValue ();
+ mouseEvent.button = ((Double)arguments[4]).intValue ();
+ } else if (type.equals (DOMEVENT_MOUSEMOVE)) {
+ mouseEvent.type = SWT.MouseMove;
+ } else if (type.equals (DOMEVENT_MOUSEWHEEL)) {
+ mouseEvent.type = SWT.MouseWheel;
+ mouseEvent.count = ((Double)arguments[3]).intValue ();
+ } else if (type.equals (DOMEVENT_MOUSEOVER)) {
+ mouseEvent.type = SWT.MouseEnter;
+ } else if (type.equals (DOMEVENT_MOUSEOUT)) {
+ mouseEvent.type = SWT.MouseExit;
+ } else if (type.equals (DOMEVENT_DRAGSTART)) {
+ mouseEvent.type = SWT.DragDetect;
+ mouseEvent.button = ((Double)arguments[4]).intValue () + 1;
+ switch (mouseEvent.button) {
+ case 1: mouseEvent.stateMask |= SWT.BUTTON1; break;
+ case 2: mouseEvent.stateMask |= SWT.BUTTON2; break;
+ case 3: mouseEvent.stateMask |= SWT.BUTTON3; break;
+ case 4: mouseEvent.stateMask |= SWT.BUTTON4; break;
+ case 5: mouseEvent.stateMask |= SWT.BUTTON5; break;
+ }
+ }
+
+ browser.notifyListeners (mouseEvent.type, mouseEvent);
+ return true;
+}
+
+public boolean isBackEnabled () {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.QueryInterface (WebKit_win32.IID_IWebIBActions, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return false;
+ }
+ IWebIBActions webIBActions = new IWebIBActions(result[0]);
+ webIBActions.canGoBack(webView.getAddress(), result);
+ webIBActions.Release();
+ return result[0] != 0;
+}
+
+public boolean isFocusControl() {
+ int /*long*/ hwndFocus = OS.GetFocus ();
+ if (hwndFocus != 0 && hwndFocus == webViewWindowHandle) return true;
+ return false;
+}
+
+public boolean isForwardEnabled () {
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.QueryInterface (WebKit_win32.IID_IWebIBActions, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return false;
+ }
+ IWebIBActions webIBActions = new IWebIBActions(result[0]);
+ webIBActions.canGoForward(webView.getAddress(), result);
+ webIBActions.Release();
+ return result[0] != 0;
+}
+
+void onDispose() {
+ /* Browser could have been disposed by one of the Dispose listeners */
+ if (!browser.isDisposed()) {
+ /* invoke onbeforeunload handlers but don't prompt with message box*/
+ if (!browser.isClosing) {
+ webUIDelegate.prompt = false;
+ shouldClose();
+ webUIDelegate.prompt = true;
+ }
+ }
+
+ C.free (webViewData);
+// webView.close();
+ webView.setHostWindow(0);
+
+ webView.setFrameLoadDelegate(0);
+ webView.setResourceLoadDelegate(0);
+ webView.setUIDelegate(0);
+ webView.setPolicyDelegate(0);
+ webView.setDownloadDelegate(0);
+
+ webView.Release();
+
+ webView = null;
+ webViewWindowHandle = 0;
+ webFrameLoadDelegate.html = null;
+ webUIDelegate.lastHoveredLinkURL = lastNavigateURL = null;
+
+ Enumeration elements = functions.elements ();
+ while (elements.hasMoreElements ()) {
+ ((BrowserFunction)elements.nextElement ()).dispose (false);
+ }
+ functions = null;
+}
+
+void onFocus() {
+ OS.SetFocus (webViewWindowHandle);
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.QueryInterface (WebKit_win32.IID_IWebViewPrivate, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebViewPrivate webViewPrivate = new IWebViewPrivate (result[0]);
+ webViewPrivate.setInitialFocus(traverseNext);
+ webViewPrivate.Release();
+}
+
+public void refresh () {
+ webFrameLoadDelegate.html = null;
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.QueryInterface (WebKit_win32.IID_IWebIBActions, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebIBActions webIBActions = new IWebIBActions(result[0]);
+ webIBActions.reload(webView.getAddress());
+ webIBActions.Release();
+}
+
+boolean sendKeyEvent (Event event) {
+ boolean doit = true;
+ switch (event.keyCode) {
+ case SWT.ESC:
+ case SWT.CR:
+ case SWT.ARROW_DOWN:
+ case SWT.ARROW_RIGHT:
+ case SWT.ARROW_UP:
+ case SWT.ARROW_LEFT:
+ case SWT.TAB:
+ case SWT.PAGE_DOWN:
+ case SWT.PAGE_UP:
+ doit = false;
+ break;
+ default: {
+ if (translateMnemonics ()) {
+ if (event.character != 0 && (event.stateMask & (SWT.ALT | SWT.CTRL)) == SWT.ALT) {
+ int traversal = SWT.TRAVERSE_MNEMONIC;
+ boolean oldEventDoit = event.doit;
+ event.doit = true;
+ doit = !browser.traverse (traversal, event);
+ event.doit = oldEventDoit;
+ }
+ }
+ break;
+ }
+ }
+ if (doit) {
+ browser.notifyListeners (event.type, event);
+ doit = event.doit;
+ }
+ return doit;
+}
+
+public boolean setText (String html, boolean trusted) {
+ /*
+ * If this.html is not null then the about:blank page is already being loaded,
+ * so no navigate is required. Just set the html that is to be shown.
+ */
+ boolean blankLoading = webFrameLoadDelegate.html != null;
+ webFrameLoadDelegate.html = html;
+ untrustedText = !trusted;
+ if (blankLoading) return true;
+
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.mainFrame (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return false;
+ }
+ IWebFrame frame = new IWebFrame (result[0]);
+
+ result[0] = 0;
+ hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebMutableURLRequest, 0, WebKit_win32.IID_IWebMutableURLRequest, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ frame.Release();
+ return false;
+ }
+ IWebMutableURLRequest request = new IWebMutableURLRequest (result[0]);
+
+ int /*long*/ urlString = createBSTR (ABOUT_BLANK);
+ hr = request.setURL (urlString);
+ COM.SysFreeString (urlString);
+
+ if (hr == COM.S_OK) {
+ hr = frame.loadRequest (request.getAddress ());
+ }
+ frame.Release();
+ request.Release();
+ return hr == COM.S_OK;
+}
+
+public boolean setUrl (String url, String postData, String[] headers) {
+ if (url.length() == 0) return false;
+ /*
+ * WebKit attempts to open the exact url string that is passed to it and
+ * will not infer a protocol if it's not specified. Detect the case of an
+ * invalid URL string and try to fix it by prepending an appropriate protocol.
+ */
+ try {
+ new URL(url);
+ } catch (MalformedURLException e) {
+ String testUrl = null;
+ if (url.length() > 1 && url.charAt(0) == SEPARATOR_FILE && url.charAt(1) == SEPARATOR_FILE) {
+ /* appears to be a local file */
+ testUrl = PROTOCOL_FILE + url.substring(1);
+ } else {
+ testUrl = PROTOCOL_HTTP + url;
+ }
+ try {
+ new URL (testUrl);
+ url = testUrl; /* adding the protocol made the url valid */
+ } catch (MalformedURLException e2) {
+ /* adding the protocol did not make the url valid, so do nothing */
+ }
+ }
+ webFrameLoadDelegate.html = null;
+ lastNavigateURL = url;
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.mainFrame (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return false;
+ }
+ IWebFrame frame = new IWebFrame (result[0]);
+
+ result[0] = 0;
+ hr = WebKit_win32.WebKitCreateInstance (WebKit_win32.CLSID_WebMutableURLRequest, 0, WebKit_win32.IID_IWebMutableURLRequest, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ frame.Release();
+ return false;
+ }
+ IWebMutableURLRequest request = new IWebMutableURLRequest (result[0]);
+
+ if (postData != null) { //TODO: POST
+// webResourceLoadDelegate.postData = postData;
+// int /*long*/ postString = createBSTR(POST);
+// hr = request.setHTTPMethod(postString);
+// COM.SysFreeString(postString);
+//
+// result[0] = 0;
+// hr = request.QueryInterface(WebKit_win32.IID_IWebMutableURLRequestPrivate, result);
+// if (hr == COM.S_OK && result[0] != 0) {
+// IWebMutableURLRequestPrivate requestPrivate = new IWebMutableURLRequestPrivate(result[0]);
+// int cfRequest = requestPrivate.cfRequest();
+// byte[] bytes = postData.getBytes();
+// int /*long*/ data = WebKit_win32.CFDataCreate(0, bytes, bytes.length);
+// if (data != 0)WebKit_win32.CFURLRequestSetHTTPRequestBody(cfRequest, data);
+//
+// int /*long*/ dataGet = WebKit_win32.CFURLRequestCopyHTTPRequestBody(cfRequest);
+// int length = WebKit_win32.CFDataGetLength(dataGet);
+// int /*long*/ bytePtr = WebKit_win32.CFDataGetBytePtr(dataGet);
+// }
+ }
+ hr = COM.S_OK; //TODO: once post code is completed, remove this line if not required
+ if (headers != null) {
+ for (int i = 0; i < headers.length; i++) {
+ String current = headers[i];
+ if (current != null) {
+ int index = current.indexOf(':');
+ if (index != -1) {
+ String key = current.substring(0, index).trim();
+ String value = current.substring(index + 1).trim();
+ if (key.length() > 0 && value.length() > 0) {
+ int /*long*/ valueString = createBSTR(value);
+ if (key.equalsIgnoreCase(USER_AGENT)) {
+ /*
+ * Feature of WebKit. The user-agent header value cannot be overridden
+ * here. The workaround is to temporarily set the value on the WebView
+ * and then remove it after the loading of the request has begun.
+ */
+ hr = webView.setCustomUserAgent(valueString);
+ } else {
+ int /*long*/ keyString = createBSTR(key);
+ hr = request.setValue(valueString, keyString);
+ COM.SysFreeString(keyString);
+ }
+ COM.SysFreeString(valueString);
+ }
+ }
+ }
+ }
+ }
+ if (hr == COM.S_OK) {
+ int /*long*/ urlString = createBSTR (url);
+ hr = request.setURL (urlString);
+ COM.SysFreeString (urlString);
+ if (hr == COM.S_OK) {
+ hr = frame.loadRequest (request.getAddress ());
+ }
+ webView.setCustomUserAgent(0);
+ }
+ frame.Release();
+ request.Release();
+ return hr == COM.S_OK;
+}
+
+boolean shouldClose () {
+ if (!jsEnabled) return true;
+
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.QueryInterface (WebKit_win32.IID_IWebViewPrivate, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return false;
+ }
+ IWebViewPrivate webViewPrivate = new IWebViewPrivate (result[0]);
+ result[0] = 0;
+ //This function will fire the before unload handler for a page
+ webViewPrivate.shouldClose(result);
+ webViewPrivate.Release();
+ return result[0] != 0;
+}
+
+public void stop () {
+ webFrameLoadDelegate.html = null;
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = webView.QueryInterface (WebKit_win32.IID_IWebIBActions, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return;
+ }
+ IWebIBActions webIBActions = new IWebIBActions(result[0]);
+ webIBActions.stopLoading(webView.getAddress());
+ webIBActions.Release();
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebPolicyDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebPolicyDelegate.java
new file mode 100644
index 0000000000..5e28fa0dde
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebPolicyDelegate.java
@@ -0,0 +1,208 @@
+package org.eclipse.swt.browser;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.Compatibility;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.COMObject;
+import org.eclipse.swt.internal.ole.win32.GUID;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+import org.eclipse.swt.internal.webkit.IWebError;
+import org.eclipse.swt.internal.webkit.IWebPolicyDecisionListener;
+import org.eclipse.swt.internal.webkit.IWebPreferences;
+import org.eclipse.swt.internal.webkit.IWebURLRequest;
+import org.eclipse.swt.internal.webkit.IWebView;
+import org.eclipse.swt.internal.webkit.WebKit_win32;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.widgets.MessageBox;
+
+public class WebPolicyDelegate {
+ COMObject iWebPolicyDelegate;
+ int refCount = 0;
+
+ Browser browser;
+
+WebPolicyDelegate() {
+ createCOMInterfaces();
+}
+
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+
+void createCOMInterfaces () {
+ iWebPolicyDelegate = new COMObject (new int[] {2, 0, 0, 5, 5, 5, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return decidePolicyForNavigationAction (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return decidePolicyForNewWindowAction (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return decidePolicyForMIMEType (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return unableToImplementPolicyWithError(args[0], args[1], args[2]);}
+ };
+}
+
+int decidePolicyForMIMEType(int /*long*/ webView, int /*long*/ type, int /*long*/ request, int /*long*/ frame,
+ int /*long*/ listener) {
+ IWebView iwebView = new IWebView(webView);
+ int /*long*/[] canShow = new int /*long*/[1];
+ iwebView.canShowMIMEType(type, canShow);
+ IWebPolicyDecisionListener pdListener = new IWebPolicyDecisionListener(listener);
+ if (canShow[0] != 0) {
+ pdListener.use();
+ } else {
+ pdListener.download();
+ }
+ return COM.S_OK;
+}
+
+int decidePolicyForNavigationAction(int /*long*/ webView, int /*long*/ actionInformation, int /*long*/ request, int /*long*/ frame,
+ int /*long*/ listener) {
+ IWebURLRequest iwebUrlRequest = new IWebURLRequest(request);
+ int /*long*/[] result = new int /*long*/ [1];
+ int hr = iwebUrlRequest.URL(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String url = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ IWebPolicyDecisionListener pdListener = new IWebPolicyDecisionListener(listener);
+ if (((WebKit)browser.webBrowser).loadingText) {
+ /*
+ * WebKit is auto-navigating to about:blank in response to a loadHTMLString()
+ * invocation. This navigate should always proceed without sending an event
+ * since it is preceded by an explicit navigate to about:blank in setText().
+ */
+ pdListener.use();
+ return COM.S_OK;
+ }
+ if (url.length() == 0) {
+ pdListener.ignore();
+ return COM.S_OK;
+ }
+ if (url.startsWith("file://") && browser.webBrowser.getUrl().startsWith(WebKit.ABOUT_BLANK) && ((WebKit)browser.webBrowser).untrustedText) {
+ /* indicates an attempt to access the local file system from untrusted content */
+ pdListener.ignore();
+ return COM.S_OK;
+ }
+ /*
+ * If the URI indicates that the page is being rendered from memory
+ * (via setText()) then set it to about:blank to be consistent with IE.
+ */
+ if (url.equals (WebKit.URI_FILEROOT)) {
+ url = WebKit.ABOUT_BLANK;
+ } else {
+ int length = WebKit.URI_FILEROOT.length ();
+ if (url.startsWith (WebKit.URI_FILEROOT) && url.charAt (length) == '#') {
+ url = WebKit.ABOUT_BLANK + url.substring (length);
+ }
+ }
+ LocationEvent newEvent = new LocationEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ newEvent.location = url;
+ newEvent.doit = true;
+ LocationListener[] locationListeners = browser.webBrowser.locationListeners;
+ if (locationListeners != null) {
+ for (int i = 0; i < locationListeners.length; i++) {
+ locationListeners[i].changing(newEvent);
+ }
+ }
+ if (newEvent.doit) {
+ if (browser.webBrowser.jsEnabledChanged) {
+ browser.webBrowser.jsEnabledChanged = false;
+ IWebView view = new IWebView(webView);
+ result[0] = 0;
+ hr = view.preferences(result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebPreferences preferences = new IWebPreferences(result[0]);
+ hr = preferences.setJavaScriptEnabled(browser.webBrowser.jsEnabled);
+ view.setPreferences(preferences.getAddress());
+ preferences.Release();
+ }
+ }
+ pdListener.use();
+ ((WebKit)browser.webBrowser).lastNavigateURL = url;
+ } else {
+ pdListener.ignore();
+ }
+ return COM.S_OK;
+}
+
+int decidePolicyForNewWindowAction(int /*long*/ webView, int /*long*/ actionInformation, int /*long*/ request, int /*long*/ frameName,
+ int /*long*/ listener) {
+ IWebPolicyDecisionListener pdListener = new IWebPolicyDecisionListener(listener);
+ pdListener.use();
+ return COM.S_OK;
+}
+
+protected void disposeCOMInterfaces () {
+ System.out.println ("======== disposing iWebPolicyDelegate");
+ if (iWebPolicyDelegate != null) {
+ iWebPolicyDelegate.dispose ();
+ iWebPolicyDelegate = null;
+ }
+}
+
+int /*long*/ getAddress () {
+ return iWebPolicyDelegate.getAddress ();
+}
+
+int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG;
+ GUID guid = new GUID ();
+ COM.MoveMemory (guid, riid, GUID.sizeof);
+
+ if (COM.IsEqualGUID (guid, COM.IIDIUnknown)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebPolicyDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebPolicyDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID (guid, WebKit_win32.IID_IWebPolicyDelegate)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebPolicyDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebPolicyDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+
+ COM.MoveMemory (ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ return COM.E_NOINTERFACE;
+}
+
+int Release () {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces ();
+ }
+ return refCount;
+}
+
+void setBrowser (Browser browser) {
+ this.browser = browser;
+}
+
+int unableToImplementPolicyWithError(int /*long*/ webView, int /*long*/ error, int /*long*/ frame) {
+ IWebError iweberror = new IWebError(error);
+ String failingURL = null;
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = iweberror.failingURL (result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ failingURL = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ }
+ result[0] = 0;
+ hr = iweberror.localizedDescription(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String description = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ if (!browser.isDisposed() && description != null) {
+ String message = failingURL != null ? failingURL + "\n\n" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ message += Compatibility.getMessage ("SWT_Page_Load_Failed", new Object[] {description}); //$NON-NLS-1$
+ MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.ICON_ERROR);
+ messageBox.setMessage(message);
+ messageBox.open();
+ }
+ return COM.S_OK;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java
new file mode 100644
index 0000000000..c811f8a4f2
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java
@@ -0,0 +1,388 @@
+package org.eclipse.swt.browser;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.Compatibility;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.COMObject;
+import org.eclipse.swt.internal.ole.win32.GUID;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+import org.eclipse.swt.internal.webkit.IWebDataSource;
+import org.eclipse.swt.internal.webkit.IWebFrame;
+import org.eclipse.swt.internal.webkit.IWebMutableURLRequest;
+import org.eclipse.swt.internal.webkit.IWebURLAuthenticationChallenge;
+import org.eclipse.swt.internal.webkit.IWebURLAuthenticationChallengeSender;
+import org.eclipse.swt.internal.webkit.IWebURLCredential;
+import org.eclipse.swt.internal.webkit.IWebURLProtectionSpace;
+import org.eclipse.swt.internal.webkit.IWebURLRequest;
+import org.eclipse.swt.internal.webkit.IWebView;
+import org.eclipse.swt.internal.webkit.WebKit_win32;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+class WebResourceLoadDelegate {
+ COMObject iWebResourceLoadDelegate;
+ int refCount = 0;
+ Browser browser;
+ String postData;
+
+WebResourceLoadDelegate() {
+ createCOMInterfaces();
+}
+
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+
+void createCOMInterfaces () {
+ iWebResourceLoadDelegate = new COMObject (new int[] {2, 0, 0, 4, 6, 4, 4, 4, 4, 3, 4, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return identifierForInitialRequest (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return willSendRequest(args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return didReceiveAuthenticationChallenge (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method7 (int /*long*/[] args) {return COM.S_OK;}
+ public int /*long*/ method8 (int /*long*/[] args) {return COM.S_OK;}
+ public int /*long*/ method9 (int /*long*/[] args) {return COM.S_OK;}
+ public int /*long*/ method10 (int /*long*/[] args){return COM.S_OK;}
+ public int /*long*/ method11 (int /*long*/[] args){return COM.E_NOTIMPL;}
+ };
+}
+
+int didReceiveAuthenticationChallenge(int /*long*/ webView, int /*long*/ identifier, int /*long*/ challenge, int /*long*/ dataSource) {
+ IWebURLAuthenticationChallenge iweburlChallenge = new IWebURLAuthenticationChallenge(challenge);
+ /*
+ * Do not invoke the listeners if this challenge has been failed too many
+ * times because a listener is likely giving incorrect credentials repeatedly
+ * and will do so indefinitely.
+ */
+ int /*long*/ [] result = new int /*long*/ [1];
+ int hr = iweburlChallenge.previousFailureCount (result);
+ if (hr != COM.S_OK) {
+ return COM.S_OK;
+ }
+ if (result[0] < 3) {
+ AuthenticationListener[] authenticationListeners = browser.webBrowser.authenticationListeners;
+ for (int i = 0; i < authenticationListeners.length; i++) {
+ AuthenticationEvent event = new AuthenticationEvent (browser);
+ event.location = ((WebKit)browser.webBrowser).lastNavigateURL;
+ authenticationListeners[i].authenticate (event);
+ if (!event.doit) {
+ result[0] = 0;
+ hr = iweburlChallenge.sender (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebURLAuthenticationChallengeSender challengeSender = new IWebURLAuthenticationChallengeSender(result[0]);
+ challengeSender.cancelAuthenticationChallenge(challenge);
+ challengeSender.Release();
+ return COM.S_OK;
+ }
+ if (event.user != null && event.password != null) {
+ result[0] = 0;
+ hr = iweburlChallenge.sender (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebURLAuthenticationChallengeSender challengeSender = new IWebURLAuthenticationChallengeSender(result[0]);
+ result[0] = 0;
+ hr = WebKit_win32.WebKitCreateInstance(WebKit_win32.CLSID_IWebURLCredential, 0, WebKit_win32.IID_IWebURLCredential, result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebURLCredential credential = new IWebURLCredential(result[0]);
+ int /*long*/ user = WebKit.createBSTR(event.user);
+ int /*long*/ password = WebKit.createBSTR(event.password);
+ credential.initWithUser(user, password, WebKit_win32.WebURLCredentialPersistenceForSession);
+ challengeSender.useCredential(result[0], challenge);
+ credential.Release();
+ }
+ challengeSender.Release();
+ return COM.S_OK;
+ }
+ }
+ }
+
+ /* show a custom authentication dialog */
+ String[] userReturn = new String[1], passwordReturn = new String[1];
+ result[0] = 0;
+ hr = iweburlChallenge.proposedCredential (result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebURLCredential proposedCredential = new IWebURLCredential(result[0]);
+ result[0] = 0;
+ hr = proposedCredential.user (result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ userReturn[0] = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ result[0] = 0;
+ hr = proposedCredential.hasPassword (result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ result[0] = 0;
+ hr = proposedCredential.password (result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ passwordReturn[0] = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ }
+ }
+ }
+ proposedCredential.Release();
+ }
+ result[0] = 0;
+ hr = iweburlChallenge.protectionSpace (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebURLProtectionSpace space = new IWebURLProtectionSpace(result[0]);
+ String host = null, realm = null;
+ result[0] = 0;
+ hr = space.isProxy(result);
+ System.out.println("result"+ result[0]);
+ hr = space.host (result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ host = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ result[0] = 0;
+ hr = space.port (result);
+ if (hr == COM.S_OK) {
+ host += ":" + result[0];
+ result[0] = 0;
+ hr = space.realm (result);
+ space.Release();
+ if (hr == COM.S_OK && result[0] != 0) {
+ realm = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ }
+ }
+ }
+ host = realm = null;
+ boolean response = showAuthenticationDialog (userReturn, passwordReturn, host, realm);
+ result[0] = 0;
+ hr = iweburlChallenge.sender (result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebURLAuthenticationChallengeSender challengeSender = new IWebURLAuthenticationChallengeSender(result[0]);
+ if (!response) {
+ challengeSender.cancelAuthenticationChallenge(challenge);
+ challengeSender.Release();
+ return COM.S_OK;
+ }
+ result[0] = 0;
+ hr = WebKit_win32.WebKitCreateInstance(WebKit_win32.CLSID_IWebURLCredential, 0, WebKit_win32.IID_IWebURLCredential, result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebURLCredential credential = new IWebURLCredential(result[0]);
+ int /*long*/ user = WebKit.createBSTR(userReturn[0]);
+ int /*long*/ password = WebKit.createBSTR(passwordReturn[0]);
+ credential.initWithUser(user, password, WebKit_win32.WebURLCredentialPersistenceForSession);
+ challengeSender.useCredential(result[0], challenge);
+ credential.Release();
+ }
+ challengeSender.Release();
+ return COM.S_OK;
+}
+
+void disposeCOMInterfaces () {
+ System.out.println ("======== disposing iWebResourceLoadDelegate");
+ if (iWebResourceLoadDelegate != null) {
+ iWebResourceLoadDelegate.dispose ();
+ iWebResourceLoadDelegate = null;
+ }
+}
+
+int /*long*/ getAddress () {
+ return iWebResourceLoadDelegate.getAddress ();
+}
+
+int identifierForInitialRequest(int /*long*/ webView, int /*long*/ request, int /*long*/ dataSource, int /*long*/ identifier) {
+ if (browser.isDisposed()) return COM.S_OK;
+
+ IWebDataSource source = new IWebDataSource(dataSource);
+ int /*long*/[] frame = new int /*long*/[1];
+ int hr = source.webFrame(frame);
+ if (hr != COM.S_OK || frame[0] == 0) {
+ return COM.S_OK;
+ }
+ new IWebFrame(frame[0]).Release();
+ int /*long*/[] mainFrame = new int /*long*/[1];
+ IWebView iWebView = new IWebView(webView);
+ hr = iWebView.mainFrame(mainFrame);
+ if (hr != COM.S_OK || mainFrame[0] == 0) {
+ return COM.S_OK;
+ }
+ new IWebFrame(mainFrame[0]).Release();
+ if (frame[0] == mainFrame[0]) {
+ int /*long*/ progress = OS.malloc(C.PTR_SIZEOF);
+ iWebView.estimatedProgress(progress);
+ double [] estimate = new double[1];
+ OS.MoveMemory(estimate, progress, 8);
+ OS.free(progress);
+ progress = (int) (estimate[0] * 100);
+
+ ProgressEvent progressEvent = new ProgressEvent(browser);
+ progressEvent.display = browser.getDisplay();
+ progressEvent.widget = browser;
+ progressEvent.current = (int)(progress);
+ progressEvent.total = Math.max((int)progress, WebKit.MAX_PROGRESS);
+ ProgressListener[] progressListeners = browser.webBrowser.progressListeners;
+ for (int i = 0; i < progressListeners.length; i++) {
+ progressListeners[i].changed(progressEvent);
+ }
+ }
+ return COM.S_OK;
+}
+
+int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG;
+ GUID guid = new GUID ();
+ COM.MoveMemory (guid, riid, GUID.sizeof);
+
+ if (COM.IsEqualGUID (guid, COM.IIDIUnknown)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebResourceLoadDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebResourceLoadDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID (guid, WebKit_win32.IID_IWebResourceLoadDelegate)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebResourceLoadDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebResourceLoadDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+
+ COM.MoveMemory (ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ return COM.E_NOINTERFACE;
+}
+
+int Release () {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces ();
+ }
+ return refCount;
+}
+
+void setBrowser (Browser browser) {
+ this.browser = browser;
+}
+
+boolean showAuthenticationDialog (final String[] user, final String[] password, String host, String realm) {
+ Shell parent = browser.getShell ();
+ final Shell shell = new Shell (parent);
+ shell.setLayout (new GridLayout ());
+ String title = SWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$
+ shell.setText (title);
+ Label label = new Label (shell, SWT.WRAP);
+ label.setText (Compatibility.getMessage ("SWT_Enter_Username_and_Password", new String[] {realm, host})); //$NON-NLS-1$
+
+ GridData data = new GridData ();
+ Monitor monitor = browser.getMonitor ();
+ int maxWidth = monitor.getBounds ().width * 2 / 3;
+ int width = label.computeSize (SWT.DEFAULT, SWT.DEFAULT).x;
+ data.widthHint = Math.min (width, maxWidth);
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ label.setLayoutData (data);
+
+ Label userLabel = new Label (shell, SWT.NONE);
+ userLabel.setText (SWT.getMessage ("SWT_Username")); //$NON-NLS-1$
+
+ final Text userText = new Text (shell, SWT.BORDER);
+ if (user[0] != null) userText.setText (user[0]);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ userText.setLayoutData (data);
+
+ Label passwordLabel = new Label (shell, SWT.NONE);
+ passwordLabel.setText (SWT.getMessage ("SWT_Password")); //$NON-NLS-1$
+
+ final Text passwordText = new Text (shell, SWT.PASSWORD | SWT.BORDER);
+ if (password[0] != null) passwordText.setText (password[0]);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ passwordText.setLayoutData (data);
+
+ final boolean[] result = new boolean[1];
+ final Button[] buttons = new Button[2];
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ user[0] = userText.getText();
+ password[0] = passwordText.getText();
+ result[0] = event.widget == buttons[1];
+ shell.close();
+ }
+ };
+
+ Composite composite = new Composite (shell, SWT.NONE);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.END;
+ composite.setLayoutData (data);
+ composite.setLayout (new GridLayout (2, true));
+ buttons[0] = new Button (composite, SWT.PUSH);
+ buttons[0].setText (SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+ buttons[0].setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
+ buttons[0].addListener (SWT.Selection, listener);
+ buttons[1] = new Button (composite, SWT.PUSH);
+ buttons[1].setText (SWT.getMessage("SWT_OK")); //$NON-NLS-1$
+ buttons[1].setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
+ buttons[1].addListener (SWT.Selection, listener);
+
+ shell.setDefaultButton (buttons[1]);
+ shell.pack ();
+ Rectangle parentSize = parent.getBounds();
+ Rectangle shellSize = shell.getBounds();
+ int x, y;
+ x = parent.getLocation().x + (parentSize.width - shellSize.width)/2;
+ y = parent.getLocation().y + (parentSize.height - shellSize.height)/2;
+ shell.setLocation(x, y);
+ shell.open ();
+ Display display = browser.getDisplay ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+
+ return result[0];
+}
+
+int willSendRequest(int /*long*/ webView, int /*long*/ identifier, int /*long*/ request, int /*long*/ redirectResponse, int /*long*/ dataSource, int /*long*/ newRequest) {
+ IWebURLRequest req = new IWebURLRequest(request);
+ int /*long*/[] result = new int /*long*/ [1];
+ int hr = req.URL(result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ String url = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ /*
+ * file://c|/ doesn't work on Webkit but works on other browsers.
+ * So change file:// to file:/// to be consistent
+ */
+ if (url.startsWith(WebKit.PROTOCOL_FILE) && !url.startsWith(WebKit.URI_FILEROOT)) {
+ int length = WebKit.PROTOCOL_FILE.length ();
+ url = WebKit.URI_FILEROOT + url.substring(length);
+ result[0] = 0;
+
+ hr = req.mutableCopy(result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebMutableURLRequest mReq = new IWebMutableURLRequest(result[0]);
+ int /*long*/ urlString = WebKit.createBSTR (url);
+ mReq.setURL(urlString);
+ OS.MoveMemory (newRequest, new int /*long*/[] {mReq.getAddress()}, C.PTR_SIZEOF);
+ return COM.S_OK;
+ }
+ }
+ }
+ req.AddRef ();
+ OS.MoveMemory (newRequest, new int /*long*/[] {request}, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java
new file mode 100644
index 0000000000..34ecc4f3fe
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java
@@ -0,0 +1,599 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.Compatibility;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.COMObject;
+import org.eclipse.swt.internal.ole.win32.GUID;
+import org.eclipse.swt.internal.ole.win32.IPropertyBag;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+import org.eclipse.swt.internal.ole.win32.VARIANT;
+import org.eclipse.swt.internal.webkit.IWebDataSource;
+import org.eclipse.swt.internal.webkit.IWebFrame;
+import org.eclipse.swt.internal.webkit.IWebFramePrivate;
+import org.eclipse.swt.internal.webkit.IWebOpenPanelResultListener;
+import org.eclipse.swt.internal.webkit.IWebURLRequest;
+import org.eclipse.swt.internal.webkit.IWebView;
+import org.eclipse.swt.internal.webkit.WebKit_win32;
+import org.eclipse.swt.internal.win32.DOCINFO;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.internal.win32.PRINTDLG;
+import org.eclipse.swt.internal.win32.RECT;
+import org.eclipse.swt.internal.win32.TCHAR;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+class WebUIDelegate {
+ COMObject iWebUIDelegate;
+ int refCount = 0;
+ String lastHoveredLinkURL;
+ Browser browser;
+ Point size;
+ Point location;
+ boolean menuBar = true, toolBar = true, statusBar = true;
+ boolean prompt = true;
+
+WebUIDelegate () {
+ createCOMInterfaces ();
+}
+
+int AddRef () {
+ refCount++;
+ return refCount;
+}
+
+int canTakeFocus(int /*long*/ sender, int /*long*/ forward, int /*long*/ result) {
+ int [] response = new int[1];
+ response[0] = 1;
+ OS.MoveMemory(result, response, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+
+int contextMenuItemsForElement(int /*long*/ sender, int /*long*/ element, int /*long*/ defaultItemsHMenu, int /*long*/ resultHMenu) {
+ Point pt = browser.getDisplay().getCursorLocation();
+ Event event = new Event();
+ event.x = pt.x;
+ event.y = pt.y;
+ browser.notifyListeners(SWT.MenuDetect, event);
+ Menu menu = browser.getMenu();
+ if (event.doit) {
+ if (menu != null && !menu.isDisposed()) {
+ if (event.x != pt.x || event.y != pt.y) {
+ menu.setLocation(event.x, event.y);
+ }
+ menu.setVisible(true);
+ } else {
+ OS.MoveMemory(resultHMenu, new long[] {defaultItemsHMenu}, C.PTR_SIZEOF);
+ return COM.S_OK;
+ }
+ }
+ OS.MoveMemory(resultHMenu, new /*long*/ int []{0}, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+
+void createCOMInterfaces () {
+ iWebUIDelegate = new COMObject (new int[] {2, 0, 0, 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 2, 3, 4, 4, 3, 3, 3, 3, 5, 3, 1, 3, 2, 2, 2, 2, 3, 2, 3, 1, 1, 0, 0, 1, 1, 2, 2, 2, 2, 3, 5, 2, 2, 3, 1, 2, 2, 4, 10, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release();}
+ public int /*long*/ method3 (int /*long*/[] args) {return createWebViewWithRequest (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return webViewShow(args[0]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return webViewClose (args[0]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method7 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method8 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method9 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method10 (int /*long*/[] args) {return setStatusText(args[0], args[1]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method12 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method13 (int /*long*/[] args) {return setToolbarsVisible(args[0], args[1]);}
+ public int /*long*/ method14 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method15 (int /*long*/[] args) {return setStatusBarVisible(args[0], args[1]);}
+ public int /*long*/ method16 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method17 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method18 (int /*long*/[] args) {return setFrame(args[0], args[1]);}
+ public int /*long*/ method19 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method20 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method21 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method22 (int /*long*/[] args) {return runJavaScriptAlertPanelWithMessage (args[0], args[1]);}
+ public int /*long*/ method23 (int /*long*/[] args) {return runJavaScriptConfirmPanelWithMessage(args[0], args[1], args[2]);}
+ public int /*long*/ method24 (int /*long*/[] args) {return runJavaScriptTextInputPanelWithPrompt(args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method25 (int /*long*/[] args) {return runBeforeUnloadConfirmPanelWithMessage(args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method26 (int /*long*/[] args) {return runOpenPanelForFileButtonWithResultListener(args[0], args[1]);}
+ public int /*long*/ method27 (int /*long*/[] args) {return mouseDidMoveOverElement(args[0], args[1], args[2]);}
+ public int /*long*/ method28 (int /*long*/[] args) {return contextMenuItemsForElement(args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method29 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method30 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method31 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method32 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method33 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method34 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method35 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method36 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method37 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method38 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method39 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method40 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method41 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method42 (int /*long*/[] args) {return canTakeFocus(args[0], args[1], args[2]);}
+ public int /*long*/ method43 (int /*long*/[] args) {return takeFocus(args[0], args[1]);}
+ public int /*long*/ method44 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method45 (int /*long*/[] args) {return COM.S_OK;}
+ public int /*long*/ method46 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method47 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method48 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method49 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method50 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method51 (int /*long*/[] args) {return printFrame (args[0], args[1]);}
+ public int /*long*/ method52 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method53 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method54 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method55 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method56 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method57 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method58 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method59 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method60 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method61 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method62 (int /*long*/[] args) {return setMenuBarVisible (args[0], args[1]);}
+ public int /*long*/ method63 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method64 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ public int /*long*/ method65 (int /*long*/[] args) {return COM.E_NOTIMPL;}
+ };
+}
+
+int createWebViewWithRequest(int /*long*/ sender, int /*long*/ request, int /*long*/ webView) {
+ WindowEvent newEvent = new WindowEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ newEvent.required = true;
+ OpenWindowListener[] openWindowListeners = browser.webBrowser.openWindowListeners;
+ if (openWindowListeners != null) {
+ for (int i = 0; i < openWindowListeners.length; i++) {
+ openWindowListeners[i].open(newEvent);
+ }
+ }
+ IWebView iwebview = null;
+ Browser browser = null;
+ if (newEvent.browser != null && newEvent.browser.webBrowser instanceof WebKit) {
+ browser = newEvent.browser;
+ }
+ if (browser != null && !browser.isDisposed()) {
+ iwebview = ((WebKit)browser.webBrowser).webView;
+ OS.MoveMemory(webView, new int /*long*/[] {iwebview.getAddress ()}, OS.PTR_SIZEOF);
+ if (request != 0) {
+ IWebURLRequest req = new IWebURLRequest(request);
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = req.URL(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ String sUrl = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ if (sUrl.length() != 0) {
+ result[0] = 0;
+ hr = iwebview.mainFrame(result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebFrame mainFrame = new IWebFrame(result[0]);
+ mainFrame.loadRequest(req.getAddress());
+ mainFrame.Release();
+ }
+ }
+ return COM.S_OK;
+ }
+ return COM.E_NOTIMPL;
+}
+
+protected void disposeCOMInterfaces () {
+ System.out.println ("======== disposing iWebUIDelegate");
+ if (iWebUIDelegate != null) {
+ iWebUIDelegate.dispose ();
+ iWebUIDelegate = null;
+ }
+}
+
+int /*long*/ getAddress () {
+ return iWebUIDelegate.getAddress ();
+}
+
+int mouseDidMoveOverElement(int /*long*/ sender, int /*long*/ elementInformation, int /*long*/ modifierFlags) {
+ if (elementInformation == 0) return COM.S_OK;
+
+ IPropertyBag info = new IPropertyBag(elementInformation);
+ int /*long*/ key = WebKit.createBSTR("WebElementLinkURLKey"); //$NON-NLS-N$
+ int /*long*/ hHeap = OS.GetProcessHeap();
+ int /*long*/ resultPtr = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, VARIANT.sizeof);
+ int hr = info.Read(key, resultPtr, null);
+ if (hr != COM.S_OK || resultPtr == 0) {
+ return COM.S_OK;
+ }
+ String value = null;
+ VARIANT v = new VARIANT();
+ COM.MoveMemory(v, resultPtr, VARIANT.sizeof);
+ if (v.vt == COM.VT_BSTR) value = WebKit.extractBSTR(v.lVal);
+ OS.HeapFree(hHeap, 0, resultPtr);
+ StatusTextListener[] statusTextListeners = browser.webBrowser.statusTextListeners;
+ if (value == null || value.length() == 0) {
+ /* not currently over a link */
+ if (lastHoveredLinkURL == null) return COM.S_OK;
+ lastHoveredLinkURL = null;
+ StatusTextEvent statusText = new StatusTextEvent(browser);
+ statusText.display = browser.getDisplay();
+ statusText.widget = browser;
+ statusText.text = ""; //$NON-NLS-1$
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed(statusText);
+ }
+ return COM.S_OK;
+ }
+ if (value.equals(lastHoveredLinkURL)) return COM.S_OK;
+ lastHoveredLinkURL = value;
+ StatusTextEvent statusText = new StatusTextEvent(browser);
+ statusText.display = browser.getDisplay();
+ statusText.widget = browser;
+ statusText.text = value;
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed(statusText);
+ }
+ return COM.S_OK;
+}
+
+int printFrame (int /*long*/ webView, int /*long*/ frame) {
+ IWebFrame iwebFrame = new IWebFrame(frame);
+ PRINTDLG pd = new PRINTDLG();
+ pd.lStructSize = PRINTDLG.sizeof;
+ pd.Flags = OS.PD_RETURNDC;
+ OS.PrintDlg(pd);
+ int /*long*/ printDC = pd.hDC;
+
+ int /*long*/[] result = new int /*long*/[1];
+ int hr = iwebFrame.QueryInterface(WebKit_win32.IID_IWebFramePrivate, result);
+ if (hr != COM.S_OK || result[0] == 0) {
+ return COM.S_OK;
+ }
+ IWebFramePrivate privateFrame = new IWebFramePrivate(result[0]);
+ privateFrame.setInPrintingMode(true, printDC);
+ int [] count = new int [1];
+ hr = privateFrame.getPrintedPageCount(printDC, count);
+ if (hr != COM.S_OK || count[0] == 0) {
+ privateFrame.Release();
+ return COM.S_OK;
+ }
+ int pageCount = count[0];
+ String jobName = null;
+ result[0] = 0;
+ hr = iwebFrame.dataSource(result);
+ if (hr == COM.S_OK && result[0] != 0) {
+ IWebDataSource dataSource = new IWebDataSource(result[0]);
+ result[0] = 0;
+ hr = dataSource.pageTitle(result);
+ dataSource.Release();
+ if (hr == COM.S_OK && result[0] != 0) {
+ jobName = WebKit.extractBSTR(result[0]);
+ COM.SysFreeString(result[0]);
+ }
+
+ }
+ DOCINFO di = new DOCINFO();
+ di.cbSize = DOCINFO.sizeof;
+ int /*long*/ hHeap = OS.GetProcessHeap();
+ int /*long*/ lpszDocName = 0;
+ if (jobName != null && jobName.length() != 0) {
+ /* Use the character encoding for the default locale */
+ TCHAR buffer = new TCHAR(0, jobName, true);
+ int byteCount = buffer.length() * TCHAR.sizeof;
+ lpszDocName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+ OS.MoveMemory(lpszDocName, buffer, byteCount);
+ di.lpszDocName = lpszDocName;
+ }
+ int rc = OS.StartDoc(printDC, di);
+ if (lpszDocName != 0) OS.HeapFree(hHeap, 0, lpszDocName);
+ if (rc >= 0) {
+ for (int i = 0; i < pageCount; i++) {
+ OS.StartPage(printDC);
+ privateFrame.spoolPages(printDC, i, i, null);
+ OS.EndPage(printDC);
+ }
+ privateFrame.setInPrintingMode(false, printDC);
+ OS.EndDoc(printDC);
+ }
+ privateFrame.Release();
+ return COM.S_OK;
+}
+
+int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG;
+ GUID guid = new GUID ();
+ COM.MoveMemory (guid, riid, GUID.sizeof);
+
+ if (COM.IsEqualGUID (guid, COM.IIDIUnknown)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebUIDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebUIDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID (guid, WebKit_win32.IID_IWebUIDelegate)) {
+ COM.MoveMemory (ppvObject, new int /*long*/[] {iWebUIDelegate.getAddress ()}, OS.PTR_SIZEOF);
+ new IUnknown (iWebUIDelegate.getAddress ()).AddRef ();
+ return COM.S_OK;
+ }
+
+ COM.MoveMemory (ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ return COM.E_NOINTERFACE;
+}
+
+int Release () {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces ();
+ }
+ return refCount;
+}
+
+int runBeforeUnloadConfirmPanelWithMessage (int /*long*/ sender, int /*long*/ message, int /*long*/ initiatedByFrame, int /*long*/ result) {
+ if (!prompt) return COM.S_OK;
+
+ Shell parent = browser.getShell();
+ String string = WebKit.extractBSTR (message);
+ StringBuffer text = new StringBuffer(Compatibility.getMessage("SWT_OnBeforeUnload_Message1")); //$NON-NLS-1$
+ text.append("\n\n"); //$NON-NLS-1$
+ text.append(string);
+ text.append("\n\n"); //$NON-NLS-1$
+ text.append(Compatibility.getMessage("SWT_OnBeforeUnload_Message2")); //$NON-NLS-1$
+ MessageBox box = new MessageBox(parent, SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION);
+ box.setMessage (text.toString());
+ int [] response = new int[1];
+ response[0] = box.open () == SWT.OK ? 1 : 0;
+ OS.MoveMemory(result, response, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+
+int runJavaScriptAlertPanelWithMessage (int /*long*/ sender, int /*long*/ message) {
+ Shell parent = browser.getShell();
+ String string = WebKit.extractBSTR (message);
+ MessageBox box = new MessageBox(parent, SWT.OK | SWT.ICON_WARNING);
+ box.setText("Javascript"); //$NON-NLS-1$
+ box.setMessage (string);
+ box.open ();
+ return COM.S_OK;
+}
+
+int runJavaScriptConfirmPanelWithMessage (int /*long*/ sender, int /*long*/ message, int /*long*/ result) {
+ Shell parent = browser.getShell();
+ String string = WebKit.extractBSTR (message);
+ MessageBox box = new MessageBox(parent, SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION);
+ box.setText("Javascript"); //$NON-NLS-1$
+ box.setMessage (string);
+ int [] response = new int[1];
+ response[0] = box.open () == SWT.OK ? 1 : 0;
+ OS.MoveMemory(result, response, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+
+int runJavaScriptTextInputPanelWithPrompt(int /*long*/ sender, int /*long*/ message, int /*long*/ defaultText, int /*long*/ result) {
+ Shell parent = browser.getShell();
+ String string = WebKit.extractBSTR (message);
+ TextPrompter prompt = new TextPrompter(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
+ prompt.setText("Javascript"); //$NON-NLS-1$
+ prompt.setMessage (string);
+ string = WebKit.extractBSTR (defaultText);
+ prompt.setDefaultText(string);
+ string = prompt.open ();
+ int /*long*/ [] response = new int /*long*/ [1];
+ if (string != null) {
+ response[0] = WebKit.createBSTR(string);
+ }
+ OS.MoveMemory(result, response, C.PTR_SIZEOF);
+ return COM.S_OK;
+}
+
+int runOpenPanelForFileButtonWithResultListener (int /*long*/ sender, int /*long*/ resultListener) {
+ Shell parent = browser.getShell();
+ FileDialog dialog = new FileDialog(parent, SWT.NONE);
+ String result = dialog.open();
+ IWebOpenPanelResultListener listener = new IWebOpenPanelResultListener(resultListener);
+ if (result == null) {
+ listener.cancel();
+ } else {
+ listener.chooseFilename(WebKit.createBSTR(result));
+ }
+ return COM.S_OK;
+}
+
+void setBrowser(Browser browser) {
+ this.browser = browser;
+}
+
+int setFrame(int /*long*/ sender, int /*long*/ frame) {
+ RECT rect = new RECT();
+ COM.MoveMemory(rect, frame, RECT.sizeof);
+ /* convert to SWT system coordinates */
+ location = browser.getDisplay().map(browser, null, (int)rect.left, (int)rect.top);
+ int x = (int)(rect.right - rect.left);
+ int y = (int)(rect.bottom - rect.top);
+ if (y < 0 || x < 0 || (x == 0 && y == 0)) return COM.S_OK;
+ size = new Point(x, y);
+ return COM.S_OK;
+}
+
+int setMenuBarVisible(int /*long*/ sender, int /*long*/ visible) {
+ /* Note. Webkit only emits the notification when the status bar should be hidden. */
+ menuBar = visible == 1;
+ return COM.S_OK;
+}
+
+int setStatusBarVisible(int /*long*/ sender, int /*long*/ visible) {
+ /* Note. Webkit only emits the notification when the status bar should be hidden. */
+ statusBar = visible == 1;
+ return COM.S_OK;
+}
+
+int setStatusText(int /*long*/ sender, int /*long*/ text) {
+ String statusText = WebKit.extractBSTR(text);
+ if (statusText.length() == 0) return COM.S_OK;
+ StatusTextEvent statusTextEvent = new StatusTextEvent(browser);
+ statusTextEvent.display = browser.getDisplay();
+ statusTextEvent.widget = browser;
+ statusTextEvent.text = statusText;
+ StatusTextListener[] statusTextListeners = browser.webBrowser.statusTextListeners;
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed(statusTextEvent);
+ }
+ return COM.S_OK;
+}
+
+int setToolbarsVisible(int /*long*/ sender, int /*long*/ visible) {
+ /* Note. Webkit only emits the notification when the status bar should be hidden. */
+ toolBar = visible == 1;
+ return COM.S_OK;
+}
+
+int takeFocus(int /*long*/ sender, int /*long*/ forward) {
+ int traveralCode = forward == 0 ? SWT.TRAVERSE_TAB_PREVIOUS : SWT.TRAVERSE_TAB_NEXT;
+ ((WebKit)browser.webBrowser).traverseOut = true;
+ browser.traverse(traveralCode);
+ return COM.S_OK;
+}
+
+int webViewClose(int /*long*/ sender) {
+ WindowEvent newEvent = new WindowEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ CloseWindowListener[] closeWindowListeners = browser.webBrowser.closeWindowListeners;
+ for (int i = 0; i < closeWindowListeners.length; i++) {
+ closeWindowListeners[i].close(newEvent);
+ }
+ browser.dispose();
+ return COM.S_OK;
+}
+
+int webViewFrame(int /*long*/ sender, int /*long*/ frame) {
+ RECT rect = new RECT();
+ OS.MoveMemory(frame, rect, RECT.sizeof);
+ return COM.S_OK;
+}
+
+int webViewShow(int /*long*/ sender) {
+ Shell parent = browser.getShell();
+ Point pt = parent.getSize();
+ parent.setSize(pt.x+1, pt.y);
+ parent.setSize(pt.x, pt.y);
+ WindowEvent newEvent = new WindowEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ if (location != null) newEvent.location = location;
+ if (size != null) newEvent.size = size;
+ /*
+ * Feature in WebKit. WebKit's tool bar contains
+ * the address bar. The address bar is displayed
+ * if the tool bar is displayed. There is no separate
+ * notification for the address bar.
+ */
+ newEvent.addressBar = toolBar;
+ newEvent.menuBar = menuBar;
+ newEvent.statusBar = statusBar;
+ newEvent.toolBar = toolBar;
+ VisibilityWindowListener[] visibilityWindowListeners = browser.webBrowser.visibilityWindowListeners;
+ for (int i = 0; i < visibilityWindowListeners.length; i++) {
+ visibilityWindowListeners[i].show(newEvent);
+ }
+ location = null;
+ size = null;
+ return COM.S_OK;
+}
+
+class TextPrompter extends Dialog {
+ String message = "";
+ String result = null;
+ String text;
+ public TextPrompter (Shell parent) {
+ this (parent, SWT.APPLICATION_MODAL);
+ }
+ public TextPrompter (Shell parent, int style) {
+ super (parent, style);
+ }
+ public String getMessage () {
+ return message;
+ }
+ public String open () {
+ final Shell dialog = new Shell(getParent(), getStyle());
+ dialog.setText(getText());
+ dialog.setLayout(new GridLayout());
+ Label label = new Label(dialog, SWT.NONE);
+ label.setText(message);
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ final Text textBox = new Text(dialog, SWT.SINGLE | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 300;
+ textBox.setLayoutData(data);
+ textBox.setText(text);
+ Composite buttons = new Composite(dialog, SWT.NONE);
+ GridLayout grid = new GridLayout();
+ grid.numColumns = 2;
+ buttons.setLayout(grid);
+ buttons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+ Button ok = new Button(buttons, SWT.PUSH);
+ ok.setText(SWT.getMessage("SWT_OK"));
+ data = new GridData();
+ data.widthHint = 75;
+ ok.setLayoutData(data);
+ ok.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ result = textBox.getText();
+ dialog.dispose();
+ }
+ });
+ Button cancel = new Button(buttons, SWT.PUSH);
+ cancel.setText(SWT.getMessage("SWT_Cancel"));
+ data = new GridData();
+ data.widthHint = 75;
+ cancel.setLayoutData(data);
+ cancel.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ dialog.dispose();
+ }
+ });
+ dialog.setDefaultButton(ok);
+ dialog.pack();
+ dialog.open();
+ Display display = getParent().getDisplay();
+ while (!dialog.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ return result;
+ }
+ public void setDefaultText(String text) {
+ this.text = text;
+ }
+ public void setMessage (String string) {
+ message = string;
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMDocument.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMDocument.java
new file mode 100644
index 0000000000..7442cd293d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMDocument.java
@@ -0,0 +1,15 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IDOMDocument extends IUnknown {
+
+public IDOMDocument(int /*long*/ address) {
+ super(address);
+}
+
+public int addEventListener (int /*long*/ type, int /*long*/ listener, boolean useCapture) {
+ return COM.VtblCall (40, getAddress (), type, listener, useCapture);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMEventListener.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMEventListener.java
new file mode 100644
index 0000000000..4a04944779
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IDOMEventListener.java
@@ -0,0 +1,10 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IDOMEventListener extends IUnknown {
+
+ public IDOMEventListener(int address) {
+ super(address);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebCookieManager.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebCookieManager.java
new file mode 100644
index 0000000000..4489d63bd3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebCookieManager.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebCookieManager extends IUnknown {
+
+public IWebCookieManager(int /*long*/ address) {
+ super(address);
+}
+
+public int cookieStorage (int /*long*/[] storage) {
+ return COM.VtblCall (3, getAddress (), storage);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDataSource.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDataSource.java
new file mode 100644
index 0000000000..6fc3984643
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDataSource.java
@@ -0,0 +1,27 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebDataSource extends IUnknown {
+
+public IWebDataSource (int /*long*/ address) {
+ super(address);
+}
+
+public int pageTitle (int /*long*/[] title) {
+ return COM.VtblCall (12, getAddress (), title);
+}
+
+public int representation (int /*long*/[] rep) {
+ return COM.VtblCall (5, getAddress (), rep);
+}
+
+public int request (int /*long*/[] request) {
+ return COM.VtblCall (8, getAddress (), request);
+}
+
+public int webFrame (int /*long*/[] frame) {
+ return COM.VtblCall (6, getAddress (), frame);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDocumentRepresentation.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDocumentRepresentation.java
new file mode 100644
index 0000000000..8d5609d937
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDocumentRepresentation.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebDocumentRepresentation extends IUnknown {
+
+public IWebDocumentRepresentation(int /*long*/ address) {
+ super(address);
+}
+
+public int documentSource (int /*long*/[] source) {
+ return COM.VtblCall (8, getAddress (), source);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDownload.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDownload.java
new file mode 100644
index 0000000000..cd869fc82d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebDownload.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebDownload extends IUnknown {
+
+ public IWebDownload(int /*long*/ address) {
+ super(address);
+ }
+
+ public int cancel () {
+ return COM.VtblCall(4, getAddress());
+ }
+
+ public int cancelForResume () {
+ return COM.VtblCall(5, getAddress());
+ }
+
+ public int setDeletesFileUponFailure (boolean deletesFileUponFailure) {
+ return COM.VtblCall(12, getAddress(), deletesFileUponFailure);
+ }
+
+ public int setDestination (int /*long*/ path, boolean allowOverwrite) {
+ return COM.VtblCall(13, getAddress(), path, allowOverwrite);
+ }
+
+ public int start () {
+ return COM.VtblCall(6, getAddress());
+ }
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebError.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebError.java
new file mode 100644
index 0000000000..bcfa5bcb58
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebError.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.*;
+
+public class IWebError extends IUnknown {
+
+public IWebError (int /*long*/ address) {
+ super (address);
+}
+
+public int code (int[] result) {
+ return COM.VtblCall (4, getAddress (), result);
+}
+
+public int domain (int[] result) {
+ return COM.VtblCall (5, getAddress (), result);
+}
+
+public int failingURL (int /*long*/[] result) {
+ return COM.VtblCall (12, getAddress (), result);
+}
+
+public int localizedDescription (int /*long*/[] result) {
+ return COM.VtblCall (6, getAddress (), result);
+}
+
+public int localizedFailureReason (int /*long*/[] result) {
+ return COM.VtblCall (7, getAddress (), result);
+}
+
+public int sslPeerCertificate (int /*long*/[] result) {
+ return COM.VtblCall (12, getAddress (), result);
+}
+
+public int userInfo (int /*long*/[] result) {
+ return COM.VtblCall (11, getAddress (), result);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFrame.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFrame.java
new file mode 100644
index 0000000000..9d669c9900
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFrame.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.*;
+
+public class IWebFrame extends IUnknown {
+
+public IWebFrame (int /*long*/ address) {
+ super (address);
+}
+
+public int dataSource (int /*long*/[] source) {
+ return COM.VtblCall (13, getAddress (), source);
+}
+
+public int DOMDocument (int /*long*/[] document) {
+ return COM.VtblCall (6, getAddress (), document);
+}
+
+public int /*long*/ globalContext () {
+ return COM.VtblCall (23, getAddress ());
+}
+
+public int loadHTMLString (int /*long*/ string, int /*long*/ baseURL) {
+ return COM.VtblCall (10, getAddress (), string, baseURL);
+}
+
+public int loadRequest (int /*long*/ request) {
+ return COM.VtblCall (8, getAddress (), request);
+}
+
+public int name (int /*long*/[] frameName) {
+ return COM.VtblCall (3, getAddress (), frameName);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFramePrivate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFramePrivate.java
new file mode 100644
index 0000000000..eefbb278b7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebFramePrivate.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebFramePrivate extends IUnknown {
+
+public IWebFramePrivate(int /*long*/ address) {
+ super(address);
+}
+
+public int frameBounds (int /*long*/[] result) {
+ return COM.VtblCall (16, getAddress (), result);
+}
+
+public int getPrintedPageCount (int /*long*/ printDC, int [] pageCount) {
+ return COM.VtblCall (9, getAddress (), printDC, pageCount);
+}
+
+public int setInPrintingMode (boolean value, int /*long*/ printDC) {
+ return COM.VtblCall (8, getAddress (), value, printDC);
+}
+
+public int spoolPages (int /*long*/ printDC, int startPage, int endPage, int [] ctx) {
+ return COM.VtblCall (10, getAddress (), printDC, startPage, endPage, ctx);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebIBActions.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebIBActions.java
new file mode 100644
index 0000000000..27b3269093
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebIBActions.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebIBActions extends IUnknown {
+
+public IWebIBActions (int /*long*/ address) {
+ super (address);
+}
+
+public int canGoBack (int /*long*/ sender, int /*long*/[] result) {
+ return COM.VtblCall (6, getAddress (), sender, result);
+}
+
+public int canGoForward (int /*long*/ sender, int /*long*/[] result) {
+ return COM.VtblCall (8, getAddress (), sender, result);
+}
+
+public int reload (int /*long*/ sender) {
+ return COM.VtblCall (5, getAddress (), sender);
+}
+
+public int stopLoading (int /*long*/ sender) {
+ return COM.VtblCall (4, getAddress (), sender);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequest.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequest.java
new file mode 100644
index 0000000000..4ca8257869
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequest.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.COM;
+
+public class IWebMutableURLRequest extends IWebURLRequest {
+
+public IWebMutableURLRequest (int /*long*/ address) {
+ super (address);
+}
+
+public int setAllowsAnyHTTPSCertificate () {
+ return COM.VtblCall (29, getAddress ());
+}
+
+public int setHTTPBody (int /*long*/ data) {
+ return COM.VtblCall (21, getAddress (), data);
+}
+
+public int setHTTPBodyStream (int /*long*/ data) {
+ return COM.VtblCall (22, getAddress (), data);
+}
+
+public int setHTTPMethod (int post) {
+ return COM.VtblCall (23, getAddress (), post);
+}
+
+public int setURL (int /*long*/ theUrl) {
+ return COM.VtblCall (27, getAddress (), theUrl);
+}
+
+public int setValue (int /*long*/ value, int /*long*/ field) {
+ return COM.VtblCall (28, getAddress (), value, field);
+}
+
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequestPrivate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequestPrivate.java
new file mode 100644
index 0000000000..4cf7757ef7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebMutableURLRequestPrivate.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebMutableURLRequestPrivate extends IUnknown {
+
+ public IWebMutableURLRequestPrivate(int /*long*/ address) {
+ super(address);
+ }
+
+ public int cfRequest () {
+ return COM.VtblCall (4, getAddress ());
+ }
+
+ public int setClientCertificate (int /*long*/ cert) {
+ return COM.VtblCall (3, getAddress (), cert);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebOpenPanelResultListener.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebOpenPanelResultListener.java
new file mode 100644
index 0000000000..3838bf326f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebOpenPanelResultListener.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebOpenPanelResultListener extends IUnknown {
+
+ public IWebOpenPanelResultListener(int /*long*/ address) {
+ super(address);
+ }
+
+ public int cancel () {
+ return COM.VtblCall (4, getAddress ());
+ }
+
+ public int chooseFilename (int /*long*/ fileName) {
+ return COM.VtblCall (3, getAddress (), fileName);
+ }
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPolicyDecisionListener.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPolicyDecisionListener.java
new file mode 100644
index 0000000000..627e213ce9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPolicyDecisionListener.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebPolicyDecisionListener extends IUnknown{
+
+public IWebPolicyDecisionListener(int /*long*/ address) {
+ super(address);
+}
+
+public int download () {
+ return COM.VtblCall (4, getAddress ());
+}
+
+public int ignore () {
+ return COM.VtblCall (5, getAddress ());
+}
+
+public int use () {
+ return COM.VtblCall (3, getAddress ());
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPreferences.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPreferences.java
new file mode 100644
index 0000000000..f61c7c3ab1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebPreferences.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.*;
+
+public class IWebPreferences extends IUnknown {
+
+public IWebPreferences (int /*long*/ address) {
+ super (address);
+}
+
+public int isJavaEnabled (int [] enabled) {
+ return COM.VtblCall (32, getAddress (), enabled);
+}
+
+public int isJavaScriptEnabled (int [] enabled) {
+ return COM.VtblCall (34, getAddress (), enabled);
+}
+
+public int javaScriptCanOpenWindowsAutomatically (int [] enabled) {
+ return COM.VtblCall (36, getAddress (), enabled);
+}
+
+public int setCookieStorageAcceptPolicy (int acceptPolicy) {
+ return COM.VtblCall (67, getAddress (), acceptPolicy);
+}
+
+public int setJavaScriptCanOpenWindowsAutomatically (boolean enabled) {
+ return COM.VtblCall (37, getAddress (), enabled);
+}
+
+public int setJavaEnabled (boolean enabled) {
+ return COM.VtblCall (33, getAddress (), enabled);
+}
+
+public int setJavaScriptEnabled (boolean enabled) {
+ return COM.VtblCall (35, getAddress (), enabled);
+}
+
+public int standardPreferences (int /*long*/[] preferences) {
+ return COM.VtblCall (3, getAddress (), preferences);
+}
+
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallenge.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallenge.java
new file mode 100644
index 0000000000..0736d6072a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallenge.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebURLAuthenticationChallenge extends IUnknown {
+
+public IWebURLAuthenticationChallenge(int /*long*/ address) {
+ super(address);
+}
+
+public int previousFailureCount (int /*long*/[] result) {
+ return COM.VtblCall (7, getAddress (), result);
+}
+
+public int proposedCredential (int /*long*/[] result) {
+ return COM.VtblCall (8, getAddress (), result);
+}
+
+public int protectionSpace (int /*long*/[] result) {
+ return COM.VtblCall (9, getAddress (), result);
+}
+
+public int sender (int /*long*/[] sender) {
+ return COM.VtblCall (10, getAddress (), sender);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallengeSender.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallengeSender.java
new file mode 100644
index 0000000000..1c9718c2a8
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLAuthenticationChallengeSender.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebURLAuthenticationChallengeSender extends IUnknown {
+
+public IWebURLAuthenticationChallengeSender(int /*long*/ address) {
+ super(address);
+}
+
+public int cancelAuthenticationChallenge (int /*long*/ challenge) {
+ return COM.VtblCall (3, getAddress (), challenge);
+}
+
+public int useCredential (int /*long*/ credential, int /*long*/ challenge) {
+ return COM.VtblCall (5, getAddress (), credential, challenge);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLCredential.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLCredential.java
new file mode 100644
index 0000000000..34b4d84827
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLCredential.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebURLCredential extends IUnknown {
+
+public IWebURLCredential(int /*long*/ address) {
+ super(address);
+}
+
+public int hasPassword (int /*long*/[] result) {
+ return COM.VtblCall (3, getAddress (), result);
+}
+
+public int initWithUser (int /*long*/ user, int /*long*/ password, int /*long*/ persistence) {
+ return COM.VtblCall (4, getAddress (), user, password, persistence);
+}
+
+public int password (int /*long*/[] password) {
+ return COM.VtblCall (5, getAddress (), password);
+}
+
+public int user (int /*long*/[] result) {
+ return COM.VtblCall (7, getAddress (), result);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLProtectionSpace.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLProtectionSpace.java
new file mode 100644
index 0000000000..cd9e2a1291
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLProtectionSpace.java
@@ -0,0 +1,29 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebURLProtectionSpace extends IUnknown {
+
+ public IWebURLProtectionSpace(int /*long*/ address) {
+ super(address);
+ }
+
+ public int host (int /*long*/[] result) {
+ return COM.VtblCall (4, getAddress (), result);
+ }
+
+ public int port (int /*long*/[] result) {
+ return COM.VtblCall (8, getAddress (), result);
+ }
+
+ public int realm (int /*long*/[] result) {
+ return COM.VtblCall (11, getAddress (), result);
+ }
+
+ public int isProxy (int /*long*/[] result) {
+ return COM.VtblCall (7, getAddress (), result);
+ }
+
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLRequest.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLRequest.java
new file mode 100644
index 0000000000..074762594c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLRequest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.*;
+
+public class IWebURLRequest extends IUnknown {
+
+public IWebURLRequest (int /*long*/ address) {
+ super (address);
+}
+
+public int HTTPBody (int /*long*/ []result) {
+ return COM.VtblCall (6, getAddress (), result);
+}
+
+public int HTTPMethod (int /*long*/ []result) {
+ return COM.VtblCall (8, getAddress (), result);
+}
+
+public int mutableCopy (int /*long*/ []result) {
+ return COM.VtblCall (16, getAddress (), result);
+}
+
+public int URL (int /*long*/ []result) {
+ return COM.VtblCall (13, getAddress (), result);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLResponse.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLResponse.java
new file mode 100644
index 0000000000..89feff9ba3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebURLResponse.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.IUnknown;
+
+public class IWebURLResponse extends IUnknown {
+
+ public IWebURLResponse (int /*long*/ address) {
+ super(address);
+ }
+
+ public int expectedContentLength (long [] result) {
+ return COM.VtblCall (3, getAddress (), result);
+ }
+
+ public int suggestedFilename (int /*long*/ []result) {
+ return COM.VtblCall (8, getAddress (), result);
+ }
+
+ public int URL (int /*long*/ []result) {
+ return COM.VtblCall (8, getAddress (), result);
+ }
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebView.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebView.java
new file mode 100644
index 0000000000..cc378aa881
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebView.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.internal.win32.RECT;
+
+public class IWebView extends IUnknown {
+
+public IWebView (int /*long*/ address) {
+ super (address);
+}
+
+public int canShowMIMEType (int /*long*/mimeType, int /*long*/ [] canShow) {
+ return COM.VtblCall(3, getAddress(), mimeType, canShow);
+}
+
+public int close () {
+ return COM.VtblCall(70, getAddress());
+}
+
+public int estimatedProgress (int /*long*/ estimatedProgress) {
+ return COM.VtblCall (51, getAddress (), estimatedProgress);
+}
+
+public int goBack (int /*long*/[] succeeded) {
+ return COM.VtblCall(24, getAddress(), succeeded);
+}
+
+public int goForward (int /*long*/[] succeeded) {
+ return COM.VtblCall(25, getAddress(), succeeded);
+}
+
+public int hostWindow (int /*long*/[] window) {
+ return COM.VtblCall (46, getAddress (), window);
+}
+
+public int initWithFrame (RECT frame, int /*long*/ frameName, int /*long*/ groupName) {
+ return COM.VtblCall (9, getAddress(), frame, frameName, groupName);
+}
+
+public int isLoading (int /*long*/[] isLoading) {
+ return COM.VtblCall (52, getAddress (), isLoading);
+}
+
+public int mainFrame (int /*long*/[] frame) {
+ return COM.VtblCall (20, getAddress (), frame);
+}
+
+public int preferences (int /*long*/[] prefs) {
+ return COM.VtblCall (42, getAddress (), prefs);
+}
+
+public int setCustomUserAgent(int /*long*/ valueString) {
+ return COM.VtblCall (31, getAddress (), valueString);
+}
+
+public int setDownloadDelegate (int /*long*/ delegate) {
+ return COM.VtblCall (14, getAddress (), delegate);
+}
+
+public int setFrameLoadDelegate (int /*long*/ delegate) {
+ return COM.VtblCall (16, getAddress (), delegate);
+}
+
+public int setHostWindow (int /*long*/ window) {
+ return COM.VtblCall (45, getAddress (), window);
+}
+
+public int setPolicyDelegate (int /*long*/ delegate) {
+ return COM.VtblCall (18, getAddress (), delegate);
+}
+
+public int setPreferences (int /*long*/ prefs) {
+ return COM.VtblCall (41, getAddress (), prefs);
+}
+
+public int setResourceLoadDelegate (int /*long*/ delegate) {
+ return COM.VtblCall (12, getAddress (), delegate);
+}
+
+public int setUIDelegate (int /*long*/ delegate) {
+ return COM.VtblCall (10, getAddress (), delegate);
+}
+
+public int stringByEvaluatingJavaScriptFromString(int /*long*/ script, int /*long*/ [] result) {
+ return COM.VtblCall(39, getAddress (), script, result);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebViewPrivate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebViewPrivate.java
new file mode 100644
index 0000000000..b7aba816d1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/IWebViewPrivate.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+
+import org.eclipse.swt.internal.ole.win32.*;
+
+public class IWebViewPrivate extends IUnknown {
+
+public IWebViewPrivate (int /*long*/ address) {
+ super (address);
+}
+
+public int clearFocusNode () {
+ return COM.VtblCall (27, getAddress ());
+}
+
+public int setInitialFocus(boolean forwardEnabled) {
+ return COM.VtblCall (28, getAddress (), forwardEnabled);
+}
+
+public int setTabKeyCyclesThroughElements(boolean cycles) {
+ return COM.VtblCall (21, getAddress (), cycles);
+}
+
+public int shouldClose (int /*long*/[] result) {
+ return COM.VtblCall (33, getAddress (), result);
+}
+
+public int tabKeyCyclesThroughElements (int /*long*/[] result) {
+ return COM.VtblCall (22, getAddress (), result);
+}
+
+public int viewWindow (int /*long*/[] window) {
+ return COM.VtblCall (5, getAddress (), window);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/JSClassDefinition.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/JSClassDefinition.java
new file mode 100644
index 0000000000..3a22a89228
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/JSClassDefinition.java
@@ -0,0 +1,40 @@
+package org.eclipse.swt.internal.webkit;
+
+/** @jniclass flags=cpp */
+public class JSClassDefinition {
+ public int version;
+ /** @field cast=(JSClassAttributes) */
+ public int attributes;
+ /** @field cast=(const char*) */
+ public int /*long*/ className;
+ /** @field cast=(JSClassRef) */
+ public int /*long*/ parentClass;
+ /** @field cast=(const JSStaticValue*) */
+ public int /*long*/ staticValues;
+ /** @field cast=(const JSStaticFunction*) */
+ public int /*long*/ staticFunctions;
+ /** @field cast=(JSObjectInitializeCallback) */
+ public int /*long*/ initialize;
+ /** @field cast=(JSObjectFinalizeCallback) */
+ public int /*long*/ finalize;
+ /** @field cast=(JSObjectHasPropertyCallback) */
+ public int /*long*/ hasProperty;
+ /** @field cast=(JSObjectGetPropertyCallback) */
+ public int /*long*/ getProperty;
+ /** @field cast=(JSObjectSetPropertyCallback) */
+ public int /*long*/ setProperty;
+ /** @field cast=(JSObjectDeletePropertyCallback) */
+ public int /*long*/ deleteProperty;
+ /** @field cast=(JSObjectGetPropertyNamesCallback) */
+ public int /*long*/ getPropertyNames;
+ /** @field cast=(JSObjectCallAsFunctionCallback) */
+ public int /*long*/ callAsFunction;
+ /** @field cast=(JSObjectCallAsConstructorCallback) */
+ public int /*long*/ callAsConstructor;
+ /** @field cast=(JSObjectHasInstanceCallback) */
+ public int /*long*/ hasInstance;
+ /** @field cast=(JSObjectConvertToTypeCallback) */
+ public int /*long*/ convertToType;
+
+ public static final int sizeof = WebKit_win32.JSClassDefinition_sizeof();
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/WebKit_win32.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/WebKit_win32.java
new file mode 100644
index 0000000000..a143b223be
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/internal/webkit/WebKit_win32.java
@@ -0,0 +1,374 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.webkit;
+
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.ole.win32.GUID;
+import org.eclipse.swt.internal.win32.OS;
+
+/** @jniclass flags=cpp */
+public class WebKit_win32 extends C {
+ public static final GUID CLSID_DOMEventListener = IIDFromString("{AC3D1BC3-4976-4431-8A19-4812C5EFE39C}"); //$NON-NLS-1$
+ public static final GUID CLSID_WebCookieManager = IIDFromString("{3F35F332-BB2B-49b3-AEDD-27B317687E07}"); //$NON-NLS-1$
+ public static final GUID CLSID_WebMutableURLRequest = IIDFromString("{a062ecc3-bb1b-4694-a569-f59e0ad6be0c}"); //$NON-NLS-1$
+ public static final GUID CLSID_WebPreferences = IIDFromString("{67B89F90-F778-438B-ABBF-34D1ACBF8651}"); //$NON-NLS-1$
+ public static final GUID CLSID_WebScrollBar = IIDFromString("{24A53AD5-AA9F-44e6-AA22-2C7C250B661A}"); //$NON-NLS-1$
+ public static final GUID CLSID_IWebURLCredential = IIDFromString("{7433F53B-7FE9-484a-9432-72909457A646}"); //$NON-NLS-1$
+ public static final GUID CLSID_WebView = IIDFromString("{d6bca079-f61c-4e1e-b453-32a0477d02e3}"); //$NON-NLS-1$
+ public static final GUID IID_IDOMEventListener = IIDFromString("{7f8a0a96-f864-44fb-87fb-c5f03666e8e6}"); //$NON-NLS-1$
+ public static final GUID IID_IWebDownloadDelegate = IIDFromString("{16A32AE6-C862-40cd-9225-2CAF823F40F9}"); //$NON-NLS-1$
+ public static final GUID IID_IWebCookieManager = IIDFromString("{7053FE94-3623-444f-A298-209A90879A8C}"); //$NON-NLS-1$
+ public static final GUID IID_IWebFrameLoadDelegate = IIDFromString("{3354665B-84BA-4fdf-B35E-BF5CF9D96026}"); //$NON-NLS-1$
+ public static final GUID IID_IWebFramePrivate = IIDFromString("{A1657D07-4881-4475-9D10-76548731D448}"); //$NON-NLS-1$
+ public static final GUID IID_IWebIBActions = IIDFromString("{8F0E3A30-B924-44f8-990A-1AE61ED6C632}"); //$NON-NLS-1$
+ public static final GUID IID_IWebMutableURLRequest = IIDFromString("{C4042773-371F-427e-AFA9-9D4B358A0D93}"); //$NON-NLS-1$
+ public static final GUID IID_IWebMutableURLRequestPrivate = IIDFromString("{AD675B60-2CE9-478c-B2AA-CAD643FF18AC}"); //$NON-NLS-1$;
+ public static final GUID IID_IWebPolicyDelegate = IIDFromString("{9B0BAE6C-A496-4000-9E22-2E89F0747401}"); //$NON-NLS-1$
+ public static final GUID IID_IWebPreferences = IIDFromString("{0930D594-A5A3-46e1-858E-AB17A13CD28E}"); //$NON-NLS-1$
+ public static final GUID IID_IWebResourceLoadDelegate = IIDFromString("{AF3289AA-90DB-4ca4-A112-A1E5F0517953}"); //$NON-NLS-1$
+ public static final GUID IID_IWebScrollBarPrivate = IIDFromString("{6C585B08-2E4F-4594-9B90-0425E3A33FD0}"); //$NON-NLS-1$
+ public static final GUID IID_IWebUIDelegate = IIDFromString("{042B7EE3-A5A4-4a8f-8C33-775CD9E89C7C}"); //$NON-NLS-1$
+ public static final GUID IID_IWebView = IIDFromString("{174BBEFD-058E-49C7-91DF-6F110AA4AC28}"); //$NON-NLS-1$
+ public static final GUID IID_IWebViewPrivate = IIDFromString("{44914369-DEB5-4fcf-A6A3-30C02E73154F}"); //$NON-NLS-1$
+ public static final GUID IID_IWebURLCredential = IIDFromString("{A1E9D765-FACE-4189-BBE3-AED7EBF65EBD}"); //$NON-NLS-1$
+
+ public static final int CFHTTPCookieSessionOnlyFlag = 1 << 1;
+ public static final int kCFStringEncodingUTF8 = 0x08000100;
+
+ public static final int kJSTypeUndefined = 0;
+ public static final int kJSTypeNull = 1;
+ public static final int kJSTypeBoolean = 2;
+ public static final int kJSTypeNumber = 3;
+ public static final int kJSTypeString = 4;
+ public static final int kJSTypeObject = 5;
+
+ public static final int WebURLCredentialPersistenceForSession = 1;
+ public static final int WebURLErrorBadURL = -1000;
+ public static final int WebURLErrorServerCertificateNotYetValid = -1204;
+ public static final int WebURLErrorSecureConnectionFailed = -1200;
+
+/**
+ * @param theArray cast=(CFArrayRef)
+ */
+public static final native int CFArrayGetCount(int /*long*/ theArray);
+/**
+ * @param theArray cast=(CFArrayRef)
+ * @param idx cast=(CFIndex)
+ */
+public static final native int /*long*/ CFArrayGetValueAtIndex(int /*long*/ theArray, int idx);
+/**
+ * @param allocator cast=(CFAllocatorRef)
+ * @param bytes cast=(const UInt8 *)
+ * @param length cast=(CFIndex)
+ */
+public static final native int /*long*/ CFDataCreate(int allocator, byte [] bytes, int length);
+/**
+ * @param theData cast=(CFDataRef)
+ */
+public static final native int /*long*/ CFDataGetBytePtr(int /*long*/ theData);
+/**
+ * @param theData cast=(CFDataRef)
+ */
+public static final native int CFDataGetLength(int /*long*/ theData);
+/**
+ * @param allocator cast=(CFAllocatorRef)
+ * @param keys cast=(const void **)
+ * @param values cast=(const void **)
+ * @param numValues cast=(CFIndex)
+ * @param keyCallBacks cast=(const CFDictionaryKeyCallBacks *)
+ * @param valueCallBacks cast=(const CFDictionaryValueCallBacks *)
+ */
+public static final native int /*long*/ CFDictionaryCreate(int allocator, int /*long*/ [] keys, int /*long*/ [] values, int numValues, int /*long*/ keyCallBacks, int /*long*/ valueCallBacks);
+/**
+ * @param dictionary cast=(CFDictionaryRef)
+ */
+public static final native int CFDictionaryGetCount(int /*long*/ dictionary);
+/**
+ * @param inAllocator cast=(CFAllocatorRef)
+ * @param headerFields cast=(CFDictionaryRef)
+ * @param inURL cast=(CFURLRef)
+ */
+public static final native int /*long*/ CFHTTPCookieCreateWithResponseHeaderFields(int inAllocator, int /*long*/ headerFields, int /*long*/ inURL);
+/**
+ * @param inCookie cast=(CFHTTPCookieRef)
+ */
+public static final native int /*long*/ CFHTTPCookieGetFlags(int /*long*/ inCookie);
+/**
+ * @param inCookie cast=(CFHTTPCookieRef)
+ */
+public static final native int /*long*/ CFHTTPCookieGetName(int /*long*/ inCookie);
+/**
+ * @param inCookie cast=(CFHTTPCookieRef)
+ */
+public static final native int /*long*/ CFHTTPCookieGetValue(int /*long*/ inCookie);
+/**
+ * @param inCookieStorage cast=(CFHTTPCookieStorageRef)
+ */
+public static final native int /*long*/ CFHTTPCookieStorageCopyCookies(int /*long*/ inCookieStorage);
+/**
+ * @param inCookieStorage cast=(CFHTTPCookieStorageRef)
+ * @param inURL cast=(CFURLRef)
+ * @param sendSecureCookies cast=(Boolean)
+ */
+public static final native int /*long*/ CFHTTPCookieStorageCopyCookiesForURL(int /*long*/ inCookieStorage,int /*long*/ inURL, boolean sendSecureCookies);
+/**
+ * @param inCookieStorage cast=(CFHTTPCookieStorageRef)
+ * @param inCookie cast=(CFHTTPCookieRef)
+ */
+public static final native void CFHTTPCookieStorageDeleteCookie(int /*long*/ inCookieStorage, int /*long*/ inCookie);
+/**
+ * @param inCookieStorage cast=(CFHTTPCookieStorageRef)
+ * @param inCookie cast=(CFHTTPCookieRef)
+ */
+public static final native void CFHTTPCookieStorageSetCookie(int /*long*/ inCookieStorage, int /*long*/ inCookie);
+/**
+ * @param cf cast=(CFTypeRef)
+ */
+public static final native void CFRelease(int /*long*/ cf);
+/**
+ * @param cf cast=(CFTypeRef)
+ */
+public static final native int CFRetain(int /*long*/ cf);
+/**
+ * @param alloc cast=(CFAllocatorRef)
+ * @param chars cast=(const UniChar *)
+ * @param numChars cast=(CFIndex)
+ */
+public static final native int CFStringCreateWithCharacters(int /*long*/ alloc, char [] chars, int numChars);
+/**
+ * @param theString cast=(CFStringRef)
+ * @param idx cast=(CFIndex)
+ */
+public static final native char CFStringGetCharacterAtIndex(int /*long*/ theString, int idx);
+/**
+ * @param theString cast=(CFStringRef)
+ */
+public static final native int /*long*/ CFStringGetCharactersPtr(int /*long*/ theString);
+/**
+ * @param theString cast=(CFStringRef)
+ */
+public static final native int CFStringGetLength(int /*long*/ theString);
+/**
+ * @param allocator cast=(CFAllocatorRef)
+ * @param URLString cast=(CFStringRef)
+ * @param baseURL cast=(CFURLRef)
+ */
+public static final native int /*long*/ CFURLCreateWithString(int allocator, int /*long*/ URLString, int /*long*/ baseURL);
+/**
+ * @param request cast=(CFURLRequestRef)
+ */
+public static final native int /*long*/ CFURLRequestCopyHTTPRequestBody(int /*long*/ request);
+/**
+ * @param mutableHTTPRequest cast=(CFMutableURLRequestRef)
+ * @param httpBody cast=(CFDataRef)
+ */
+public static final native void CFURLRequestSetHTTPRequestBody(int /*long*/ mutableHTTPRequest, int /*long*/ httpBody);
+static GUID IIDFromString (String lpsz) {
+ int length = lpsz.length ();
+ char[] buffer = new char[length + 1];
+ lpsz.getChars (0, length, buffer, 0);
+ GUID lpiid = new GUID ();
+ if (COM.IIDFromString (buffer, lpiid) == COM.S_OK) return lpiid;
+ return null;
+}
+/**
+ * @param definition cast=(const JSClassDefinition*)
+ */
+public static final native int /*long*/ JSClassCreate (int /*long*/ definition);
+public static final native int JSClassDefinition_sizeof ();
+/**
+ * @param jsClass cast=(JSClassRef)
+ */
+public static final native int /*long*/ JSClassRetain (int /*long*/ jsClass);
+/**
+ * @param ctx cast=(JSContextRef)
+ */
+public static final native int /*long*/ JSContextGetGlobalObject(int /*long*/ ctx);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param script cast=(JSStringRef)
+ * @param thisObject cast=(JSObjectRef)
+ * @param sourceURL cast=(JSStringRef)
+ * @param exception cast=(JSValueRef *)
+ */
+public static final native int /*long*/ JSEvaluateScript(int /*long*/ ctx, int /*long*/ script, int /*long*/ thisObject, int /*long*/ sourceURL, int startingLineNumber, int /*long*/[] exception);
+/**
+ * @param globalObjectClass cast=(JSClassRef)
+ */
+public static final native int /*long*/ JSGlobalContextCreate(int /*long*/ globalObjectClass);
+/**
+ * @param ctx cast=(JSGlobalContextRef)
+ */
+public static final native int JSGlobalContextRetain(int /*long*/ ctx);
+/** @method flags=no_gen */
+public static final native int /*long*/ JSObjectCallAsFunctionProc_CALLBACK (int /*long*/ func);
+/**
+ * @param object cast=(JSObjectRef)
+ */
+public static final native int /*long*/ JSObjectGetPrivate (int /*long*/ object);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param object cast=(JSObjectRef)
+ * @param propertyName cast=(JSStringRef)
+ * @param exception cast=(JSValueRef*)
+ */
+public static final native int /*long*/ JSObjectGetProperty (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/[] exception);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param object cast=(JSObjectRef)
+ * @param propertyIndex cast=(unsigned)
+ * @param exception cast=(JSValueRef*)
+ */
+public static final native int /*long*/ JSObjectGetPropertyAtIndex (int /*long*/ ctx, int /*long*/ object, int propertyIndex, int /*long*/[] exception);
+/** @method flags=no_gen */
+public static final native int /*long*/ JSObjectGetPropertyProc_CALLBACK (int /*long*/ func);
+/** @method flags=no_gen */
+public static final native int /*long*/ JSObjectHasPropertyProc_CALLBACK (int /*long*/ func);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param object cast=(JSObjectRef)
+ */
+public static final native int JSObjectIsFunction(int /*long*/ ctx, int /*long*/ object);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param jsClass cast=(JSClassRef)
+ * @param data cast=(void *)
+ */
+public static final native int JSObjectMake(int /*long*/ ctx, int /*long*/ jsClass, int /*long*/ data);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param argumentCount cast=(size_t)
+ * @param arguments cast=(const struct OpaqueJSValue * const*)
+ * @param exception cast=(JSValueRef*)
+ */
+public static final native int /*long*/ JSObjectMakeArray (int /*long*/ ctx, int /*long*/ argumentCount, int /*long*/[] arguments, int /*long*/[] exception);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param name cast=(JSStringRef)
+ * @param callAsFunction cast=(JSObjectCallAsFunctionCallback)
+ */
+public static final native int JSObjectMakeFunctionWithCallback(int /*long*/ ctx, int /*long*/ name, int /*long*/ callAsFunction);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param object cast=(JSObjectRef)
+ * @param propertyName cast=(JSStringRef)
+ * @param value cast=(JSValueRef)
+ * @param attributes cast=(JSPropertyAttributes)
+ * @param exception cast=(JSValueRef *)
+ */
+public static final native void JSObjectSetProperty(int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/ value, int /*long*/ attributes, int /*long*/[] exception);
+/**
+ * @param string cast=(const char*)
+ */
+public static final native int /*long*/ JSStringCreateWithUTF8CString(byte[] string);
+/**
+ * @param string cast=(JSStringRef)
+ */
+public static final native int JSStringGetLength(int /*long*/ string);
+/**
+ * @param string cast=(JSStringRef)
+ */
+public static final native int /*long*/ JSStringGetMaximumUTF8CStringSize (int /*long*/ string);
+/**
+ * @param string cast=(JSStringRef)
+ * @param buffer cast=(char *)
+ * @param bufferSize cast=(size_t)
+ * @return
+ */
+public static final native int JSStringGetUTF8CString(int /*long*/ string, byte[] buffer, int /*long*/ bufferSize);
+/**
+ * @param a cast=(JSStringRef)
+ * @param b cast=(const char *)
+ */
+public static final native int JSStringIsEqualToUTF8CString (int /*long*/ a, byte[] b);
+/**
+ * @param string cast=(JSStringRef)
+ */
+public static final native void JSStringRelease(int /*long*/ string);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param value cast=(JSValueRef)
+ */
+public static final native int JSValueGetType(int /*long*/ ctx, int /*long*/ value);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param value cast=(JSValueRef)
+ * @param jsClass cast=(JSClassRef)
+ */
+public static final native int JSValueIsObjectOfClass (int /*long*/ ctx, int /*long*/ value, int /*long*/ jsClass);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param b cast=(bool)
+ */
+public static final native int /*long*/ JSValueMakeBoolean(int /*long*/ ctx, int /*long*/ b);
+/**
+ * @param ctx cast=(JSContextRef)
+ */
+public static final native int /*long*/ JSValueMakeNull(int /*long*/ ctx);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param number cast=(double)
+ */
+public static final native int /*long*/ JSValueMakeNumber(int /*long*/ ctx, double number);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param string cast=(JSStringRef)
+ */
+public static final native int /*long*/ JSValueMakeString(int /*long*/ ctx, int /*long*/ string);
+/**
+ * @param ctx cast=(JSContextRef)
+ */
+public static final native int /*long*/ JSValueMakeUndefined (int /*long*/ ctx);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param value cast=(JSValueRef)
+ */
+public static final native void JSValueProtect(int /*long*/ ctx, int /*long*/ value);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param value cast=(JSValueRef)
+ */
+public static final native int JSValueToBoolean (int /*long*/ ctx, int /*long*/ value);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param value cast=(JSValueRef)
+ * @param exception cast=(JSValueRef*)
+ */
+public static final native double JSValueToNumber (int /*long*/ ctx, int /*long*/ value, int /*long*/[] exception);
+/**
+ * @param ctx cast=(JSContextRef)
+ * @param value cast=(JSValueRef)
+ * @param exception cast=(JSValueRef*)
+ */
+public static final native int /*long*/ JSValueToStringCopy (int /*long*/ ctx, int /*long*/ value, int /*long*/[] exception);
+/** @method flags=const address*/
+public static final native int /*long*/ kCFCopyStringDictionaryKeyCallBacks();
+/** @method flags=const address*/
+public static final native int /*long*/ kCFTypeDictionaryValueCallBacks();
+/**
+ * @param dest cast=(void *)
+ * @param src cast=(const void *),flags=no_out
+ * @param size cast=(size_t)
+ */
+public static final native void memmove (int /*long*/ dest, JSClassDefinition src, int /*long*/ size);
+/** @method flags=dynamic*/
+public static final native int WebKitCreateInstance (byte[] rclsid, int /*long*/ pUnkOuter, byte[] refiid, int /*long*/[] ppvObject);
+public static final int WebKitCreateInstance (GUID clsid, int /*long*/ pUnkOuter, GUID iid, int /*long*/[] ppvObject) {
+ byte[] rclsid = new byte[GUID.sizeof];
+ OS.IIDFromString ((clsid.toString () + '\0').toCharArray (), rclsid);
+ byte[] refiid = new byte[GUID.sizeof];
+ OS.IIDFromString ((iid.toString () + '\0').toCharArray (), refiid);
+ return WebKitCreateInstance (rclsid, pUnkOuter, refiid, ppvObject);
+}
+/** @method flags=no_gen */
+public static final native int /*long*/ willPerformClientRedirectToURL_CALLBACK (int /*long*/ func);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
index 3557c797f5..0cae4f1f52 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
@@ -1947,6 +1947,8 @@ public class SWT {
*/
public static final int MOZILLA = 1 << 15;
+ public static final int WEBKIT = 1 << 16;
+
/**
* Style constant for balloon behavior (value is 1&lt;&lt;12).
* <p><b>Used By:</b><ul>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
index 3a5c957b64..6e91641c1a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
@@ -98,3 +98,4 @@ SWT_Node_Child_Of=node child of
SWT_Parent_Window_Of=parent window of
SWT_Popup_For=popup for
SWT_Subwindow_Of=subwindow of
+SWT_Continue=Continue

Back to the top