nsIAuthPrompt.idl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #include "nsISupports.idl"
  6. interface nsIPrompt;
  7. [scriptable, uuid(358089f9-ee4b-4711-82fd-bcd07fc62061)]
  8. interface nsIAuthPrompt : nsISupports
  9. {
  10. const uint32_t SAVE_PASSWORD_NEVER = 0;
  11. const uint32_t SAVE_PASSWORD_FOR_SESSION = 1;
  12. const uint32_t SAVE_PASSWORD_PERMANENTLY = 2;
  13. /**
  14. * Puts up a text input dialog with OK and Cancel buttons.
  15. * Note: prompt uses separate args for the "in" and "out" values of the
  16. * input field, whereas the other functions use a single inout arg.
  17. * @param dialogText The title for the dialog.
  18. * @param text The text to display in the dialog.
  19. * @param passwordRealm The "realm" the password belongs to: e.g.
  20. * ldap://localhost/dc=test
  21. * @param savePassword One of the SAVE_PASSWORD_* options above.
  22. * @param defaultText The default text to display in the text input box.
  23. * @param result The value entered by the user if OK was
  24. * selected.
  25. * @return true for OK, false for Cancel
  26. */
  27. boolean prompt(in wstring dialogTitle,
  28. in wstring text,
  29. in wstring passwordRealm,
  30. in uint32_t savePassword,
  31. in wstring defaultText,
  32. out wstring result);
  33. /**
  34. * Puts up a username/password dialog with OK and Cancel buttons.
  35. * Puts up a password dialog with OK and Cancel buttons.
  36. * @param dialogText The title for the dialog.
  37. * @param text The text to display in the dialog.
  38. * @param passwordRealm The "realm" the password belongs to: e.g.
  39. * ldap://localhost/dc=test
  40. * @param savePassword One of the SAVE_PASSWORD_* options above.
  41. * @param user The username entered in the dialog.
  42. * @param pwd The password entered by the user if OK was
  43. * selected.
  44. * @return true for OK, false for Cancel
  45. */
  46. boolean promptUsernameAndPassword(in wstring dialogTitle,
  47. in wstring text,
  48. in wstring passwordRealm,
  49. in uint32_t savePassword,
  50. inout wstring user,
  51. inout wstring pwd);
  52. /**
  53. * Puts up a password dialog with OK and Cancel buttons.
  54. * @param dialogText The title for the dialog.
  55. * @param text The text to display in the dialog.
  56. * @param passwordRealm The "realm" the password belongs to: e.g.
  57. * ldap://localhost/dc=test. If a username is
  58. * specified (http://user@site.com) it will be used
  59. * when matching existing logins or saving new ones.
  60. * If no username is specified, only password-only
  61. * logins will be matched or saved.
  62. * Note: if a username is specified, the username
  63. * should be escaped.
  64. * @param savePassword One of the SAVE_PASSWORD_* options above.
  65. * @param pwd The password entered by the user if OK was
  66. * selected.
  67. * @return true for OK, false for Cancel
  68. */
  69. boolean promptPassword(in wstring dialogTitle,
  70. in wstring text,
  71. in wstring passwordRealm,
  72. in uint32_t savePassword,
  73. inout wstring pwd);
  74. };