summaryrefslogtreecommitdiffstats
path: root/toolkit/components/windowwatcher/nsIPromptService.idl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /toolkit/components/windowwatcher/nsIPromptService.idl
parentInitial commit. (diff)
downloadthunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz
thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/windowwatcher/nsIPromptService.idl')
-rw-r--r--toolkit/components/windowwatcher/nsIPromptService.idl615
1 files changed, 615 insertions, 0 deletions
diff --git a/toolkit/components/windowwatcher/nsIPromptService.idl b/toolkit/components/windowwatcher/nsIPromptService.idl
new file mode 100644
index 0000000000..9d910e0bce
--- /dev/null
+++ b/toolkit/components/windowwatcher/nsIPromptService.idl
@@ -0,0 +1,615 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface mozIDOMWindowProxy;
+interface nsIAuthPromptCallback;
+interface nsIAuthInformation;
+interface nsICancelable;
+interface nsIChannel;
+
+webidl BrowsingContext;
+
+/**
+ * This is the interface to the embeddable prompt service; the service that
+ * implements nsIPrompt. Its interface is designed to be just nsIPrompt, each
+ * method modified to take a parent window parameter.
+ *
+ * Accesskeys can be attached to buttons and checkboxes by inserting an &
+ * before the accesskey character in the checkbox message or button title. For
+ * a real &, use && instead. (A "button title" generally refers to the text
+ * label of a button.)
+ *
+ * One note: in all cases, the parent window parameter can be null. However,
+ * these windows are all intended to have parents. So when no parent is
+ * specified, the implementation should try hard to find a suitable foster
+ * parent.
+ *
+ * Implementations are free to choose how they present the various button
+ * types. For example, while prompts that give the user a choice between OK
+ * and Cancel are required to return a boolean value indicating whether or not
+ * the user accepted the prompt (pressed OK) or rejected the prompt (pressed
+ * Cancel), the implementation of this interface could very well speak the
+ * prompt to the user instead of rendering any visual user-interface. The
+ * standard button types are merely idioms used to convey the nature of the
+ * choice the user is to make.
+ *
+ * Because implementations of this interface may loosely interpret the various
+ * button types, it is advised that text messages passed to these prompts do
+ * not refer to the button types by name. For example, it is inadvisable to
+ * tell the user to "Press OK to proceed." Instead, such a prompt might be
+ * rewritten to ask the user: "Would you like to proceed?"
+ */
+[scriptable, uuid(404ebfa2-d8f4-4c94-8416-e65a55f9df5a)]
+interface nsIPromptService : nsISupports
+{
+ /**
+ * Puts up an alert dialog with an OK button.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ */
+ void alert(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText);
+ /**
+ * Like alert, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ void alertBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText);
+ /**
+ * Async version of alertBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ */
+ Promise asyncAlert(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText);
+
+ /**
+ * Puts up an alert dialog with an OK button and a labeled checkbox.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aCheckMsg
+ * Text to appear with the checkbox.
+ * @param aCheckState
+ * Contains the initial checked state of the checkbox when this method
+ * is called and the final checked state after this method returns.
+ */
+ void alertCheck(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Like alertCheck, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ void alertCheckBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Async version of alertCheckBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { checked: boolean }
+ */
+ Promise asyncAlertCheck(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aCheckMsg,
+ in boolean aCheckState);
+
+ /**
+ * Puts up a dialog with OK and Cancel buttons.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ *
+ * @return true for OK, false for Cancel
+ */
+ boolean confirm(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText);
+ /**
+ * Like confirm, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean confirmBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText);
+ /**
+ * Async version of confirmBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { ok: boolean }
+ */
+ Promise asyncConfirm(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText);
+
+ /**
+ * Puts up a dialog with OK and Cancel buttons and a labeled checkbox.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aCheckMsg
+ * Text to appear with the checkbox.
+ * @param aCheckState
+ * Contains the initial checked state of the checkbox when this method
+ * is called and the final checked state after this method returns.
+ *
+ * @return true for OK, false for Cancel
+ */
+ boolean confirmCheck(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Like confirmCheck, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean confirmCheckBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Async version of confirmCheckBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { ok: boolean, checked: boolean }
+ */
+ Promise asyncConfirmCheck(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aCheckMsg,
+ in boolean aCheckState);
+
+ /**
+ * Button Flags
+ *
+ * The following flags are combined to form the aButtonFlags parameter passed
+ * to confirmEx. See confirmEx for more information on how the flags may be
+ * combined.
+ */
+
+ /**
+ * Button Position Flags
+ */
+ const unsigned long BUTTON_POS_0 = 1;
+ const unsigned long BUTTON_POS_1 = 1 << 8;
+ const unsigned long BUTTON_POS_2 = 1 << 16;
+
+ /**
+ * Button Title Flags (used to set the labels of buttons in the prompt)
+ */
+ const unsigned long BUTTON_TITLE_OK = 1;
+ const unsigned long BUTTON_TITLE_CANCEL = 2;
+ const unsigned long BUTTON_TITLE_YES = 3;
+ const unsigned long BUTTON_TITLE_NO = 4;
+ const unsigned long BUTTON_TITLE_SAVE = 5;
+ const unsigned long BUTTON_TITLE_DONT_SAVE = 6;
+ const unsigned long BUTTON_TITLE_REVERT = 7;
+ const unsigned long BUTTON_TITLE_IS_STRING = 127;
+
+ /**
+ * Button Default Flags (used to select which button is the default one)
+ */
+ const unsigned long BUTTON_POS_0_DEFAULT = 0;
+ const unsigned long BUTTON_POS_1_DEFAULT = 1 << 24;
+ const unsigned long BUTTON_POS_2_DEFAULT = 1 << 25;
+
+ /**
+ * Causes the buttons to be initially disabled. They are enabled after a
+ * timeout expires. The implementation may interpret this loosely as the
+ * intent is to ensure that the user does not click through a security dialog
+ * too quickly. Strictly speaking, the implementation could choose to ignore
+ * this flag.
+ */
+ const unsigned long BUTTON_DELAY_ENABLE = 1 << 26;
+
+ /**
+ * Selects the standard set of OK/Cancel buttons.
+ */
+ const unsigned long STD_OK_CANCEL_BUTTONS = (BUTTON_TITLE_OK * BUTTON_POS_0) +
+ (BUTTON_TITLE_CANCEL * BUTTON_POS_1);
+
+ /**
+ * Selects the standard set of Yes/No buttons.
+ */
+ const unsigned long STD_YES_NO_BUTTONS = (BUTTON_TITLE_YES * BUTTON_POS_0) +
+ (BUTTON_TITLE_NO * BUTTON_POS_1);
+
+ // Indicates whether a prompt should be shown in-content, on tab level or as a separate window
+ const unsigned long MODAL_TYPE_CONTENT = 1;
+ const unsigned long MODAL_TYPE_TAB = 2;
+ const unsigned long MODAL_TYPE_WINDOW = 3;
+ // Like MODAL_TYPE_WINDOW, but shown inside a parent window (with similar
+ // styles as _TAB and _CONTENT types) rather than as a new window:
+ const unsigned long MODAL_TYPE_INTERNAL_WINDOW = 4;
+
+ /**
+ * Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aButtonFlags
+ * A combination of Button Flags.
+ * @param aButton0Title
+ * Used when button 0 uses TITLE_IS_STRING
+ * @param aButton1Title
+ * Used when button 1 uses TITLE_IS_STRING
+ * @param aButton2Title
+ * Used when button 2 uses TITLE_IS_STRING
+ * @param aCheckMsg
+ * Text to appear with the checkbox. Null if no checkbox.
+ * @param aCheckState
+ * Contains the initial checked state of the checkbox when this method
+ * is called and the final checked state after this method returns.
+ *
+ * @return index of the button pressed.
+ *
+ * Buttons are numbered 0 - 2. The implementation can decide whether the
+ * sequence goes from right to left or left to right. Button 0 is the
+ * default button unless one of the Button Default Flags is specified.
+ *
+ * A button may use a predefined title, specified by one of the Button Title
+ * Flags values. Each title value can be multiplied by a position value to
+ * assign the title to a particular button. If BUTTON_TITLE_IS_STRING is
+ * used for a button, the string parameter for that button will be used. If
+ * the value for a button position is zero, the button will not be shown.
+ *
+ * In general, aButtonFlags is constructed per the following example:
+ *
+ * aButtonFlags = (BUTTON_POS_0) * (BUTTON_TITLE_AAA) +
+ * (BUTTON_POS_1) * (BUTTON_TITLE_BBB) +
+ * BUTTON_POS_1_DEFAULT;
+ *
+ * where "AAA" and "BBB" correspond to one of the button titles.
+ */
+ int32_t confirmEx(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in unsigned long aButtonFlags,
+ in wstring aButton0Title,
+ in wstring aButton1Title,
+ in wstring aButton2Title,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Like confirmEx, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ int32_t confirmExBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in unsigned long aButtonFlags,
+ in wstring aButton0Title,
+ in wstring aButton1Title,
+ in wstring aButton2Title,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Async version of confirmExBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { checked: boolean, buttonNumClicked: int }
+ */
+ Promise asyncConfirmEx(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in unsigned long aButtonFlags,
+ in wstring aButton0Title,
+ in wstring aButton1Title,
+ in wstring aButton2Title,
+ in wstring aCheckMsg,
+ in boolean aCheckState,
+ [optional] in jsval aExtraArgs);
+ /**
+ * Puts up a dialog with an edit field and an optional, labeled checkbox.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aValue
+ * Contains the default value for the dialog field when this method
+ * is called (null value is ok). Upon return, if the user pressed
+ * OK, then this parameter contains a newly allocated string value.
+ * Otherwise, the parameter's value is unmodified.
+ * @param aCheckMsg
+ * Text to appear with the checkbox. If null, check box will not be shown.
+ * @param aCheckState
+ * Contains the initial checked state of the checkbox when this method
+ * is called and the final checked state after this method returns.
+ *
+ * @return true for OK, false for Cancel.
+ */
+ boolean prompt(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ inout wstring aValue,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Like prompt, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean promptBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ inout wstring aValue,
+ in wstring aCheckMsg,
+ inout boolean aCheckState);
+ /**
+ * Async version of promptBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { checked: boolean, value: string, ok: boolean }
+ */
+ Promise asyncPrompt(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aValue,
+ in wstring aCheckMsg,
+ in boolean aCheckState);
+
+ /**
+ * Puts up a dialog with an edit field and a password field.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aUsername
+ * Contains the default value for the username field when this method
+ * is called (null value is ok). Upon return, if the user pressed OK,
+ * then this parameter contains a newly allocated string value.
+ * Otherwise, the parameter's value is unmodified.
+ * @param aPassword
+ * Contains the default value for the password field when this method
+ * is called (null value is ok). Upon return, if the user pressed OK,
+ * then this parameter contains a newly allocated string value.
+ * Otherwise, the parameter's value is unmodified.
+ *
+ * @return true for OK, false for Cancel.
+ */
+ boolean promptUsernameAndPassword(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ inout wstring aUsername,
+ inout wstring aPassword);
+ /**
+ * Like promptUsernameAndPassword, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean promptUsernameAndPasswordBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ inout wstring aUsername,
+ inout wstring aPassword);
+ /**
+ * Async version of promptUsernameAndPasswordBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { user: string, pass: string, ok: boolean }
+ */
+ Promise asyncPromptUsernameAndPassword(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aUsername,
+ in wstring aPassword);
+
+ /**
+ * Puts up a dialog with a password field.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aPassword
+ * Contains the default value for the password field when this method
+ * is called (null value is ok). Upon return, if the user pressed OK,
+ * then this parameter contains a newly allocated string value.
+ * Otherwise, the parameter's value is unmodified.
+ *
+ * @return true for OK, false for Cancel.
+ */
+ boolean promptPassword(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ inout wstring aPassword);
+ /**
+ * Like promptPassword, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean promptPasswordBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ inout wstring aPassword);
+ /**
+ * Async version of promptPasswordBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { pass: string, ok: boolean }
+ */
+ Promise asyncPromptPassword(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in wstring aPassword);
+ /**
+ * Puts up a dialog box which has a list box of strings from which the user
+ * may make a single selection.
+ *
+ * @param aParent
+ * The parent window or null.
+ * @param aDialogTitle
+ * Text to appear in the title of the dialog.
+ * @param aText
+ * Text to appear in the body of the dialog.
+ * @param aSelectList
+ * The list of strings to display.
+ * @param aOutSelection
+ * Contains the index of the selected item in the list when this
+ * method returns true.
+ *
+ * @return true for OK, false for Cancel.
+ */
+ boolean select(in mozIDOMWindowProxy aParent,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in Array<AString> aSelectList,
+ out long aOutSelection);
+ /**
+ * Like select, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean selectBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in Array<AString> aSelectList,
+ out long aOutSelection);
+ /**
+ * Async version of selectBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { selected: int, ok: boolean }
+ */
+ Promise asyncSelect(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in wstring aDialogTitle,
+ in wstring aText,
+ in Array<AString> aSelectList);
+
+ // NOTE: These functions differ from their nsIAuthPrompt counterparts by
+ // having additional checkbox parameters
+ //
+ // See nsIAuthPrompt2 for documentation on the semantics of the other
+ // parameters.
+ boolean promptAuth(in mozIDOMWindowProxy aParent,
+ in nsIChannel aChannel,
+ in uint32_t level,
+ in nsIAuthInformation authInfo);
+ /**
+ * Like promptAuth, but with a BrowsingContext as parent.
+ *
+ * @param aBrowsingContext
+ * The browsing context the prompt should be opened for.
+ * @param modalType
+ * Whether the prompt should be window, tab or content modal.
+ */
+ boolean promptAuthBC(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in nsIChannel aChannel,
+ in uint32_t level,
+ in nsIAuthInformation authInfo);
+ /**
+ * Async version of promptAuthBC
+ *
+ * @return A promise which resolves when the prompt is dismissed.
+ *
+ * @resolves nsIPropertyBag { ok: boolean }
+ */
+ Promise asyncPromptAuth(in BrowsingContext aBrowsingContext,
+ in unsigned long modalType,
+ in nsIChannel aChannel,
+ in uint32_t level,
+ in nsIAuthInformation authInfo);
+};