From 395692675e255578e24bb51eb09e1b4119931dff Mon Sep 17 00:00:00 2001 From: Grant Gayed Date: Tue, 29 Jan 2008 20:19:31 +0000 Subject: 213194, 214682, 214802 --- ...g.eclipse.swt.internal.mozilla.XPCOM.properties | 34 ++ .../Eclipse SWT Mozilla/common/library/xpcom.cpp | 46 ++ .../common/library/xpcom_stats.cpp | 6 +- .../common/library/xpcom_stats.h | 2 + .../swt/browser/HelperAppLauncherDialog.java | 47 +- .../common/org/eclipse/swt/browser/Mozilla.java | 120 ++-- .../org/eclipse/swt/browser/PromptService.java | 498 ---------------- .../org/eclipse/swt/browser/PromptService2.java | 630 +++++++++++++++++++++ .../eclipse/swt/browser/PromptService2Factory.java | 100 ++++ .../eclipse/swt/browser/PromptServiceFactory.java | 100 ---- .../org/eclipse/swt/internal/mozilla/XPCOM.java | 2 + .../swt/internal/mozilla/nsIAuthInformation.java | 87 +++ .../eclipse/swt/internal/mozilla/nsIChannel.java | 119 ++++ .../swt/internal/mozilla/nsIDocShell_1_9.java | 345 +++++++++++ .../internal/mozilla/nsIHelperAppLauncher_1_9.java | 83 +++ .../swt/internal/mozilla/nsIPromptService2.java | 51 ++ .../eclipse/swt/internal/SWTMessages.properties | 2 + 17 files changed, 1624 insertions(+), 648 deletions(-) delete mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2Factory.java delete mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptServiceFactory.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIAuthInformation.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChannel.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDocShell_1_9.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_9.java create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptService2.java diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties index f5f9879594..0529830fb9 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties @@ -94,6 +94,19 @@ XPCOM_VtblCall__IIIIIIII_5= XPCOM_VtblCall__IIIIIIII_6= XPCOM_VtblCall__IIIIIIII_7= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_0= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_1= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_2= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_3= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_4= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_5= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_6= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_7= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_8= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_9= +XPCOM_VtblCall__IIIIIIII_3C_3Z_3I_10= + XPCOM_VtblCall__IIIIIIJII= XPCOM_VtblCall__IIIIIIJII_0= XPCOM_VtblCall__IIIIIIJII_1= @@ -131,6 +144,17 @@ XPCOM_VtblCall__IIIIII_3C_3BIIIIZ_3I_3I_12= XPCOM_VtblCall__IIIIII_3C_3BIIIIZ_3I_3I_13= XPCOM_VtblCall__IIIIII_3C_3BIIIIZ_3I_3I_14= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_0= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_1= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_2= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_3= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_4= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_5= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_6= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_7= +XPCOM_VtblCall__IIIIII_3C_3Z_3Z_8= + XPCOM_VtblCall__IIIIII_3Z_3I= XPCOM_VtblCall__IIIIII_3Z_3I_0= XPCOM_VtblCall__IIIIII_3Z_3I_1= @@ -946,12 +970,16 @@ org_eclipse_swt_internal_mozilla_nsEmbedString= org_eclipse_swt_internal_mozilla_nsIAppShell= +org_eclipse_swt_internal_mozilla_nsIAuthInformation= + org_eclipse_swt_internal_mozilla_nsIBaseWindow= org_eclipse_swt_internal_mozilla_nsICancelable= org_eclipse_swt_internal_mozilla_nsICategoryManager= +org_eclipse_swt_internal_mozilla_nsIChannel= + org_eclipse_swt_internal_mozilla_nsIComponentManager= org_eclipse_swt_internal_mozilla_nsIComponentRegistrar= @@ -996,6 +1024,8 @@ org_eclipse_swt_internal_mozilla_nsIDocShell= org_eclipse_swt_internal_mozilla_nsIDocShell_11_18= +org_eclipse_swt_internal_mozilla_nsIDocShell_11_19= + org_eclipse_swt_internal_mozilla_nsIDownload= org_eclipse_swt_internal_mozilla_nsIDownload_11_18= @@ -1016,6 +1046,8 @@ org_eclipse_swt_internal_mozilla_nsIHelperAppLauncherDialog= org_eclipse_swt_internal_mozilla_nsIHelperAppLauncher_11_18= +org_eclipse_swt_internal_mozilla_nsIHelperAppLauncher_11_19= + org_eclipse_swt_internal_mozilla_nsIIOService= org_eclipse_swt_internal_mozilla_nsIInputStream= @@ -1042,6 +1074,8 @@ org_eclipse_swt_internal_mozilla_nsIProgressDialog_11_18= org_eclipse_swt_internal_mozilla_nsIPromptService= +org_eclipse_swt_internal_mozilla_nsIPromptService2= + org_eclipse_swt_internal_mozilla_nsIProperties= org_eclipse_swt_internal_mozilla_nsIRequest= diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp index 5c344b1956..53cd93f51a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp @@ -203,6 +203,29 @@ JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIIIII) } #endif +#ifndef NO_VtblCall__IIIIIIII_3C_3Z_3I +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIIIII_3C_3Z_3I)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jcharArray arg8, jbooleanArray arg9, jintArray arg10); +JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIIIII_3C_3Z_3I) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jcharArray arg8, jbooleanArray arg9, jintArray arg10) +{ + jchar *lparg8=NULL; + jboolean *lparg9=NULL; + jint *lparg10=NULL; + jint rc = 0; + XPCOM_NATIVE_ENTER(env, that, VtblCall__IIIIIIII_3C_3Z_3I_FUNC); + if (arg8) if ((lparg8 = env->GetCharArrayElements(arg8, NULL)) == NULL) goto fail; + if (arg9) if ((lparg9 = env->GetBooleanArrayElements(arg9, NULL)) == NULL) goto fail; + if (arg10) if ((lparg10 = env->GetIntArrayElements(arg10, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jint, jint, jint, jint, jint, jint, jint, jchar *, jboolean *, jint *))(*(jint **)arg1)[arg0])(arg1, arg2, arg3, arg4, arg5, arg6, arg7, lparg8, lparg9, lparg10); +fail: + if (arg10 && lparg10) env->ReleaseIntArrayElements(arg10, lparg10, 0); + if (arg9 && lparg9) env->ReleaseBooleanArrayElements(arg9, lparg9, 0); + if (arg8 && lparg8) env->ReleaseCharArrayElements(arg8, lparg8, 0); + XPCOM_NATIVE_EXIT(env, that, VtblCall__IIIIIIII_3C_3Z_3I_FUNC); + return rc; +} +#endif + #ifndef NO_VtblCall__IIIIIIJII extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIIIJII)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jlong arg6, jint arg7, jint arg8); JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIIIJII) @@ -255,6 +278,29 @@ fail: } #endif +#ifndef NO_VtblCall__IIIIII_3C_3Z_3Z +extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIII_3C_3Z_3Z)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jcharArray arg6, jbooleanArray arg7, jbooleanArray arg8); +JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIII_3C_3Z_3Z) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jcharArray arg6, jbooleanArray arg7, jbooleanArray arg8) +{ + jchar *lparg6=NULL; + jboolean *lparg7=NULL; + jboolean *lparg8=NULL; + jint rc = 0; + XPCOM_NATIVE_ENTER(env, that, VtblCall__IIIIII_3C_3Z_3Z_FUNC); + if (arg6) if ((lparg6 = env->GetCharArrayElements(arg6, NULL)) == NULL) goto fail; + if (arg7) if ((lparg7 = env->GetBooleanArrayElements(arg7, NULL)) == NULL) goto fail; + if (arg8) if ((lparg8 = env->GetBooleanArrayElements(arg8, NULL)) == NULL) goto fail; + rc = (jint)((jint (STDMETHODCALLTYPE *)(jint, jint, jint, jint, jint, jchar *, jboolean *, jboolean *))(*(jint **)arg1)[arg0])(arg1, arg2, arg3, arg4, arg5, lparg6, lparg7, lparg8); +fail: + if (arg8 && lparg8) env->ReleaseBooleanArrayElements(arg8, lparg8, 0); + if (arg7 && lparg7) env->ReleaseBooleanArrayElements(arg7, lparg7, 0); + if (arg6 && lparg6) env->ReleaseCharArrayElements(arg6, lparg6, 0); + XPCOM_NATIVE_EXIT(env, that, VtblCall__IIIIII_3C_3Z_3Z_FUNC); + return rc; +} +#endif + #ifndef NO_VtblCall__IIIIII_3Z_3I extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIII_3Z_3I)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jbooleanArray arg6, jintArray arg7); JNIEXPORT jint JNICALL XPCOM_NATIVE(VtblCall__IIIIII_3Z_3I) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp index ba0ad9433f..76c9cc3895 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int XPCOM_nativeFunctionCount = 132; -int XPCOM_nativeFunctionCallCount[132]; +int XPCOM_nativeFunctionCount = 134; +int XPCOM_nativeFunctionCallCount[134]; char * XPCOM_nativeFunctionNames[] = { "Call", "NS_1GetComponentManager", @@ -30,9 +30,11 @@ char * XPCOM_nativeFunctionNames[] = { "VtblCall__IIIIII", "VtblCall__IIIIIII", "VtblCall__IIIIIIII", + "VtblCall__IIIIIIII_3C_3Z_3I", "VtblCall__IIIIIIJII", "VtblCall__IIIIIIZ", "VtblCall__IIIIII_3C_3BIIIIZ_3I_3I", + "VtblCall__IIIIII_3C_3Z_3Z", "VtblCall__IIIIII_3Z_3I", "VtblCall__IIIIIZ", "VtblCall__IIIIIZ_3CIIIIZ_3I_3I", diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h index 084f80984d..bd2f41e4fa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h @@ -38,9 +38,11 @@ typedef enum { VtblCall__IIIIII_FUNC, VtblCall__IIIIIII_FUNC, VtblCall__IIIIIIII_FUNC, + VtblCall__IIIIIIII_3C_3Z_3I_FUNC, VtblCall__IIIIIIJII_FUNC, VtblCall__IIIIIIZ_FUNC, VtblCall__IIIIII_3C_3BIIIIZ_3I_3I_FUNC, + VtblCall__IIIIII_3C_3Z_3Z_FUNC, VtblCall__IIIIII_3Z_3I_FUNC, VtblCall__IIIIIZ_FUNC, VtblCall__IIIIIZ_3CIIIIZ_3I_3I_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog.java index ad3ce4888e..079a843f00 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog.java @@ -98,19 +98,28 @@ int Release () { int Show (int /*long*/ aLauncher, int /*long*/ aContext, int aReason) { /* - * The interface for nsIHelperAppLauncher changed as of mozilla 1.8. Query the received - * nsIHelperAppLauncher for the new interface, and if it is not found then fall back to - * the old interface. - */ + * The interface for nsIHelperAppLauncher changed in GRE versions 1.8 and 1.9. Query for + * each of these interfaces in turn until one is found. + */ nsISupports supports = new nsISupports (aLauncher); int /*long*/[] result = new int /*long*/[1]; - int rc = supports.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result); - if (rc == 0) { /* >= 1.8 */ + int rc = supports.QueryInterface (nsIHelperAppLauncher_1_9.NS_IHELPERAPPLAUNCHER_IID, result); + if (rc == 0) { + nsIHelperAppLauncher_1_9 helperAppLauncher = new nsIHelperAppLauncher_1_9 (aLauncher); + rc = helperAppLauncher.SaveToDisk (0, false); + helperAppLauncher.Release (); + return rc; + } + + result[0] = 0; + rc = supports.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result); + if (rc == 0) { nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8 (aLauncher); rc = helperAppLauncher.SaveToDisk (0, false); helperAppLauncher.Release (); return rc; } + nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher (aLauncher); /* < 1.8 */ return helperAppLauncher.SaveToDisk (0, false); } @@ -132,21 +141,28 @@ int PromptForSaveToFile (int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2 * The interface for nsIHelperAppLauncher changed as of mozilla 1.8, so the first * argument must be queried for both the old and new nsIHelperAppLauncher interfaces. */ + boolean using_1_8 = false, using_1_9 = false; nsISupports support = new nsISupports (arg0); int /*long*/[] result = new int /*long*/[1]; int rc = support.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result); - boolean usingMozilla18 = rc == 0; - if (usingMozilla18) { + if (rc == 0) { + using_1_8 = true; hasLauncher = true; - nsISupports supports = new nsISupports (result[0]); - supports.Release (); + new nsISupports (result[0]).Release (); } else { result[0] = 0; - rc = support.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result); + rc = support.QueryInterface (nsIHelperAppLauncher_1_9.NS_IHELPERAPPLAUNCHER_IID, result); if (rc == 0) { + using_1_9 = true; hasLauncher = true; - nsISupports supports = new nsISupports (result[0]); - supports.Release (); + new nsISupports (result[0]).Release (); + } else { + result[0] = 0; + rc = support.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result); + if (rc == 0) { + hasLauncher = true; + new nsISupports (result[0]).Release (); + } } } result[0] = 0; @@ -179,9 +195,12 @@ int PromptForSaveToFile (int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2 shell.close (); if (name == null) { if (hasLauncher) { - if (usingMozilla18) { + if (using_1_8) { nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8 (arg0); rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED); + } else if (using_1_9) { + nsIHelperAppLauncher_1_9 launcher = new nsIHelperAppLauncher_1_9 (arg0); + rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED); } else { nsIHelperAppLauncher launcher = new nsIHelperAppLauncher (arg0); rc = launcher.Cancel (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java index d34dac37fd..09ed446b25 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java @@ -52,7 +52,7 @@ class Mozilla extends WebBrowser { static AppFileLocProvider LocationProvider; static WindowCreator2 WindowCreator; static int BrowserCount; - static boolean Initialized, IsXULRunner, Is_1_8, XPCOMWasGlued, XPCOMInitWasGlued; + static boolean Initialized, IsPre_1_8, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued; /* XULRunner detect constants */ static final String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$ @@ -155,7 +155,7 @@ public void create (Composite parent, int style) { int /*long*/[] result = new int /*long*/[1]; if (!Initialized) { boolean initLoaded = false; - IsXULRunner = false; + boolean IsXULRunner = false; String greInitialized = System.getProperty (GRE_INITIALIZED); if ("true".equals (greInitialized)) { //$NON-NLS-1$ @@ -822,7 +822,7 @@ public void create (Composite parent, int style) { prefBranch.Release (); - PromptServiceFactory factory = new PromptServiceFactory (); + PromptService2Factory factory = new PromptService2Factory (); factory.AddRef (); rc = componentManager.QueryInterface (nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result); @@ -857,6 +857,13 @@ public void create (Composite parent, int style) { } dialogFactory.Release (); + /* + * This Download factory will be used if the GRE version is < 1.8. + * If the GRE version is 1.8.x then the Download factory that is registered later for + * contract "Transfer" will be used. + * If the GRE version is >= 1.9 then no Download factory is registered because this + * functionality is provided by the GRE. + */ DownloadFactory downloadFactory = new DownloadFactory (); downloadFactory.AddRef (); aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOWNLOAD_CONTRACTID, true); @@ -868,17 +875,6 @@ public void create (Composite parent, int style) { } downloadFactory.Release (); - DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); - downloadFactory_1_8.AddRef (); - aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); - aClassName = MozillaDelegate.wcsToMbcs (null, "Transfer", true); //$NON-NLS-1$ - rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ()); - if (rc != XPCOM.NS_OK) { - browser.dispose (); - error (rc); - } - downloadFactory_1_8.Release (); - FilePickerFactory pickerFactory = IsXULRunner ? new FilePickerFactory_1_8 () : new FilePickerFactory (); pickerFactory.AddRef (); aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FILEPICKER_CONTRACTID, true); @@ -893,7 +889,6 @@ public void create (Composite parent, int style) { componentRegistrar.Release (); componentManager.Release (); - Is_1_8 = IsXULRunner; Initialized = true; } @@ -962,7 +957,6 @@ public void create (Composite parent, int style) { browser.dispose (); error (XPCOM.NS_NOINTERFACE); } - componentManager.Release (); webBrowser = new nsIWebBrowser (result[0]); result[0] = 0; @@ -1013,25 +1007,74 @@ public void create (Composite parent, int style) { } baseWindow.Release (); - if (!Is_1_8) { + if (!PerformedVersionCheck) { + PerformedVersionCheck = true; + /* - * Check for the availability of the 1.8 implementation of nsIDocShell to determine - * if the GRE's version is >= 1.8. + * Check for the availability of the pre-1.8 implementation of nsIDocShell + * to determine if the GRE's version is < 1.8. */ rc = webBrowser.QueryInterface (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID, result); - if (rc != XPCOM.NS_OK) error (rc); - if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + if (rc != XPCOM.NS_OK) { + browser.dispose (); + error (XPCOM.NS_ERROR_FAILURE); + } + if (result[0] == 0) { + browser.dispose (); + error (XPCOM.NS_ERROR_NO_INTERFACE); + } nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); result[0] = 0; - rc = interfaceRequestor.GetInterface (nsIDocShell_1_8.NS_IDOCSHELL_IID, result); + rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result); if (rc == XPCOM.NS_OK && result[0] != 0) { - Is_1_8 = true; + IsPre_1_8 = true; new nsISupports (result[0]).Release (); } result[0] = 0; + + /* + * A Download factory for contract "Transfer" must be registered iff the GRE's version is 1.8.x. + * Check for the availability of the 1.8 implementation of nsIDocShell to determine if the + * GRE's version is 1.8.x. + * If the GRE version is < 1.8 then the previously-registered Download factory for contract + * "Download" will be used. + * If the GRE version is >= 1.9 then no Download factory is registered because this + * functionality is provided by the GRE. + */ + if (!IsPre_1_8) { + rc = interfaceRequestor.GetInterface (nsIDocShell_1_8.NS_IDOCSHELL_IID, result); + if (rc == XPCOM.NS_OK && result[0] != 0) { /* 1.8 */ + new nsISupports (result[0]).Release (); + result[0] = 0; + rc = componentManager.QueryInterface (nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result); + if (rc != XPCOM.NS_OK) { + browser.dispose (); + error (rc); + } + if (result[0] == 0) { + browser.dispose (); + error (XPCOM.NS_NOINTERFACE); + } + + nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); + DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); + downloadFactory_1_8.AddRef (); + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true); + byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "Transfer", true); //$NON-NLS-1$ + rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ()); + if (rc != XPCOM.NS_OK) { + browser.dispose (); + error (rc); + } + downloadFactory_1_8.Release (); + componentRegistrar.Release (); + } + } + result[0] = 0; interfaceRequestor.Release (); } + componentManager.Release (); rc = webBrowser.AddWebBrowserListener (weakReference.getAddress (), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID); if (rc != XPCOM.NS_OK) { @@ -1658,20 +1701,29 @@ public boolean setText (String html) { InputStream inputStream = new InputStream (data); inputStream.AddRef (); - if (Is_1_8) { - rc = interfaceRequestor.GetInterface (nsIDocShell_1_8.NS_IDOCSHELL_IID, result); - if (rc != XPCOM.NS_OK) error (rc); + rc = interfaceRequestor.GetInterface (nsIDocShell_1_9.NS_IDOCSHELL_IID, result); + if (rc == XPCOM.NS_OK) { if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); + nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); docShell.Release (); } else { - rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result); - if (rc != XPCOM.NS_OK) error (rc); - if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIDocShell docShell = new nsIDocShell (result[0]); - rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); - docShell.Release (); + result[0] = 0; + rc = interfaceRequestor.GetInterface (nsIDocShell_1_8.NS_IDOCSHELL_IID, result); + if (rc == XPCOM.NS_OK) { + if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); + rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); + docShell.Release (); + } else { + result[0] = 0; + rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result); + if (rc != XPCOM.NS_OK) error (rc); + if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + nsIDocShell docShell = new nsIDocShell (result[0]); + rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); + docShell.Release (); + } } if (rc != XPCOM.NS_OK) error (rc); result[0] = 0; @@ -2193,7 +2245,7 @@ int OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*lo * to about:blank and fires the corresponding navigation events. Do not send * this event on to the user since it is not expected. */ - if (Is_1_8 && aRequest == 0 && url.startsWith (ABOUT_BLANK)) return XPCOM.NS_OK; + if (!IsPre_1_8 && aRequest == 0 && url.startsWith (ABOUT_BLANK)) return XPCOM.NS_OK; LocationEvent event = new LocationEvent (browser); event.display = browser.getDisplay (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService.java deleted file mode 100644 index 6f74f8960a..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService.java +++ /dev/null @@ -1,498 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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.*; -import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.mozilla.*; -import org.eclipse.swt.widgets.*; - -class PromptService { - XPCOMObject supports; - XPCOMObject promptService; - int refCount = 0; - -PromptService () { - createCOMInterfaces (); -} - -int AddRef () { - refCount++; - return refCount; -} - -void createCOMInterfaces () { - /* Create each of the interfaces that this object implements */ - supports = new XPCOMObject (new int[] {2, 0, 0}) { - 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 ();} - }; - - promptService = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7}) { - 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 Alert (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return AlertCheck (args[0], args[1], args[2], args[3], args[4]);} - public int /*long*/ method5 (int /*long*/[] args) {return Confirm (args[0], args[1], args[2], args[3]);} - public int /*long*/ method6 (int /*long*/[] args) {return ConfirmCheck (args[0], args[1], args[2], args[3], args[4], args[5]);} - public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} - public int /*long*/ method8 (int /*long*/[] args) {return Prompt (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} - public int /*long*/ method9 (int /*long*/[] args) {return PromptUsernameAndPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);} - public int /*long*/ method10 (int /*long*/[] args) {return PromptPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} - public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6]);} - }; -} - -void disposeCOMInterfaces () { - if (supports != null) { - supports.dispose (); - supports = null; - } - if (promptService != null) { - promptService.dispose (); - promptService = null; - } -} - -int /*long*/ getAddress () { - return promptService.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; - nsID guid = new nsID (); - XPCOM.memmove (guid, riid, nsID.sizeof); - - if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); - AddRef (); - return XPCOM.NS_OK; - } - if (guid.Equals (nsIPromptService.NS_IPROMPTSERVICE_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF); - AddRef (); - return XPCOM.NS_OK; - } - - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); - return XPCOM.NS_ERROR_NO_INTERFACE; -} - -int Release () { - refCount--; - if (refCount == 0) disposeCOMInterfaces (); - return refCount; -} - -Browser getBrowser (int /*long*/ aDOMWindow) { - if (aDOMWindow == 0) return null; - - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - - nsIServiceManager serviceManager = new nsIServiceManager (result[0]); - result[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result); - if (rc != XPCOM.NS_OK) Mozilla.error(rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - serviceManager.Release (); - - nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); - result[0] = 0; - /* the chrome will only be answered for the top-level nsIDOMWindow */ - nsIDOMWindow window = new nsIDOMWindow (aDOMWindow); - rc = window.GetTop (result); - if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - aDOMWindow = result[0]; - result[0] = 0; - rc = windowWatcher.GetChromeForWindow (aDOMWindow, result); - if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - windowWatcher.Release (); - - nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]); - result[0] = 0; - rc = webBrowserChrome.QueryInterface (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result); - if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - webBrowserChrome.Release (); - - nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]); - result[0] = 0; - rc = embeddingSiteWindow.GetSiteWindow (result); - if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - embeddingSiteWindow.Release (); - - return Mozilla.findBrowser (result[0]); -} - -String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) { - String label = null; - int flag = (buttonFlag & (0xff * index)) / index; - switch (flag) { - case nsIPromptService.BUTTON_TITLE_CANCEL : label = SWT.getMessage ("SWT_Cancel"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_NO : label = SWT.getMessage ("SWT_No"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_OK : label = SWT.getMessage ("SWT_OK"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_SAVE : label = SWT.getMessage ("SWT_Save"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_YES : label = SWT.getMessage ("SWT_Yes"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_IS_STRING : { - int length = XPCOM.strlen_PRUnichar (buttonTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, buttonTitle, length * 2); - label = new String (dest); - } - } - return label; -} - -/* nsIPromptService */ - -int Alert (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText) { - Browser browser = getBrowser (aParent); - - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); - - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); - - Shell shell = browser == null ? new Shell () : browser.getShell (); - MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.ICON_WARNING); - messageBox.setText (titleLabel); - messageBox.setMessage (textLabel); - messageBox.open (); - return XPCOM.NS_OK; -} - -int AlertCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) { - Browser browser = getBrowser (aParent); - - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); - - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); - - length = XPCOM.strlen_PRUnichar (aCheckMsg); - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - String checkLabel = new String (dest); - - Shell shell = browser == null ? new Shell () : browser.getShell (); - PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1]; - if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); /* PRBool */ - dialog.alertCheck (titleLabel, textLabel, checkLabel, check); - if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); /* PRBool */ - return XPCOM.NS_OK; -} - -int Confirm (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ _retval) { - Browser browser = getBrowser (aParent); - - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); - - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); - - Shell shell = browser == null ? new Shell () : browser.getShell (); - MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION); - messageBox.setText (titleLabel); - messageBox.setMessage (textLabel); - int id = messageBox.open (); - int[] result = {id == SWT.OK ? 1 : 0}; - XPCOM.memmove (_retval, result, 4); - return XPCOM.NS_OK; -} - -int ConfirmCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} - -int ConfirmEx (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aButtonFlags, int /*long*/ aButton0Title, int /*long*/ aButton1Title, int /*long*/ aButton2Title, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { - Browser browser = getBrowser (aParent); - - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); - - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); - - String checkLabel = null; - if (aCheckMsg != 0) { - length = XPCOM.strlen_PRUnichar (aCheckMsg); - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - checkLabel = new String (dest); - } - - String button0Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_0, aButton0Title); - String button1Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_1, aButton1Title); - String button2Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_2, aButton2Title); - - int defaultIndex = 0; - if ((aButtonFlags & nsIPromptService.BUTTON_POS_1_DEFAULT) != 0) { - defaultIndex = 1; - } else if ((aButtonFlags & nsIPromptService.BUTTON_POS_2_DEFAULT) != 0) { - defaultIndex = 2; - } - - Shell shell = browser == null ? new Shell () : browser.getShell (); - PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1], result = new int[1]; - if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); - dialog.confirmEx (titleLabel, textLabel, checkLabel, button0Label, button1Label, button2Label, defaultIndex, check, result); - if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); - XPCOM.memmove (_retval, result, 4); - return XPCOM.NS_OK; -} - -int Prompt (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aValue, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { - Browser browser = getBrowser (aParent); - String titleLabel = null, textLabel, checkLabel = null; - String[] valueLabel = new String[1]; - char[] dest; - int length; - if (aDialogTitle != 0) { - length = XPCOM.strlen_PRUnichar (aDialogTitle); - dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - titleLabel = new String (dest); - } - - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - textLabel = new String (dest); - - int /*long*/[] valueAddr = new int /*long*/[1]; - XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF); - if (valueAddr[0] != 0) { - length = XPCOM.strlen_PRUnichar (valueAddr[0]); - dest = new char[length]; - XPCOM.memmove (dest, valueAddr[0], length * 2); - valueLabel[0] = new String (dest); - } - - if (aCheckMsg != 0) { - length = XPCOM.strlen_PRUnichar (aCheckMsg); - if (length > 0) { - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - checkLabel = new String (dest); - } - } - - Shell shell = browser == null ? new Shell () : browser.getShell (); - PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1], result = new int[1]; - if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); - dialog.prompt (titleLabel, textLabel, checkLabel, valueLabel, check, result); - - XPCOM.memmove (_retval, result, 4); - if (result[0] == 1) { - /* - * User selected OK. User name and password are returned as PRUnichar values. Any default - * value that we override must be freed using the nsIMemory service. - */ - int cnt, size; - int /*long*/ ptr; - char[] buffer; - int /*long*/[] result2 = new int /*long*/[1]; - if (valueLabel[0] != null) { - cnt = valueLabel[0].length (); - buffer = new char[cnt + 1]; - valueLabel[0].getChars (0, cnt, buffer, 0); - size = buffer.length * 2; - ptr = C.malloc (size); - XPCOM.memmove (ptr, buffer, size); - XPCOM.memmove (aValue, new int /*long*/[] {ptr}, C.PTR_SIZEOF); - - if (valueAddr[0] != 0) { - int rc = XPCOM.NS_GetServiceManager (result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - serviceManager.Release (); - - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; - memory.Free (valueAddr[0]); - memory.Release (); - } - } - } - if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); - return XPCOM.NS_OK; -} - -int PromptUsernameAndPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aUsername, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { - Browser browser = getBrowser (aParent); - String titleLabel, textLabel, checkLabel = null; - String[] userLabel = new String[1], passLabel = new String[1]; - char[] dest; - int length; - if (aDialogTitle != 0) { - length = XPCOM.strlen_PRUnichar (aDialogTitle); - dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - titleLabel = new String (dest); - } else { - titleLabel = ""; //$NON-NLS-1$ - } - - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - textLabel = new String (dest); - - int /*long*/[] userAddr = new int /*long*/[1]; - XPCOM.memmove (userAddr, aUsername, C.PTR_SIZEOF); - if (userAddr[0] != 0) { - length = XPCOM.strlen_PRUnichar (userAddr[0]); - dest = new char[length]; - XPCOM.memmove (dest, userAddr[0], length * 2); - userLabel[0] = new String (dest); - } - - int /*long*/[] passAddr = new int /*long*/[1]; - XPCOM.memmove (passAddr, aPassword, C.PTR_SIZEOF); - if (passAddr[0] != 0) { - length = XPCOM.strlen_PRUnichar (passAddr[0]); - dest = new char[length]; - XPCOM.memmove (dest, passAddr[0], length * 2); - passLabel[0] = new String (dest); - } - - if (aCheckMsg != 0) { - length = XPCOM.strlen_PRUnichar (aCheckMsg); - if (length > 0) { - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - checkLabel = new String (dest); - } - } - - Shell shell = browser == null ? new Shell () : browser.getShell (); - PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1], result = new int[1]; - if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); - dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result); - - XPCOM.memmove (_retval, result, 4); - if (result[0] == 1) { - /* - * User selected OK. User name and password are returned as PRUnichar values. Any default - * value that we override must be freed using the nsIMemory service. - */ - int cnt, size; - int /*long*/ ptr; - char[] buffer; - int /*long*/[] result2 = new int /*long*/[1]; - if (userLabel[0] != null) { - cnt = userLabel[0].length (); - buffer = new char[cnt + 1]; - userLabel[0].getChars (0, cnt, buffer, 0); - size = buffer.length * 2; - ptr = C.malloc (size); - XPCOM.memmove (ptr, buffer, size); - XPCOM.memmove (aUsername, new int /*long*/[] {ptr}, C.PTR_SIZEOF); - - if (userAddr[0] != 0) { - int rc = XPCOM.NS_GetServiceManager (result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - serviceManager.Release (); - - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; - memory.Free (userAddr[0]); - memory.Release (); - } - } - if (passLabel[0] != null) { - cnt = passLabel[0].length (); - buffer = new char[cnt + 1]; - passLabel[0].getChars (0, cnt, buffer, 0); - size = buffer.length * 2; - ptr = C.malloc (size); - XPCOM.memmove (ptr, buffer, size); - XPCOM.memmove (aPassword, new int /*long*/[] {ptr}, C.PTR_SIZEOF); - - if (passAddr[0] != 0) { - int rc = XPCOM.NS_GetServiceManager (result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - serviceManager.Release (); - - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; - memory.Free (passAddr[0]); - memory.Release (); - } - } - } - if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); - return XPCOM.NS_OK; -} - -int PromptPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} - -int Select (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aCount, int /*long*/ aSelectList, int /*long*/ aOutSelection, int /*long*/ _retval) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java new file mode 100644 index 0000000000..8fba3b717d --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java @@ -0,0 +1,630 @@ +/******************************************************************************* + * Copyright (c) 2003, 2008 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.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.mozilla.*; +import org.eclipse.swt.widgets.*; + +class PromptService2 { + XPCOMObject supports; + XPCOMObject promptService; + XPCOMObject promptService2; + int refCount = 0; + +PromptService2 () { + createCOMInterfaces (); +} + +int AddRef () { + refCount++; + return refCount; +} + +void createCOMInterfaces () { + /* Create each of the interfaces that this object implements */ + supports = new XPCOMObject (new int[] {2, 0, 0}) { + 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 ();} + }; + + promptService = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7}) { + 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 Alert (args[0], args[1], args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return AlertCheck (args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method5 (int /*long*/[] args) {return Confirm (args[0], args[1], args[2], args[3]);} + public int /*long*/ method6 (int /*long*/[] args) {return ConfirmCheck (args[0], args[1], args[2], args[3], args[4], args[5]);} + public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} + public int /*long*/ method8 (int /*long*/[] args) {return Prompt (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} + public int /*long*/ method9 (int /*long*/[] args) {return PromptUsernameAndPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);} + public int /*long*/ method10 (int /*long*/[] args) {return PromptPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} + public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6]);} + }; + + promptService2 = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7, 7, 9}) { + 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 Alert (args[0], args[1], args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return AlertCheck (args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method5 (int /*long*/[] args) {return Confirm (args[0], args[1], args[2], args[3]);} + public int /*long*/ method6 (int /*long*/[] args) {return ConfirmCheck (args[0], args[1], args[2], args[3], args[4], args[5]);} + public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7], args[8], args[9]);} + public int /*long*/ method8 (int /*long*/[] args) {return Prompt (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} + public int /*long*/ method9 (int /*long*/[] args) {return PromptUsernameAndPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);} + public int /*long*/ method10 (int /*long*/[] args) {return PromptPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);} + public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6]);} + public int /*long*/ method12 (int /*long*/[] args) {return PromptAuth (args[0], args[1], (int)/*64*/args[2], args[3], args[4], args[5], args[6]);} + public int /*long*/ method13 (int /*long*/[] args) {return AsyncPromptAuth (args[0], args[1], args[2], args[3], (int)/*64*/args[4], args[5], args[6], args[7], args[8]);} + }; +} + +void disposeCOMInterfaces () { + if (supports != null) { + supports.dispose (); + supports = null; + } + if (promptService != null) { + promptService.dispose (); + promptService = null; + } + if (promptService2 != null) { + promptService2.dispose (); + promptService2 = null; + } +} + +int /*long*/ getAddress () { + return promptService2.getAddress (); +} + +int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { + if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; + nsID guid = new nsID (); + XPCOM.memmove (guid, riid, nsID.sizeof); + + if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) { + XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); + AddRef (); + return XPCOM.NS_OK; + } + if (guid.Equals (nsIPromptService.NS_IPROMPTSERVICE_IID)) { + XPCOM.memmove (ppvObject, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF); + AddRef (); + return XPCOM.NS_OK; + } + if (guid.Equals (nsIPromptService2.NS_IPROMPTSERVICE2_IID)) { + XPCOM.memmove (ppvObject, new int /*long*/[] {promptService2.getAddress ()}, C.PTR_SIZEOF); + AddRef (); + return XPCOM.NS_OK; + } + + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + return XPCOM.NS_ERROR_NO_INTERFACE; +} + +int Release () { + refCount--; + if (refCount == 0) disposeCOMInterfaces (); + return refCount; +} + +Browser getBrowser (int /*long*/ aDOMWindow) { + if (aDOMWindow == 0) return null; + + int /*long*/[] result = new int /*long*/[1]; + int rc = XPCOM.NS_GetServiceManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + result[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result); + if (rc != XPCOM.NS_OK) Mozilla.error(rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); + result[0] = 0; + /* the chrome will only be answered for the top-level nsIDOMWindow */ + nsIDOMWindow window = new nsIDOMWindow (aDOMWindow); + rc = window.GetTop (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + aDOMWindow = result[0]; + result[0] = 0; + rc = windowWatcher.GetChromeForWindow (aDOMWindow, result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + windowWatcher.Release (); + + nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]); + result[0] = 0; + rc = webBrowserChrome.QueryInterface (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + webBrowserChrome.Release (); + + nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]); + result[0] = 0; + rc = embeddingSiteWindow.GetSiteWindow (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + embeddingSiteWindow.Release (); + + return Mozilla.findBrowser (result[0]); +} + +String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) { + String label = null; + int flag = (buttonFlag & (0xff * index)) / index; + switch (flag) { + case nsIPromptService.BUTTON_TITLE_CANCEL : label = SWT.getMessage ("SWT_Cancel"); break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_NO : label = SWT.getMessage ("SWT_No"); break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_OK : label = SWT.getMessage ("SWT_OK"); break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_SAVE : label = SWT.getMessage ("SWT_Save"); break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_YES : label = SWT.getMessage ("SWT_Yes"); break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_IS_STRING : { + int length = XPCOM.strlen_PRUnichar (buttonTitle); + char[] dest = new char[length]; + XPCOM.memmove (dest, buttonTitle, length * 2); + label = new String (dest); + } + } + return label; +} + +/* nsIPromptService */ + +int Alert (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText) { + Browser browser = getBrowser (aParent); + + int length = XPCOM.strlen_PRUnichar (aDialogTitle); + char[] dest = new char[length]; + XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = new String (dest); + + length = XPCOM.strlen_PRUnichar (aText); + dest = new char[length]; + XPCOM.memmove (dest, aText, length * 2); + String textLabel = new String (dest); + + Shell shell = browser == null ? new Shell () : browser.getShell (); + MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.ICON_WARNING); + messageBox.setText (titleLabel); + messageBox.setMessage (textLabel); + messageBox.open (); + return XPCOM.NS_OK; +} + +int AlertCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) { + Browser browser = getBrowser (aParent); + + int length = XPCOM.strlen_PRUnichar (aDialogTitle); + char[] dest = new char[length]; + XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = new String (dest); + + length = XPCOM.strlen_PRUnichar (aText); + dest = new char[length]; + XPCOM.memmove (dest, aText, length * 2); + String textLabel = new String (dest); + + length = XPCOM.strlen_PRUnichar (aCheckMsg); + dest = new char[length]; + XPCOM.memmove (dest, aCheckMsg, length * 2); + String checkLabel = new String (dest); + + Shell shell = browser == null ? new Shell () : browser.getShell (); + PromptDialog dialog = new PromptDialog (shell); + int[] check = new int[1]; + if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); /* PRBool */ + dialog.alertCheck (titleLabel, textLabel, checkLabel, check); + if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); /* PRBool */ + return XPCOM.NS_OK; +} + +int AsyncPromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int /*long*/ aCallback, int /*long*/ aContext, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkValue, int /*long*/ _retval) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int Confirm (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ _retval) { + Browser browser = getBrowser (aParent); + + int length = XPCOM.strlen_PRUnichar (aDialogTitle); + char[] dest = new char[length]; + XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = new String (dest); + + length = XPCOM.strlen_PRUnichar (aText); + dest = new char[length]; + XPCOM.memmove (dest, aText, length * 2); + String textLabel = new String (dest); + + Shell shell = browser == null ? new Shell () : browser.getShell (); + MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION); + messageBox.setText (titleLabel); + messageBox.setMessage (textLabel); + int id = messageBox.open (); + int[] result = {id == SWT.OK ? 1 : 0}; + XPCOM.memmove (_retval, result, 4); + return XPCOM.NS_OK; +} + +int ConfirmCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int ConfirmEx (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aButtonFlags, int /*long*/ aButton0Title, int /*long*/ aButton1Title, int /*long*/ aButton2Title, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { + Browser browser = getBrowser (aParent); + + int length = XPCOM.strlen_PRUnichar (aDialogTitle); + char[] dest = new char[length]; + XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = new String (dest); + + length = XPCOM.strlen_PRUnichar (aText); + dest = new char[length]; + XPCOM.memmove (dest, aText, length * 2); + String textLabel = new String (dest); + + String checkLabel = null; + if (aCheckMsg != 0) { + length = XPCOM.strlen_PRUnichar (aCheckMsg); + dest = new char[length]; + XPCOM.memmove (dest, aCheckMsg, length * 2); + checkLabel = new String (dest); + } + + String button0Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_0, aButton0Title); + String button1Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_1, aButton1Title); + String button2Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_2, aButton2Title); + + int defaultIndex = 0; + if ((aButtonFlags & nsIPromptService.BUTTON_POS_1_DEFAULT) != 0) { + defaultIndex = 1; + } else if ((aButtonFlags & nsIPromptService.BUTTON_POS_2_DEFAULT) != 0) { + defaultIndex = 2; + } + + Shell shell = browser == null ? new Shell () : browser.getShell (); + PromptDialog dialog = new PromptDialog (shell); + int[] check = new int[1], result = new int[1]; + if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); + dialog.confirmEx (titleLabel, textLabel, checkLabel, button0Label, button1Label, button2Label, defaultIndex, check, result); + if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); + XPCOM.memmove (_retval, result, 4); + return XPCOM.NS_OK; +} + +int Prompt (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aValue, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { + Browser browser = getBrowser (aParent); + String titleLabel = null, textLabel, checkLabel = null; + String[] valueLabel = new String[1]; + char[] dest; + int length; + if (aDialogTitle != 0) { + length = XPCOM.strlen_PRUnichar (aDialogTitle); + dest = new char[length]; + XPCOM.memmove (dest, aDialogTitle, length * 2); + titleLabel = new String (dest); + } + + length = XPCOM.strlen_PRUnichar (aText); + dest = new char[length]; + XPCOM.memmove (dest, aText, length * 2); + textLabel = new String (dest); + + int /*long*/[] valueAddr = new int /*long*/[1]; + XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF); + if (valueAddr[0] != 0) { + length = XPCOM.strlen_PRUnichar (valueAddr[0]); + dest = new char[length]; + XPCOM.memmove (dest, valueAddr[0], length * 2); + valueLabel[0] = new String (dest); + } + + if (aCheckMsg != 0) { + length = XPCOM.strlen_PRUnichar (aCheckMsg); + if (length > 0) { + dest = new char[length]; + XPCOM.memmove (dest, aCheckMsg, length * 2); + checkLabel = new String (dest); + } + } + + Shell shell = browser == null ? new Shell () : browser.getShell (); + PromptDialog dialog = new PromptDialog (shell); + int[] check = new int[1], result = new int[1]; + if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); + dialog.prompt (titleLabel, textLabel, checkLabel, valueLabel, check, result); + + XPCOM.memmove (_retval, result, 4); + if (result[0] == 1) { + /* + * User selected OK. User name and password are returned as PRUnichar values. Any default + * value that we override must be freed using the nsIMemory service. + */ + int cnt, size; + int /*long*/ ptr; + char[] buffer; + int /*long*/[] result2 = new int /*long*/[1]; + if (valueLabel[0] != null) { + cnt = valueLabel[0].length (); + buffer = new char[cnt + 1]; + valueLabel[0].getChars (0, cnt, buffer, 0); + size = buffer.length * 2; + ptr = C.malloc (size); + XPCOM.memmove (ptr, buffer, size); + XPCOM.memmove (aValue, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + + if (valueAddr[0] != 0) { + int rc = XPCOM.NS_GetServiceManager (result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + result2[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result2[0]); + result2[0] = 0; + memory.Free (valueAddr[0]); + memory.Release (); + } + } + } + if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); + return XPCOM.NS_OK; +} + +int PromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkboxValue, int /*long*/ _retval) { + Browser browser = getBrowser (aParent); + String checkLabel = null; + int[] checkValue = new int[1]; + String[] userLabel = new String[1], passLabel = new String[1]; + + String title = SWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$ + + if (checkboxLabel != 0 && checkboxValue != 0) { + int length = XPCOM.strlen_PRUnichar (checkboxLabel); + char[] dest = new char[length]; + XPCOM.memmove (dest, checkboxLabel, length * 2); + checkLabel = new String (dest); + XPCOM.memmove (checkValue, checkboxValue, 4); /* PRBool */ + } + + /* get initial username and password values */ + + nsIAuthInformation auth = new nsIAuthInformation (authInfo); + + int /*long*/ ptr = XPCOM.nsEmbedString_new (); + int rc = auth.GetUsername (ptr); + if (rc != XPCOM.NS_OK) SWT.error (rc); + int length = XPCOM.nsEmbedString_Length (ptr); + int /*long*/ buffer = XPCOM.nsEmbedString_get (ptr); + char[] chars = new char[length]; + XPCOM.memmove (chars, buffer, length * 2); + userLabel[0] = new String (chars); + XPCOM.nsEmbedString_delete (ptr); + + ptr = XPCOM.nsEmbedString_new (); + rc = auth.GetPassword (ptr); + if (rc != XPCOM.NS_OK) SWT.error (rc); + length = XPCOM.nsEmbedString_Length (ptr); + buffer = XPCOM.nsEmbedString_get (ptr); + chars = new char[length]; + XPCOM.memmove (chars, buffer, length * 2); + passLabel[0] = new String (chars); + XPCOM.nsEmbedString_delete (ptr); + + /* compute the message text */ + + ptr = XPCOM.nsEmbedString_new (); + rc = auth.GetRealm (ptr); + if (rc != XPCOM.NS_OK) SWT.error (rc); + length = XPCOM.nsEmbedString_Length (ptr); + buffer = XPCOM.nsEmbedString_get (ptr); + chars = new char[length]; + XPCOM.memmove (chars, buffer, length * 2); + String realm = new String (chars); + XPCOM.nsEmbedString_delete (ptr); + + nsIChannel channel = new nsIChannel (aChannel); + int /*long*/[] uri = new int /*long*/[1]; + rc = channel.GetURI (uri); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (uri[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIURI nsURI = new nsIURI (uri[0]); + int /*long*/ aSpec = XPCOM.nsEmbedCString_new (); + rc = nsURI.GetHost (aSpec); + if (rc != XPCOM.NS_OK) SWT.error (rc); + length = XPCOM.nsEmbedCString_Length (aSpec); + buffer = XPCOM.nsEmbedCString_get (aSpec); + byte[] bytes = new byte[length]; + XPCOM.memmove (bytes, buffer, length); + XPCOM.nsEmbedCString_delete (aSpec); + String host = new String (bytes); + nsURI.Release (); + + String message; + if (realm.length () > 0 && host.length () > 0) { + message = Compatibility.getMessage ("SWT_Enter_Username_and_Password", new String[] {realm, host}); //$NON-NLS-1$ + } else { + message = ""; //$NON-NLS-1$ + } + + /* open the prompter */ + Shell shell = browser == null ? new Shell () : browser.getShell (); + PromptDialog dialog = new PromptDialog (shell); + int[] result = new int[1]; + dialog.promptUsernameAndPassword (title, message, checkLabel, userLabel, passLabel, checkValue, result); + + XPCOM.memmove (_retval, result, 4); /* PRBool */ + if (result[0] == 1) { /* User selected OK */ + nsEmbedString string = new nsEmbedString (userLabel[0]); + rc = auth.SetUsername(string.getAddress ()); + if (rc != XPCOM.NS_OK) SWT.error (rc); + string.dispose (); + + string = new nsEmbedString (passLabel[0]); + rc = auth.SetPassword(string.getAddress ()); + if (rc != XPCOM.NS_OK) SWT.error (rc); + string.dispose (); + } + + if (checkboxValue != 0) XPCOM.memmove (checkboxValue, checkValue, 4); /* PRBool */ + return XPCOM.NS_OK; +} + +int PromptUsernameAndPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aUsername, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { + Browser browser = getBrowser (aParent); + String titleLabel, textLabel, checkLabel = null; + String[] userLabel = new String[1], passLabel = new String[1]; + char[] dest; + int length; + if (aDialogTitle != 0) { + length = XPCOM.strlen_PRUnichar (aDialogTitle); + dest = new char[length]; + XPCOM.memmove (dest, aDialogTitle, length * 2); + titleLabel = new String (dest); + } else { + titleLabel = SWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$ + } + + length = XPCOM.strlen_PRUnichar (aText); + dest = new char[length]; + XPCOM.memmove (dest, aText, length * 2); + textLabel = new String (dest); + + int /*long*/[] userAddr = new int /*long*/[1]; + XPCOM.memmove (userAddr, aUsername, C.PTR_SIZEOF); + if (userAddr[0] != 0) { + length = XPCOM.strlen_PRUnichar (userAddr[0]); + dest = new char[length]; + XPCOM.memmove (dest, userAddr[0], length * 2); + userLabel[0] = new String (dest); + } + + int /*long*/[] passAddr = new int /*long*/[1]; + XPCOM.memmove (passAddr, aPassword, C.PTR_SIZEOF); + if (passAddr[0] != 0) { + length = XPCOM.strlen_PRUnichar (passAddr[0]); + dest = new char[length]; + XPCOM.memmove (dest, passAddr[0], length * 2); + passLabel[0] = new String (dest); + } + + if (aCheckMsg != 0) { + length = XPCOM.strlen_PRUnichar (aCheckMsg); + if (length > 0) { + dest = new char[length]; + XPCOM.memmove (dest, aCheckMsg, length * 2); + checkLabel = new String (dest); + } + } + + Shell shell = browser == null ? new Shell () : browser.getShell (); + PromptDialog dialog = new PromptDialog (shell); + int[] check = new int[1], result = new int[1]; + if (aCheckState != 0) XPCOM.memmove (check, aCheckState, 4); /* PRBool */ + dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result); + + XPCOM.memmove (_retval, result, 4); /* PRBool */ + if (result[0] == 1) { + /* + * User selected OK. User name and password are returned as PRUnichar values. Any default + * value that we override must be freed using the nsIMemory service. + */ + int cnt, size; + int /*long*/ ptr; + char[] buffer; + int /*long*/[] result2 = new int /*long*/[1]; + if (userLabel[0] != null) { + cnt = userLabel[0].length (); + buffer = new char[cnt + 1]; + userLabel[0].getChars (0, cnt, buffer, 0); + size = buffer.length * 2; + ptr = C.malloc (size); + XPCOM.memmove (ptr, buffer, size); + XPCOM.memmove (aUsername, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + + if (userAddr[0] != 0) { + int rc = XPCOM.NS_GetServiceManager (result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + result2[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result2[0]); + result2[0] = 0; + memory.Free (userAddr[0]); + memory.Release (); + } + } + if (passLabel[0] != null) { + cnt = passLabel[0].length (); + buffer = new char[cnt + 1]; + passLabel[0].getChars (0, cnt, buffer, 0); + size = buffer.length * 2; + ptr = C.malloc (size); + XPCOM.memmove (ptr, buffer, size); + XPCOM.memmove (aPassword, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + + if (passAddr[0] != 0) { + int rc = XPCOM.NS_GetServiceManager (result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + result2[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result2[0]); + result2[0] = 0; + memory.Free (passAddr[0]); + memory.Release (); + } + } + } + if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); /* PRBool */ + return XPCOM.NS_OK; +} + +int PromptPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int Select (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aCount, int /*long*/ aSelectList, int /*long*/ aOutSelection, int /*long*/ _retval) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2Factory.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2Factory.java new file mode 100644 index 0000000000..89fdc66a75 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2Factory.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2003, 2008 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.internal.C; +import org.eclipse.swt.internal.mozilla.*; + +class PromptService2Factory { + XPCOMObject supports; + XPCOMObject factory; + int refCount = 0; + +PromptService2Factory () { + createCOMInterfaces (); +} + +int AddRef () { + refCount++; + return refCount; +} + +void createCOMInterfaces () { + /* Create each of the interfaces that this object implements */ + supports = new XPCOMObject (new int[] {2, 0, 0}) { + 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 ();} + }; + + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 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 CreateInstance (args[0], args[1], args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} + }; +} + +void disposeCOMInterfaces () { + if (supports != null) { + supports.dispose (); + supports = null; + } + if (factory != null) { + factory.dispose (); + factory = null; + } +} + +int /*long*/ getAddress () { + return factory.getAddress (); +} + +int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { + if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; + nsID guid = new nsID (); + XPCOM.memmove (guid, riid, nsID.sizeof); + + if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) { + XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); + AddRef (); + return XPCOM.NS_OK; + } + if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { + XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); + AddRef (); + return XPCOM.NS_OK; + } + + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + return XPCOM.NS_ERROR_NO_INTERFACE; +} + +int Release () { + refCount--; + if (refCount == 0) disposeCOMInterfaces (); + return refCount; +} + +/* nsIFactory */ + +int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { + PromptService2 promptService = new PromptService2 (); + promptService.AddRef (); + XPCOM.memmove (result, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF); + return XPCOM.NS_OK; +} + +int LockFactory (int lock) { + return XPCOM.NS_OK; +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptServiceFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptServiceFactory.java deleted file mode 100644 index a4f5651341..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptServiceFactory.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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.internal.C; -import org.eclipse.swt.internal.mozilla.*; - -class PromptServiceFactory { - XPCOMObject supports; - XPCOMObject factory; - int refCount = 0; - -PromptServiceFactory () { - createCOMInterfaces (); -} - -int AddRef () { - refCount++; - return refCount; -} - -void createCOMInterfaces () { - /* Create each of the interfaces that this object implements */ - supports = new XPCOMObject (new int[] {2, 0, 0}) { - 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 ();} - }; - - factory = new XPCOMObject (new int[] {2, 0, 0, 3, 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 CreateInstance (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return LockFactory ((int)/*64*/args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports != null) { - supports.dispose (); - supports = null; - } - if (factory != null) { - factory.dispose (); - factory = null; - } -} - -int /*long*/ getAddress () { - return factory.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; - nsID guid = new nsID (); - XPCOM.memmove (guid, riid, nsID.sizeof); - - if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); - AddRef (); - return XPCOM.NS_OK; - } - if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); - AddRef (); - return XPCOM.NS_OK; - } - - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); - return XPCOM.NS_ERROR_NO_INTERFACE; -} - -int Release () { - refCount--; - if (refCount == 0) disposeCOMInterfaces (); - return refCount; -} - -/* nsIFactory */ - -int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { - PromptService promptService = new PromptService (); - promptService.AddRef (); - XPCOM.memmove (result, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF); - return XPCOM.NS_OK; -} - -int LockFactory (int lock) { - return XPCOM.NS_OK; -} -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java index 7409c5a50f..1cea24e81b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java @@ -257,4 +257,6 @@ static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int arg3, char[] arg4, byte[] arg5, int /*long*/ arg6, int /*long*/ arg7, int arg8, int /*long*/ arg9, boolean arg10, int /*long*/[] arg11, int /*long*/[] arg12); static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, int /*long*/ arg1, byte[] arg2); static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, boolean arg1, boolean arg2, int /*long*/ arg3, boolean arg4, boolean arg5, boolean arg6, boolean arg7, int arg8, int arg9); +static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, int /*long*/ arg1, int arg2, int /*long*/ arg3, char[] arg4, boolean[] arg5, boolean[] arg6); +static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int arg4, int /*long*/ arg5, char[] arg6, boolean[] arg7, int /*long*/[] arg8); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIAuthInformation.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIAuthInformation.java new file mode 100644 index 0000000000..09df412a60 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIAuthInformation.java @@ -0,0 +1,87 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2008 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIAuthInformation extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 9; + + public static final String NS_IAUTHINFORMATION_IID_STR = + "0d73639c-2a92-4518-9f92-28f71fea5f20"; + + public static final nsID NS_IAUTHINFORMATION_IID = + new nsID(NS_IAUTHINFORMATION_IID_STR); + + public nsIAuthInformation(int /*long*/ address) { + super(address); + } + + public static final int AUTH_HOST = 1; + + public static final int AUTH_PROXY = 2; + + public static final int NEED_DOMAIN = 4; + + public static final int ONLY_PASSWORD = 8; + + public int GetFlags(int[] aFlags) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aFlags); + } + + public int GetRealm(int /*long*/ aRealm) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aRealm); + } + + public int GetAuthenticationScheme(int /*long*/ aAuthenticationScheme) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aAuthenticationScheme); + } + + public int GetUsername(int /*long*/ aUsername) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aUsername); + } + + public int SetUsername(int /*long*/ aUsername) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aUsername); + } + + public int GetPassword(int /*long*/ aPassword) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aPassword); + } + + public int SetPassword(int /*long*/ aPassword) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aPassword); + } + + public int GetDomain(int /*long*/ aDomain) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aDomain); + } + + public int SetDomain(int /*long*/ aDomain) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aDomain); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChannel.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChannel.java new file mode 100644 index 0000000000..646d92b874 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIChannel.java @@ -0,0 +1,119 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2008 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIChannel extends nsIRequest { + + static final int LAST_METHOD_ID = nsIRequest.LAST_METHOD_ID + 16; + + public static final String NS_ICHANNEL_IID_STR = + "c63a055a-a676-4e71-bf3c-6cfa11082018"; + + public static final nsID NS_ICHANNEL_IID = + new nsID(NS_ICHANNEL_IID_STR); + + public nsIChannel(int /*long*/ address) { + super(address); + } + + public int GetOriginalURI(int /*long*/[] aOriginalURI) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 1, getAddress(), aOriginalURI); + } + + public int SetOriginalURI(int /*long*/ aOriginalURI) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 2, getAddress(), aOriginalURI); + } + + public int GetURI(int /*long*/[] aURI) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 3, getAddress(), aURI); + } + + public int GetOwner(int /*long*/[] aOwner) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 4, getAddress(), aOwner); + } + + public int SetOwner(int /*long*/ aOwner) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 5, getAddress(), aOwner); + } + + public int GetNotificationCallbacks(int /*long*/[] aNotificationCallbacks) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 6, getAddress(), aNotificationCallbacks); + } + + public int SetNotificationCallbacks(int /*long*/ aNotificationCallbacks) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 7, getAddress(), aNotificationCallbacks); + } + + public int GetSecurityInfo(int /*long*/[] aSecurityInfo) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 8, getAddress(), aSecurityInfo); + } + + public int GetContentType(int /*long*/ aContentType) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 9, getAddress(), aContentType); + } + + public int SetContentType(int /*long*/ aContentType) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 10, getAddress(), aContentType); + } + + public int GetContentCharset(int /*long*/ aContentCharset) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 11, getAddress(), aContentCharset); + } + + public int SetContentCharset(int /*long*/ aContentCharset) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 12, getAddress(), aContentCharset); + } + + public int GetContentLength(int[] aContentLength) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 13, getAddress(), aContentLength); + } + + public int SetContentLength(int aContentLength) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 14, getAddress(), aContentLength); + } + + public int Open(int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 15, getAddress(), _retval); + } + + public int AsyncOpen(int /*long*/ aListener, int /*long*/ aContext) { + return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 16, getAddress(), aListener, aContext); + } + + public static final int LOAD_DOCUMENT_URI = 65536; + + public static final int LOAD_RETARGETED_DOCUMENT_URI = 131072; + + public static final int LOAD_REPLACE = 262144; + + public static final int LOAD_INITIAL_DOCUMENT_URI = 524288; + + public static final int LOAD_TARGETED = 1048576; + + public static final int LOAD_CALL_CONTENT_SNIFFERS = 2097152; +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDocShell_1_9.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDocShell_1_9.java new file mode 100644 index 0000000000..00017e406e --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDocShell_1_9.java @@ -0,0 +1,345 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2008 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIDocShell_1_9 extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 67; + + public static final String NS_IDOCSHELL_IID_STR = + "4b00222a-8d0a-46d7-a1fe-43bd89d19324"; + + public static final nsID NS_IDOCSHELL_IID = + new nsID(NS_IDOCSHELL_IID_STR); + + public nsIDocShell_1_9(int /*long*/ address) { + super(address); + } + + public int LoadURI(int /*long*/ uri, int /*long*/ loadInfo, int aLoadFlags, boolean firstParty) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), uri, loadInfo, aLoadFlags, firstParty); + } + + public int LoadStream(int /*long*/ aStream, int /*long*/ aURI, int /*long*/ aContentType, int /*long*/ aContentCharset, int /*long*/ aLoadInfo) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aStream, aURI, aContentType, aContentCharset, aLoadInfo); + } + + public static final int INTERNAL_LOAD_FLAGS_NONE = 0; + + public static final int INTERNAL_LOAD_FLAGS_INHERIT_OWNER = 1; + + public static final int INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 2; + + public static final int INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 4; + + public static final int INTERNAL_LOAD_FLAGS_FIRST_LOAD = 8; + + public int InternalLoad(int /*long*/ aURI, int /*long*/ aReferrer, int /*long*/ aOwner, int aFlags, char[] aWindowTarget, byte[] aTypeHint, int /*long*/ aPostDataStream, int /*long*/ aHeadersStream, int aLoadFlags, int /*long*/ aSHEntry, boolean firstParty, int /*long*/[] aDocShell, int /*long*/[] aRequest) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aURI, aReferrer, aOwner, aFlags, aWindowTarget, aTypeHint, aPostDataStream, aHeadersStream, aLoadFlags, aSHEntry, firstParty, aDocShell, aRequest); + } + + public int CreateLoadInfo(int /*long*/[] loadInfo) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), loadInfo); + } + + public int PrepareForNewContentModel() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress()); + } + + public int SetCurrentURI(int /*long*/ aURI) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aURI); + } + + public int FirePageHideNotification(boolean isUnload) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), isUnload); + } + + public int GetPresContext(int /*long*/[] aPresContext) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aPresContext); + } + + public int GetPresShell(int /*long*/[] aPresShell) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPresShell); + } + + public int GetEldestPresShell(int /*long*/[] aEldestPresShell) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aEldestPresShell); + } + + public int GetContentViewer(int /*long*/[] aContentViewer) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aContentViewer); + } + + public int GetChromeEventHandler(int /*long*/[] aChromeEventHandler) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aChromeEventHandler); + } + + public int SetChromeEventHandler(int /*long*/ aChromeEventHandler) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aChromeEventHandler); + } + + public int GetDocumentCharsetInfo(int /*long*/[] aDocumentCharsetInfo) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aDocumentCharsetInfo); + } + + public int SetDocumentCharsetInfo(int /*long*/ aDocumentCharsetInfo) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aDocumentCharsetInfo); + } + + public int GetAllowPlugins(boolean[] aAllowPlugins) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aAllowPlugins); + } + + public int SetAllowPlugins(boolean aAllowPlugins) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aAllowPlugins); + } + + public int GetAllowJavascript(boolean[] aAllowJavascript) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aAllowJavascript); + } + + public int SetAllowJavascript(boolean aAllowJavascript) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aAllowJavascript); + } + + public int GetAllowMetaRedirects(boolean[] aAllowMetaRedirects) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), aAllowMetaRedirects); + } + + public int SetAllowMetaRedirects(boolean aAllowMetaRedirects) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), aAllowMetaRedirects); + } + + public int GetAllowSubframes(boolean[] aAllowSubframes) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress(), aAllowSubframes); + } + + public int SetAllowSubframes(boolean aAllowSubframes) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aAllowSubframes); + } + + public int GetAllowImages(boolean[] aAllowImages) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aAllowImages); + } + + public int SetAllowImages(boolean aAllowImages) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), aAllowImages); + } + + public static final int ENUMERATE_FORWARDS = 0; + + public static final int ENUMERATE_BACKWARDS = 1; + + public int GetDocShellEnumerator(int aItemType, int aDirection, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aItemType, aDirection, _retval); + } + + public static final int APP_TYPE_UNKNOWN = 0; + + public static final int APP_TYPE_MAIL = 1; + + public static final int APP_TYPE_EDITOR = 2; + + public int GetAppType(int[] aAppType) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), aAppType); + } + + public int SetAppType(int aAppType) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aAppType); + } + + public int GetAllowAuth(boolean[] aAllowAuth) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aAllowAuth); + } + + public int SetAllowAuth(boolean aAllowAuth) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), aAllowAuth); + } + + public int GetZoom(float[] aZoom) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), aZoom); + } + + public int SetZoom(float aZoom) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), aZoom); + } + + public int GetMarginWidth(int[] aMarginWidth) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), aMarginWidth); + } + + public int SetMarginWidth(int aMarginWidth) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), aMarginWidth); + } + + public int GetMarginHeight(int[] aMarginHeight) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), aMarginHeight); + } + + public int SetMarginHeight(int aMarginHeight) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), aMarginHeight); + } + + public int GetHasFocus(boolean[] aHasFocus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 37, getAddress(), aHasFocus); + } + + public int SetHasFocus(boolean aHasFocus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 38, getAddress(), aHasFocus); + } + + public int GetCanvasHasFocus(boolean[] aCanvasHasFocus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 39, getAddress(), aCanvasHasFocus); + } + + public int SetCanvasHasFocus(boolean aCanvasHasFocus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 40, getAddress(), aCanvasHasFocus); + } + + public int TabToTreeOwner(boolean forward, boolean[] tookFocus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 41, getAddress(), forward, tookFocus); + } + + public static final int BUSY_FLAGS_NONE = 0; + + public static final int BUSY_FLAGS_BUSY = 1; + + public static final int BUSY_FLAGS_BEFORE_PAGE_LOAD = 2; + + public static final int BUSY_FLAGS_PAGE_LOADING = 4; + + public static final int LOAD_CMD_NORMAL = 1; + + public static final int LOAD_CMD_RELOAD = 2; + + public static final int LOAD_CMD_HISTORY = 4; + + public int GetBusyFlags(int[] aBusyFlags) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 42, getAddress(), aBusyFlags); + } + + public int GetLoadType(int[] aLoadType) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 43, getAddress(), aLoadType); + } + + public int SetLoadType(int aLoadType) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 44, getAddress(), aLoadType); + } + + public int IsBeingDestroyed(boolean[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 45, getAddress(), _retval); + } + + public int GetIsExecutingOnLoadHandler(boolean[] aIsExecutingOnLoadHandler) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 46, getAddress(), aIsExecutingOnLoadHandler); + } + + public int GetLayoutHistoryState(int /*long*/[] aLayoutHistoryState) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 47, getAddress(), aLayoutHistoryState); + } + + public int SetLayoutHistoryState(int /*long*/ aLayoutHistoryState) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 48, getAddress(), aLayoutHistoryState); + } + + public int GetShouldSaveLayoutState(boolean[] aShouldSaveLayoutState) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 49, getAddress(), aShouldSaveLayoutState); + } + + public int GetSecurityUI(int /*long*/[] aSecurityUI) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 50, getAddress(), aSecurityUI); + } + + public int SetSecurityUI(int /*long*/ aSecurityUI) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 51, getAddress(), aSecurityUI); + } + + public int SuspendRefreshURIs() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 52, getAddress()); + } + + public int ResumeRefreshURIs() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 53, getAddress()); + } + + public int BeginRestore(int /*long*/ viewer, boolean top) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 54, getAddress(), viewer, top); + } + + public int FinishRestore() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 55, getAddress()); + } + + public int GetRestoringDocument(boolean[] aRestoringDocument) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 56, getAddress(), aRestoringDocument); + } + + public int GetUseErrorPages(boolean[] aUseErrorPages) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 57, getAddress(), aUseErrorPages); + } + + public int SetUseErrorPages(boolean aUseErrorPages) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 58, getAddress(), aUseErrorPages); + } + + public int GetPreviousTransIndex(int[] aPreviousTransIndex) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 59, getAddress(), aPreviousTransIndex); + } + + public int GetLoadedTransIndex(int[] aLoadedTransIndex) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 60, getAddress(), aLoadedTransIndex); + } + + public int HistoryPurged(int numEntries) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 61, getAddress(), numEntries); + } + + public int GetSessionStorageForURI(int /*long*/ uri, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 62, getAddress(), uri, _retval); + } + + public int AddSessionStorage(int /*long*/ aDomain, int /*long*/ storage) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 63, getAddress(), aDomain, storage); + } + + public int GetCurrentDocumentChannel(int /*long*/[] aCurrentDocumentChannel) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 64, getAddress(), aCurrentDocumentChannel); + } + + public int SetChildOffset(int offset) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 65, getAddress(), offset); + } + + public int GetIsInUnload(boolean[] aIsInUnload) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 66, getAddress(), aIsInUnload); + } + + public int GetChannelIsUnsafe(boolean[] aChannelIsUnsafe) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 67, getAddress(), aChannelIsUnsafe); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_9.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_9.java new file mode 100644 index 0000000000..73ead293bc --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_9.java @@ -0,0 +1,83 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2008 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIHelperAppLauncher_1_9 extends nsICancelable { + + static final int LAST_METHOD_ID = nsICancelable.LAST_METHOD_ID + 10; + + public static final String NS_IHELPERAPPLAUNCHER_IID_STR = + "cc75c21a-0a79-4f68-90e1-563253d0c555"; + + public static final nsID NS_IHELPERAPPLAUNCHER_IID = + new nsID(NS_IHELPERAPPLAUNCHER_IID_STR); + + public nsIHelperAppLauncher_1_9(int /*long*/ address) { + super(address); + } + + public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 1, getAddress(), aMIMEInfo); + } + + public int GetSource(int /*long*/[] aSource) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 2, getAddress(), aSource); + } + + public int GetSuggestedFileName(int /*long*/ aSuggestedFileName) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 3, getAddress(), aSuggestedFileName); + } + + public int SaveToDisk(int /*long*/ aNewFileLocation, boolean aRememberThisPreference) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 4, getAddress(), aNewFileLocation, aRememberThisPreference); + } + + public int LaunchWithApplication(int /*long*/ aApplication, boolean aRememberThisPreference) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 5, getAddress(), aApplication, aRememberThisPreference); + } + + public int SetWebProgressListener(int /*long*/ aWebProgressListener) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 6, getAddress(), aWebProgressListener); + } + + public int CloseProgressWindow() { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 7, getAddress()); + } + + public int GetTargetFile(int /*long*/[] aTargetFile) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 8, getAddress(), aTargetFile); + } + + public int GetTargetFileIsExecutable(boolean[] aTargetFileIsExecutable) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 9, getAddress(), aTargetFileIsExecutable); + } + + public int GetTimeDownloadStarted(int /*long*/ aTimeDownloadStarted) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 10, getAddress(), aTimeDownloadStarted); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptService2.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptService2.java new file mode 100644 index 0000000000..ed88556185 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptService2.java @@ -0,0 +1,51 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2008 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIPromptService2 extends nsIPromptService { + + static final int LAST_METHOD_ID = nsIPromptService.LAST_METHOD_ID + 2; + + public static final String NS_IPROMPTSERVICE2_IID_STR = + "cf86d196-dbee-4482-9dfa-3477aa128319"; + + public static final nsID NS_IPROMPTSERVICE2_IID = + new nsID(NS_IPROMPTSERVICE2_IID_STR); + + public nsIPromptService2(int /*long*/ address) { + super(address); + } + + public int PromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int level, int /*long*/ authInfo, char[] checkboxLabel, boolean[] checkValue, boolean[] _retval) { + return XPCOM.VtblCall(nsIPromptService.LAST_METHOD_ID + 1, getAddress(), aParent, aChannel, level, authInfo, checkboxLabel, checkValue, _retval); + } + + public int AsyncPromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int /*long*/ aCallback, int /*long*/ aContext, int level, int /*long*/ authInfo, char[] checkboxLabel, boolean[] checkValue, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIPromptService.LAST_METHOD_ID + 2, getAddress(), aParent, aChannel, aCallback, aContext, level, authInfo, checkboxLabel, checkValue, _retval); + } +} 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 594bab7f89..9e07418c53 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 @@ -71,3 +71,5 @@ SWT_Download_File=Download: {0} SWT_Download_Location=Saving {0} from {1} SWT_Download_Started=Downloading... SWT_Download_Status=Download: {0,number,integer} KB of {1,number,integer} KB +SWT_Authentication_Required=Authentication Required +SWT_Enter_Username_and_Password=Enter user name and password for {0} at {1} -- cgit v1.2.3