Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIPrompt; |
michael@0 | 9 | |
michael@0 | 10 | [scriptable, uuid(358089f9-ee4b-4711-82fd-bcd07fc62061)] |
michael@0 | 11 | interface nsIAuthPrompt : nsISupports |
michael@0 | 12 | { |
michael@0 | 13 | const uint32_t SAVE_PASSWORD_NEVER = 0; |
michael@0 | 14 | const uint32_t SAVE_PASSWORD_FOR_SESSION = 1; |
michael@0 | 15 | const uint32_t SAVE_PASSWORD_PERMANENTLY = 2; |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * Puts up a text input dialog with OK and Cancel buttons. |
michael@0 | 19 | * Note: prompt uses separate args for the "in" and "out" values of the |
michael@0 | 20 | * input field, whereas the other functions use a single inout arg. |
michael@0 | 21 | * @param dialogText The title for the dialog. |
michael@0 | 22 | * @param text The text to display in the dialog. |
michael@0 | 23 | * @param passwordRealm The "realm" the password belongs to: e.g. |
michael@0 | 24 | * ldap://localhost/dc=test |
michael@0 | 25 | * @param savePassword One of the SAVE_PASSWORD_* options above. |
michael@0 | 26 | * @param defaultText The default text to display in the text input box. |
michael@0 | 27 | * @param result The value entered by the user if OK was |
michael@0 | 28 | * selected. |
michael@0 | 29 | * @return true for OK, false for Cancel |
michael@0 | 30 | */ |
michael@0 | 31 | boolean prompt(in wstring dialogTitle, |
michael@0 | 32 | in wstring text, |
michael@0 | 33 | in wstring passwordRealm, |
michael@0 | 34 | in uint32_t savePassword, |
michael@0 | 35 | in wstring defaultText, |
michael@0 | 36 | out wstring result); |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Puts up a username/password dialog with OK and Cancel buttons. |
michael@0 | 40 | * Puts up a password dialog with OK and Cancel buttons. |
michael@0 | 41 | * @param dialogText The title for the dialog. |
michael@0 | 42 | * @param text The text to display in the dialog. |
michael@0 | 43 | * @param passwordRealm The "realm" the password belongs to: e.g. |
michael@0 | 44 | * ldap://localhost/dc=test |
michael@0 | 45 | * @param savePassword One of the SAVE_PASSWORD_* options above. |
michael@0 | 46 | * @param user The username entered in the dialog. |
michael@0 | 47 | * @param pwd The password entered by the user if OK was |
michael@0 | 48 | * selected. |
michael@0 | 49 | * @return true for OK, false for Cancel |
michael@0 | 50 | */ |
michael@0 | 51 | boolean promptUsernameAndPassword(in wstring dialogTitle, |
michael@0 | 52 | in wstring text, |
michael@0 | 53 | in wstring passwordRealm, |
michael@0 | 54 | in uint32_t savePassword, |
michael@0 | 55 | inout wstring user, |
michael@0 | 56 | inout wstring pwd); |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * Puts up a password dialog with OK and Cancel buttons. |
michael@0 | 60 | * @param dialogText The title for the dialog. |
michael@0 | 61 | * @param text The text to display in the dialog. |
michael@0 | 62 | * @param passwordRealm The "realm" the password belongs to: e.g. |
michael@0 | 63 | * ldap://localhost/dc=test. If a username is |
michael@0 | 64 | * specified (http://user@site.com) it will be used |
michael@0 | 65 | * when matching existing logins or saving new ones. |
michael@0 | 66 | * If no username is specified, only password-only |
michael@0 | 67 | * logins will be matched or saved. |
michael@0 | 68 | * Note: if a username is specified, the username |
michael@0 | 69 | * should be escaped. |
michael@0 | 70 | * @param savePassword One of the SAVE_PASSWORD_* options above. |
michael@0 | 71 | * @param pwd The password entered by the user if OK was |
michael@0 | 72 | * selected. |
michael@0 | 73 | * @return true for OK, false for Cancel |
michael@0 | 74 | */ |
michael@0 | 75 | boolean promptPassword(in wstring dialogTitle, |
michael@0 | 76 | in wstring text, |
michael@0 | 77 | in wstring passwordRealm, |
michael@0 | 78 | in uint32_t savePassword, |
michael@0 | 79 | inout wstring pwd); |
michael@0 | 80 | }; |