nsIAuthPrompt.idl (6142B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "nsISupports.idl" 7 8 interface nsIPrompt; 9 10 [scriptable, uuid(358089f9-ee4b-4711-82fd-bcd07fc62061)] 11 interface nsIAuthPrompt : nsISupports 12 { 13 const uint32_t SAVE_PASSWORD_NEVER = 0; 14 const uint32_t SAVE_PASSWORD_FOR_SESSION = 1; 15 const uint32_t SAVE_PASSWORD_PERMANENTLY = 2; 16 17 /** 18 * Puts up a text input dialog with OK and Cancel buttons. 19 * Note: prompt uses separate args for the "in" and "out" values of the 20 * input field, whereas the other functions use a single inout arg. 21 * @param dialogText The title for the dialog. 22 * @param text The text to display in the dialog. 23 * @param passwordRealm The "realm" the password belongs to: e.g. 24 * ldap://localhost/dc=test 25 * @param savePassword One of the SAVE_PASSWORD_* options above. 26 * @param defaultText The default text to display in the text input box. 27 * @param result The value entered by the user if OK was 28 * selected. 29 * @return true for OK, false for Cancel 30 */ 31 boolean prompt(in wstring dialogTitle, 32 in wstring text, 33 in wstring passwordRealm, 34 in uint32_t savePassword, 35 in wstring defaultText, 36 out wstring result); 37 38 /** 39 * Puts up a username/password dialog with OK and Cancel buttons. 40 * @param dialogText The title for the dialog. 41 * @param text The text to display in the dialog. 42 * @param passwordRealm The "realm" the password belongs to: e.g. 43 * ldap://localhost/dc=test 44 * @param savePassword One of the SAVE_PASSWORD_* options above. 45 * @param user The username entered in the dialog. 46 * @param pwd The password entered by the user if OK was 47 * selected. 48 * @return true for OK, false for Cancel 49 */ 50 boolean promptUsernameAndPassword(in wstring dialogTitle, 51 in wstring text, 52 in wstring passwordRealm, 53 in uint32_t savePassword, 54 inout wstring user, 55 inout wstring pwd); 56 57 /** 58 * Puts up an async username/password dialog with OK and Cancel buttons. 59 * @param dialogText The title for the dialog. 60 * @param text The text to display in the dialog. 61 * @param passwordRealm The "realm" the password belongs to: e.g. 62 * ldap://localhost/dc=test 63 * @param savePassword One of the SAVE_PASSWORD_* options above. 64 * @param user The username entered in the dialog. 65 * @param pwd The password entered by the user if OK was 66 * selected. 67 * @return promise resolving to true for OK, false for Cancel 68 */ 69 Promise asyncPromptUsernameAndPassword(in wstring dialogTitle, 70 in wstring text, 71 in wstring passwordRealm, 72 in uint32_t savePassword, 73 inout wstring user, 74 inout wstring pwd); 75 76 /** 77 * Puts up a password dialog with OK and Cancel buttons. 78 * @param dialogText The title for the dialog. 79 * @param text The text to display in the dialog. 80 * @param passwordRealm The "realm" the password belongs to: e.g. 81 * ldap://localhost/dc=test. If a username is 82 * specified (http://user@site.com) it will be used 83 * when matching existing logins or saving new ones. 84 * If no username is specified, only password-only 85 * logins will be matched or saved. 86 * Note: if a username is specified, the username 87 * should be escaped. 88 * @param savePassword One of the SAVE_PASSWORD_* options above. 89 * @param pwd The password entered by the user if OK was 90 * selected. 91 * @return true for OK, false for Cancel 92 */ 93 boolean promptPassword(in wstring dialogTitle, 94 in wstring text, 95 in wstring passwordRealm, 96 in uint32_t savePassword, 97 inout wstring pwd); 98 99 /** 100 * Puts up an async password dialog with OK and Cancel buttons. 101 * @param dialogText The title for the dialog. 102 * @param text The text to display in the dialog. 103 * @param passwordRealm The "realm" the password belongs to: e.g. 104 * ldap://localhost/dc=test. If a username is 105 * specified (http://user@site.com) it will be used 106 * when matching existing logins or saving new ones. 107 * If no username is specified, only password-only 108 * logins will be matched or saved. 109 * Note: if a username is specified, the username 110 * should be escaped. 111 * @param savePassword One of the SAVE_PASSWORD_* options above. 112 * @param pwd The password entered by the user if OK was 113 * selected. 114 * @return promise resolving to true for OK, false for Cancel 115 */ 116 Promise asyncPromptPassword(in wstring dialogTitle, 117 in wstring text, 118 in wstring passwordRealm, 119 in uint32_t savePassword, 120 inout wstring pwd); 121 };