Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
6
#include "nsISupports.idl"
7
8
interface nsILoginInfo;
9
interface nsIDOMWindow;
10
11
webidl Element;
12
13
[scriptable, uuid(425f73b9-b2db-4e8a-88c5-9ac2512934ce)]
14
interface nsILoginManagerPrompter : nsISupports {
15
/**
16
* Initialize the prompter. Must be called before using other interfaces.
17
*
18
* @param aWindow
19
* The window in which the user is doing some login-related action that's
20
* resulting in a need to prompt them for something. The prompt
21
* will be associated with this window (or, if a notification bar
22
* is being used, topmost opener in some cases).
23
*
24
* aWindow can be null if there is no associated window, e.g. in a JSM
25
* or Sandbox. In this case there will be no checkbox to save the login
26
* since the window is needed to know if this is a private context.
27
*
28
* If this window is a content window, the corresponding window and browser
29
* elements will be calculated. If this window is a chrome window, the
30
* corresponding browser element needs to be set using setBrowser.
31
*/
32
void init(in nsIDOMWindow aWindow);
33
34
/**
35
* The browser this prompter is being created for.
36
* This is required if the init function received a chrome window as argument.
37
*/
38
attribute Element browser;
39
40
/**
41
* The opener browser that was used to open the window passed to init.
42
* The opener can be used to determine in which window the prompt
43
* should be shown.
44
*/
45
attribute Element openerBrowser;
46
47
/**
48
* Ask the user if they want to save a login (Yes, Never, Not Now)
49
*
50
* @param aLogin
51
* The login to be saved.
52
* @param dismissed
53
* A boolean value indicating whether the save logins doorhanger should
54
* be dismissed automatically when shown.
55
* @param notifySaved
56
* A boolean value indicating whether the notification should indicate that
57
* a login has been saved
58
*/
59
void promptToSavePassword(in nsILoginInfo aLogin,
60
[optional] in boolean dismissed,
61
[optional] in boolean notifySaved);
62
63
/**
64
* Ask the user if they want to change a login's password or username.
65
* If the user consents, modifyLogin() will be called.
66
*
67
* @param aOldLogin
68
* The existing login (with the old password).
69
* @param aNewLogin
70
* The new login.
71
* @param dismissed
72
* A boolean value indicating whether the save logins doorhanger should
73
* be dismissed automatically when shown.
74
* @param autoSavedLoginGuid
75
* A string guid value for the old login to be removed if the changes
76
* match it to a different login
77
*/
78
void promptToChangePassword(in nsILoginInfo aOldLogin,
79
in nsILoginInfo aNewLogin,
80
[optional] in boolean dismissed,
81
[optional] in boolean notifySaved,
82
[optional] in AString autoSavedLoginGuid);
83
84
/**
85
* Ask the user if they want to change the password for one of
86
* multiple logins, when the caller can't determine exactly which
87
* login should be changed. If the user consents, modifyLogin() will
88
* be called.
89
*
90
* @param logins
91
* An array of existing logins.
92
* @param aNewLogin
93
* The new login.
94
*
95
* Note: Because the caller does not know the username of the login
96
* to be changed, aNewLogin.username and aNewLogin.usernameField
97
* will be set (using the user's selection) before modifyLogin()
98
* is called.
99
*/
100
void promptToChangePasswordWithUsernames(
101
in Array<nsILoginInfo> logins,
102
in nsILoginInfo aNewLogin);
103
};
104
%{C++
105
106
#define NS_LOGINMANAGERPROMPTER_CONTRACTID "@mozilla.org/login-manager/prompter/;1"
107
108
%}