summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBenoit Hiller2013-04-15 13:19:46 (EDT)
committer Grant Gayed2013-04-15 13:19:46 (EDT)
commit5a4dfdac8ebe052c3c61b0c3300bb017056fd8d6 (patch)
treebc1b77a25a5de1c13d9b52ad473763aa76a72334
parent98a0c6b4fec34eada8b7825c433d729e7127b1fd (diff)
downloadeclipse.platform.swt-5a4dfdac8ebe052c3c61b0c3300bb017056fd8d6.zip
eclipse.platform.swt-5a4dfdac8ebe052c3c61b0c3300bb017056fd8d6.tar.gz
eclipse.platform.swt-5a4dfdac8ebe052c3c61b0c3300bb017056fd8d6.tar.bz2
Window open/close/show
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3.c37
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.h6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.c79
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.h12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEF.java127
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEFLifeSpanHandler.java39
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/internal/cef3/CEF3.java8
8 files changed, 306 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3.c b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3.c
index 3059ce6..4c90dc8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3.c
@@ -541,6 +541,18 @@ JNIEXPORT jint JNICALL CEF3_NATIVE(cef_1menu_1model_1t_1sizeof)
}
#endif
+#ifndef NO_cef_1popup_1features_1t_1sizeof
+JNIEXPORT jint JNICALL CEF3_NATIVE(cef_1popup_1features_1t_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ CEF3_NATIVE_ENTER(env, that, cef_1popup_1features_1t_1sizeof_FUNC);
+ rc = (jint)cef_popup_features_t_sizeof();
+ CEF3_NATIVE_EXIT(env, that, cef_1popup_1features_1t_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_cef_1process_1message_1create
JNIEXPORT jintLong JNICALL CEF3_NATIVE(cef_1process_1message_1create)
(JNIEnv *env, jclass that, jobject arg0)
@@ -872,6 +884,31 @@ fail:
}
#endif
+#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2JJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL CEF3_NATIVE(memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
+#else
+JNIEXPORT void JNICALL CEF3_NATIVE(memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2JJ)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
+#endif
+{
+ cef_popup_features_t _arg0, *lparg0=NULL;
+#ifndef JNI64
+ CEF3_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2II_FUNC);
+#else
+ CEF3_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2JJ_FUNC);
+#endif
+ if (arg0) if ((lparg0 = &_arg0) == NULL) goto fail;
+ memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
+fail:
+ if (arg0 && lparg0) setcef_popup_features_tFields(env, arg0, lparg0);
+#ifndef JNI64
+ CEF3_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2II_FUNC);
+#else
+ CEF3_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2JJ_FUNC);
+#endif
+}
+#endif
+
#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2JJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL CEF3_NATIVE(memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.c b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.c
index 486d66c..bc29a84 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.c
@@ -96,6 +96,7 @@ char * CEF3_nativeFunctionNames[] = {
"cef_1initialize",
"cef_1list_1value_1t_1sizeof",
"cef_1menu_1model_1t_1sizeof",
+ "cef_1popup_1features_1t_1sizeof",
"cef_1process_1message_1create",
"cef_1process_1message_1t_1sizeof",
"cef_1settings_1t_1sizeof",
@@ -153,6 +154,11 @@ char * CEF3_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_cef3_cef_1menu_1model_1t_2JJ",
#endif
#ifndef JNI64
+ "memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2II",
+#else
+ "memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2JJ",
+#endif
+#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2II",
#else
"memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2JJ",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.h b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.h
index f210085..4b23548 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_stats.h
@@ -106,6 +106,7 @@ typedef enum {
cef_1initialize_FUNC,
cef_1list_1value_1t_1sizeof_FUNC,
cef_1menu_1model_1t_1sizeof_FUNC,
+ cef_1popup_1features_1t_1sizeof_FUNC,
cef_1process_1message_1create_FUNC,
cef_1process_1message_1t_1sizeof_FUNC,
cef_1settings_1t_1sizeof_FUNC,
@@ -163,6 +164,11 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_cef3_cef_1menu_1model_1t_2JJ_FUNC,
#endif
#ifndef JNI64
+ memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2II_FUNC,
+#else
+ memmove__Lorg_eclipse_swt_internal_cef3_cef_1popup_1features_1t_2JJ_FUNC,
+#endif
+#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2II_FUNC,
#else
memmove__Lorg_eclipse_swt_internal_cef3_cef_1process_1message_1t_2JJ_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.c b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.c
index 07da12c..df64001 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.c
@@ -1038,6 +1038,85 @@ void setcef_menu_model_tFields(JNIEnv *env, jobject lpObject, cef_menu_model_t *
}
#endif
+#ifndef NO_cef_popup_features_t
+typedef struct cef_popup_features_t_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID x, xSet, y, ySet, width, widthSet, height, heightSet, menuBarVisible, statusBarVisible, toolBarVisible, locationBarVisible, scrollbarsVisible, resizable, fullscreen, dialog, additionalFeatures;
+} cef_popup_features_t_FID_CACHE;
+
+cef_popup_features_t_FID_CACHE cef_popup_features_tFc;
+
+void cachecef_popup_features_tFields(JNIEnv *env, jobject lpObject)
+{
+ if (cef_popup_features_tFc.cached) return;
+ cef_popup_features_tFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ cef_popup_features_tFc.x = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "x", "I");
+ cef_popup_features_tFc.xSet = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "xSet", "I");
+ cef_popup_features_tFc.y = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "y", "I");
+ cef_popup_features_tFc.ySet = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "ySet", "I");
+ cef_popup_features_tFc.width = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "width", "I");
+ cef_popup_features_tFc.widthSet = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "widthSet", "I");
+ cef_popup_features_tFc.height = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "height", "I");
+ cef_popup_features_tFc.heightSet = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "heightSet", "I");
+ cef_popup_features_tFc.menuBarVisible = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "menuBarVisible", "I");
+ cef_popup_features_tFc.statusBarVisible = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "statusBarVisible", "I");
+ cef_popup_features_tFc.toolBarVisible = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "toolBarVisible", "I");
+ cef_popup_features_tFc.locationBarVisible = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "locationBarVisible", "I");
+ cef_popup_features_tFc.scrollbarsVisible = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "scrollbarsVisible", "I");
+ cef_popup_features_tFc.resizable = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "resizable", "I");
+ cef_popup_features_tFc.fullscreen = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "fullscreen", "I");
+ cef_popup_features_tFc.dialog = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "dialog", "I");
+ cef_popup_features_tFc.additionalFeatures = (*env)->GetFieldID(env, cef_popup_features_tFc.clazz, "additionalFeatures", I_J);
+ cef_popup_features_tFc.cached = 1;
+}
+
+cef_popup_features_t *getcef_popup_features_tFields(JNIEnv *env, jobject lpObject, cef_popup_features_t *lpStruct)
+{
+ if (!cef_popup_features_tFc.cached) cachecef_popup_features_tFields(env, lpObject);
+ lpStruct->x = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.x);
+ lpStruct->xSet = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.xSet);
+ lpStruct->y = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.y);
+ lpStruct->ySet = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.ySet);
+ lpStruct->width = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.width);
+ lpStruct->widthSet = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.widthSet);
+ lpStruct->height = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.height);
+ lpStruct->heightSet = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.heightSet);
+ lpStruct->menuBarVisible = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.menuBarVisible);
+ lpStruct->statusBarVisible = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.statusBarVisible);
+ lpStruct->toolBarVisible = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.toolBarVisible);
+ lpStruct->locationBarVisible = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.locationBarVisible);
+ lpStruct->scrollbarsVisible = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.scrollbarsVisible);
+ lpStruct->resizable = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.resizable);
+ lpStruct->fullscreen = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.fullscreen);
+ lpStruct->dialog = (*env)->GetIntField(env, lpObject, cef_popup_features_tFc.dialog);
+ lpStruct->additionalFeatures = (cef_string_list_t)(*env)->GetIntLongField(env, lpObject, cef_popup_features_tFc.additionalFeatures);
+ return lpStruct;
+}
+
+void setcef_popup_features_tFields(JNIEnv *env, jobject lpObject, cef_popup_features_t *lpStruct)
+{
+ if (!cef_popup_features_tFc.cached) cachecef_popup_features_tFields(env, lpObject);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.x, (jint)lpStruct->x);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.xSet, (jint)lpStruct->xSet);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.y, (jint)lpStruct->y);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.ySet, (jint)lpStruct->ySet);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.width, (jint)lpStruct->width);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.widthSet, (jint)lpStruct->widthSet);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.height, (jint)lpStruct->height);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.heightSet, (jint)lpStruct->heightSet);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.menuBarVisible, (jint)lpStruct->menuBarVisible);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.statusBarVisible, (jint)lpStruct->statusBarVisible);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.toolBarVisible, (jint)lpStruct->toolBarVisible);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.locationBarVisible, (jint)lpStruct->locationBarVisible);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.scrollbarsVisible, (jint)lpStruct->scrollbarsVisible);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.resizable, (jint)lpStruct->resizable);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.fullscreen, (jint)lpStruct->fullscreen);
+ (*env)->SetIntField(env, lpObject, cef_popup_features_tFc.dialog, (jint)lpStruct->dialog);
+ (*env)->SetIntLongField(env, lpObject, cef_popup_features_tFc.additionalFeatures, (jintLong)lpStruct->additionalFeatures);
+}
+#endif
+
#ifndef NO_cef_process_message_t
typedef struct cef_process_message_t_FID_CACHE {
int cached;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.h b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.h
index e67bc32..6537404 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/library/cef3_structs.h
@@ -155,6 +155,18 @@ void setcef_menu_model_tFields(JNIEnv *env, jobject lpObject, cef_menu_model_t *
#define cef_menu_model_t_sizeof() 0
#endif
+#ifndef NO_cef_popup_features_t
+void cachecef_popup_features_tFields(JNIEnv *env, jobject lpObject);
+cef_popup_features_t *getcef_popup_features_tFields(JNIEnv *env, jobject lpObject, cef_popup_features_t *lpStruct);
+void setcef_popup_features_tFields(JNIEnv *env, jobject lpObject, cef_popup_features_t *lpStruct);
+#define cef_popup_features_t_sizeof() sizeof(cef_popup_features_t)
+#else
+#define cachecef_popup_features_tFields(a,b)
+#define getcef_popup_features_tFields(a,b,c) NULL
+#define setcef_popup_features_tFields(a,b,c)
+#define cef_popup_features_t_sizeof() 0
+#endif
+
#ifndef NO_cef_process_message_t
void cachecef_process_message_tFields(JNIEnv *env, jobject lpObject);
cef_process_message_t *getcef_process_message_tFields(JNIEnv *env, jobject lpObject, cef_process_message_t *lpStruct);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEF.java b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEF.java
index bcbd30a..599c9f2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEF.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEF.java
@@ -29,6 +29,14 @@ public class CEF extends WebBrowser {
long /*int*/ windowHandle;
Hashtable ipcAdapters = new Hashtable(9);
Hashtable downloads = new Hashtable(9);
+ boolean addressBar = true;
+ boolean menuBar = true;
+ boolean statusBar = true;
+ boolean toolBar = true;
+ Point location = null;
+ Point size = null;
+ cef_popup_features_t features = null;
+ CEF parentBrowser = null;
static boolean LibraryLoaded;
static CEFApp App;
@@ -194,6 +202,12 @@ static String ExtractCEFString(long /*int*/ pString) {
return new String(chars);
}
+static Browser findBrowser (CEFBrowser cefBrowser) {
+ CEFBrowserHost host = new CEFBrowserHost(cefBrowser.get_host());
+ long /*int*/ windowHandle = host.get_window_handle();
+ return (Browser)Display.getCurrent().findWidget(windowHandle);
+}
+
static boolean IsInstalled() {
if (!LibraryLoaded) return false;
if (CEF3.cef_build_revision() != CEF3_SUPPORTED_REVISON) return false;
@@ -285,6 +299,11 @@ void browserCreated(long /*int*/ handle) {
setUrl((String)pendingUrl[0], (String)pendingUrl[1], (String[])pendingUrl[2]);
}
pendingText = pendingUrl = null;
+
+ if (features != null) {
+ parentBrowser.show(this);
+ features = null;
+ }
}
public Object evaluate (String script) throws SWTException {
@@ -632,6 +651,38 @@ void onTitleChange(String title) {
titleListeners[i].changed(event);
}
}
+
+void onWindowClose() {
+ WindowEvent newEvent = new WindowEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ for (int i = 0; i < closeWindowListeners.length; i++) {
+ closeWindowListeners[i].close (newEvent);
+ }
+}
+
+int onWindowOpen(long /*int*/ str_target_url, cef_popup_features_t features) {
+ WindowEvent newEvent = new WindowEvent(browser);
+ newEvent.display = browser.getDisplay();
+ newEvent.widget = browser;
+ newEvent.required = false;
+ for (int i = 0; i < openWindowListeners.length; i++) {
+ openWindowListeners[i].open(newEvent);
+ }
+ Browser browser = null;
+ if (newEvent.browser != null && newEvent.browser.webBrowser instanceof CEF) {
+ browser = newEvent.browser;
+ }
+ if (browser != null && !browser.isDisposed ()) {
+ String targetUrl = ExtractCEFString(str_target_url);
+ CEF webBrowser = (CEF)browser.webBrowser;
+ webBrowser.setUrl(targetUrl,null,null);
+ webBrowser.setPopupFeatures(features);
+ webBrowser.setParentBrowser(this);
+ return 1;
+ }
+ return 0;
+}
public void refresh() {
if (cefBrowser == null) return;
@@ -690,6 +741,82 @@ public boolean setUrl(String url, String postData, String[] headers) {
return true;
}
+void setAddressBar(boolean addressBar) {
+ this.addressBar = addressBar;
+}
+
+void setMenuBar(boolean menuBar) {
+ this.menuBar = menuBar;
+}
+
+void setStatusBar(boolean statusBar) {
+ this.statusBar = statusBar;
+}
+
+void setToolBar(boolean toolBar) {
+ this.toolBar = toolBar;
+}
+
+void setPopupFeatures(cef_popup_features_t features) {
+ this.features = features;
+}
+
+void setParentBrowser(CEF parent) {
+ this.parentBrowser = parent;
+}
+
+void setLocation(Point location) {
+ this.location = location;
+}
+
+void setSize(Point size) {
+ this.size = size;
+}
+
+public void show(CEF child) {
+ cef_popup_features_t features = child.features;
+ final WindowEvent newEvent = new WindowEvent (child.browser);
+ newEvent.display = child.browser.getDisplay();
+ newEvent.widget = child.browser;
+ newEvent.addressBar = features.locationBarVisible == 1;
+ newEvent.menuBar = features.menuBarVisible == 1;
+ newEvent.statusBar = features.statusBarVisible == 1;
+ newEvent.toolBar = features.toolBarVisible == 1;
+ final Point location;
+ if (features.ySet == 1 && features.xSet == 1) {
+ location = new Point(features.x, features.y);
+ }
+ else {
+ location = null;
+ }
+
+ final Point size;
+ if (features.widthSet == 1) {
+ if (features.heightSet == 1) {
+ size = new Point(features.width, features.height);
+ }
+ else {
+ size = new Point(features.width, this.browser.getSize().y);
+ }
+ }
+ else if (features.heightSet == 1) {
+ size = new Point(this.browser.getSize().y, features.height);
+ }
+ else {
+ size = null;
+ }
+ newEvent.location = location;
+ newEvent.size = size;
+ final VisibilityWindowListener[] visibilityWindowListeners = this.visibilityWindowListeners;
+ browser.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ for (int i = 0; i < visibilityWindowListeners.length; i++) {
+ visibilityWindowListeners[i].show(newEvent);
+ }
+ }
+ });
+}
+
public void stop() {
htmlText = null;
if (cefBrowser == null) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEFLifeSpanHandler.java b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEFLifeSpanHandler.java
index 59c06d8..087f038 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEFLifeSpanHandler.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/browser/CEFLifeSpanHandler.java
@@ -61,13 +61,25 @@ synchronized int release() {
/* cef_life_span_handler_t */
-long /*int*/ on_before_popup(long /*int*/ browser, long /*int*/ frame, long /*int*/ target_url, long /*int*/ target_frame_name, long /*int*/ popupFeatures, long /*int*/ windowInfo, long /*int*/ client, long /*int*/ settings, long /*int*/ no_javascript_access) {
- if (Device.DEBUG) System.out.println("on_before_popup (TODO)");
+long /*int*/ on_before_popup(long /*int*/ browser, long /*int*/ frame, final long /*int*/ target_url, long /*int*/ target_frame_name, long /*int*/ pPopupFeatures, long /*int*/ windowInfo, long /*int*/ client, long /*int*/ settings, long /*int*/ no_javascript_access) {
+ if (Device.DEBUG) System.out.println("on_before_popup (impl)");
+ final cef_popup_features_t popupFeatures = new cef_popup_features_t();
+ CEF3.memmove(popupFeatures, pPopupFeatures, cef_popup_features_t.sizeof);
+ final int result[] = new int[1];
+ result[0] = 0;
+ host.browser.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if (host.browser.isDisposed()) return;
+ result[0] = host.onWindowOpen(target_url, popupFeatures);
+ }
+ });
+
new CEFBase(browser).release();
new CEFBase(frame).release();
- new CEFBase(popupFeatures).release();
- // TODO does client need to be released too?
- return 0;
+ // does client need to be released too?
+ // Probably not, it is not a direct reference (it is a **cef_client_t, possibly a list of them?)
+ // The reference is held elsewhere.
+ return result[0];
}
long /*int*/ on_after_created(long /*int*/ browser) {
@@ -85,11 +97,22 @@ long /*int*/ run_modal(long /*int*/ browser) {
return 0;
}
-long /*int*/ do_close(long /*int*/ browser) {
+long /*int*/ do_close(long /*int*/ pBrowser) {
/* possibly useful */
if (Device.DEBUG) System.out.println("do_close");
- new CEFBase(browser).release();
- return 0;
+ CEFBrowser cefBrowser = new CEFBrowser(pBrowser);
+ final Browser browser = CEF.findBrowser(cefBrowser);
+ final CEF webBrowser = ((CEF)browser.webBrowser);
+ browser.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (browser.isDisposed()) return;
+ webBrowser.onWindowClose();
+ }
+ });
+ cefBrowser.release();
+ // Not sure if I need to release the host at some point.
+ // There is no rule for structs that are returned by a method.
+ return 1;
}
long /*int*/ on_before_close(long /*int*/ browser) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/internal/cef3/CEF3.java b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/internal/cef3/CEF3.java
index af6159a..56a6138 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/internal/cef3/CEF3.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT CEF/win32/org/eclipse/swt/internal/cef3/CEF3.java
@@ -117,6 +117,13 @@ public static final native void memmove(cef_menu_model_t dest, long /*int*/ src,
* @param src cast=(const void *)
* @param size cast=(size_t)
*/
+public static final native void memmove(cef_popup_features_t dest, long /*int*/ src, long /*int*/ size);
+
+/**
+ * @param dest cast=(void *),flags=no_in critical
+ * @param src cast=(const void *)
+ * @param size cast=(size_t)
+ */
public static final native void memmove(cef_process_message_t dest, long /*int*/ src, long /*int*/ size);
/**
@@ -172,6 +179,7 @@ public static final native int cef_download_item_callback_t_sizeof();
public static final native int cef_frame_t_sizeof();
public static final native int cef_list_value_t_sizeof();
public static final native int cef_menu_model_t_sizeof();
+public static final native int cef_popup_features_t_sizeof();
public static final native int cef_process_message_t_sizeof();
public static final native int cef_settings_t_sizeof();
public static final native int cef_string_t_sizeof();