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