michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIPrompt; michael@0: michael@0: [scriptable, uuid(358089f9-ee4b-4711-82fd-bcd07fc62061)] michael@0: interface nsIAuthPrompt : nsISupports michael@0: { michael@0: const uint32_t SAVE_PASSWORD_NEVER = 0; michael@0: const uint32_t SAVE_PASSWORD_FOR_SESSION = 1; michael@0: const uint32_t SAVE_PASSWORD_PERMANENTLY = 2; michael@0: michael@0: /** michael@0: * Puts up a text input dialog with OK and Cancel buttons. michael@0: * Note: prompt uses separate args for the "in" and "out" values of the michael@0: * input field, whereas the other functions use a single inout arg. michael@0: * @param dialogText The title for the dialog. michael@0: * @param text The text to display in the dialog. michael@0: * @param passwordRealm The "realm" the password belongs to: e.g. michael@0: * ldap://localhost/dc=test michael@0: * @param savePassword One of the SAVE_PASSWORD_* options above. michael@0: * @param defaultText The default text to display in the text input box. michael@0: * @param result The value entered by the user if OK was michael@0: * selected. michael@0: * @return true for OK, false for Cancel michael@0: */ michael@0: boolean prompt(in wstring dialogTitle, michael@0: in wstring text, michael@0: in wstring passwordRealm, michael@0: in uint32_t savePassword, michael@0: in wstring defaultText, michael@0: out wstring result); michael@0: michael@0: /** michael@0: * Puts up a username/password dialog with OK and Cancel buttons. michael@0: * Puts up a password dialog with OK and Cancel buttons. michael@0: * @param dialogText The title for the dialog. michael@0: * @param text The text to display in the dialog. michael@0: * @param passwordRealm The "realm" the password belongs to: e.g. michael@0: * ldap://localhost/dc=test michael@0: * @param savePassword One of the SAVE_PASSWORD_* options above. michael@0: * @param user The username entered in the dialog. michael@0: * @param pwd The password entered by the user if OK was michael@0: * selected. michael@0: * @return true for OK, false for Cancel michael@0: */ michael@0: boolean promptUsernameAndPassword(in wstring dialogTitle, michael@0: in wstring text, michael@0: in wstring passwordRealm, michael@0: in uint32_t savePassword, michael@0: inout wstring user, michael@0: inout wstring pwd); michael@0: michael@0: /** michael@0: * Puts up a password dialog with OK and Cancel buttons. michael@0: * @param dialogText The title for the dialog. michael@0: * @param text The text to display in the dialog. michael@0: * @param passwordRealm The "realm" the password belongs to: e.g. michael@0: * ldap://localhost/dc=test. If a username is michael@0: * specified (http://user@site.com) it will be used michael@0: * when matching existing logins or saving new ones. michael@0: * If no username is specified, only password-only michael@0: * logins will be matched or saved. michael@0: * Note: if a username is specified, the username michael@0: * should be escaped. michael@0: * @param savePassword One of the SAVE_PASSWORD_* options above. michael@0: * @param pwd The password entered by the user if OK was michael@0: * selected. michael@0: * @return true for OK, false for Cancel michael@0: */ michael@0: boolean promptPassword(in wstring dialogTitle, michael@0: in wstring text, michael@0: in wstring passwordRealm, michael@0: in uint32_t savePassword, michael@0: inout wstring pwd); michael@0: };