1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Use the <code>chrome.passwordsPrivate</code> API to add or remove password
6 // data from the settings UI.
7 namespace passwordsPrivate
{
8 // Pair of origin URL and login saved for that URL.
10 // The human-readable origin for the URL where the password is used.
13 // The username used in conjunction with the saved password.
17 // Entry used to display a password in the settings UI.
18 dictionary PasswordUiEntry
{
19 // The login information for this entry.
22 // The number of characters in the password; used to display placeholder
24 long numCharactersInPassword
;
26 // Text shown if the password was obtained via a federated identity.
27 DOMString? federationText
;
30 // Dictionary passed to listeners for the onPlaintextPasswordRetrieved event.
31 dictionary PlaintextPasswordEventParameters
{
32 // The LoginPair associated with the retrieved password.
35 // The password in plaintext.
36 DOMString plaintextPassword
;
39 callback CanAccountBeManagedCallback
= void(boolean canAccountBeManaged
);
42 // Determines whether account's passwords can be managed via
43 // https://passwords.google.com/settings/passwords.
45 // |callback|: Callback which will be passed the boolean of whether the
46 // account can be managed.
47 static
void canPasswordAccountBeManaged
(
48 CanAccountBeManagedCallback
callback);
50 // Removes the saved password corresponding to |loginPair|. If no saved
51 // password for this pair exists, this function is a no-op.
53 // |loginPair|: The LoginPair corresponding to the entry to remove.
54 static
void removeSavedPassword
(LoginPair loginPair
);
56 // Removes the saved password exception corresponding to |exceptionUrl|. If
57 // no exception with this URL exists, this function is a no-op.
59 // |exceptionUrl|: The URL corresponding to the exception to remove.
60 static
void removePasswordException
(DOMString exceptionUrl
);
62 // Returns the plaintext password corresponding to |loginPair|. Note that on
63 // some operating systems, this call may result in an OS-level
64 // reauthentication. Once the password has been fetched, it will be returned
65 // via the onPlaintextPasswordRetrieved event.
67 // |loginPair|: The LoginPair corresponding to the entry whose password
69 static
void requestPlaintextPassword
(LoginPair loginPair
);
73 // Fired when the saved passwords list has changed, meaning that an entry
74 // has been added or removed. Note that this event fires as soon as a
77 // |entries|: The updated list of password entries.
78 static
void onSavedPasswordsListChanged
(PasswordUiEntry
[] entries
);
80 // Fired when the password exceptions list has changed, meaning that an
81 // entry has been added or removed. Note that this event fires as soon as a
84 // |exceptions|: The updated list of password exceptions.
85 static
void onPasswordExceptionsListChanged
(DOMString
[] exceptions
);
87 // Fired when a plaintext password has been fetched in response to a call to
88 // chrome.passwordsPrivate.requestPlaintextPassword().
90 // |loginPair|: The LoginPair whose password was found.
91 // |plaintextPassword|: The plaintext password which was retrieved.
92 static
void onPlaintextPasswordRetrieved
(
93 PlaintextPasswordEventParameters dict
);