toolkit/components/passwordmgr/nsILoginManager.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIURI;
michael@0 9 interface nsILoginInfo;
michael@0 10 interface nsIAutoCompleteResult;
michael@0 11 interface nsIDOMHTMLInputElement;
michael@0 12 interface nsIDOMHTMLFormElement;
michael@0 13 interface nsIPropertyBag;
michael@0 14
michael@0 15 [scriptable, uuid(338c8597-1e32-4682-b5c7-cf8142c0bd1d)]
michael@0 16
michael@0 17 interface nsILoginManager : nsISupports {
michael@0 18
michael@0 19 /**
michael@0 20 * Store a new login in the login manager.
michael@0 21 *
michael@0 22 * @param aLogin
michael@0 23 * The login to be added.
michael@0 24 *
michael@0 25 * Default values for the login's nsILoginMetaInfo properties will be
michael@0 26 * created. However, if the caller specifies non-default values, they will
michael@0 27 * be used instead.
michael@0 28 */
michael@0 29 void addLogin(in nsILoginInfo aLogin);
michael@0 30
michael@0 31
michael@0 32 /**
michael@0 33 * Remove a login from the login manager.
michael@0 34 *
michael@0 35 * @param aLogin
michael@0 36 * The login to be removed.
michael@0 37 *
michael@0 38 * The specified login must exactly match a stored login. However, the
michael@0 39 * values of any nsILoginMetaInfo properties are ignored.
michael@0 40 */
michael@0 41 void removeLogin(in nsILoginInfo aLogin);
michael@0 42
michael@0 43
michael@0 44 /**
michael@0 45 * Modify an existing login in the login manager.
michael@0 46 *
michael@0 47 * @param oldLogin
michael@0 48 * The login to be modified.
michael@0 49 * @param newLoginData
michael@0 50 * The new login values (either a nsILoginInfo or nsIProperyBag)
michael@0 51 *
michael@0 52 * If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
michael@0 53 * properties are changed to the values from newLoginData (but the old
michael@0 54 * login's nsILoginMetaInfo properties are unmodified).
michael@0 55 *
michael@0 56 * If newLoginData is a nsIPropertyBag, only the specified properties
michael@0 57 * will be changed. The nsILoginMetaInfo properties of oldLogin can be
michael@0 58 * changed in this manner.
michael@0 59 *
michael@0 60 * If the propertybag contains an item named "timesUsedIncrement", the
michael@0 61 * login's timesUsed property will be incremented by the item's value.
michael@0 62 */
michael@0 63 void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
michael@0 64
michael@0 65
michael@0 66 /**
michael@0 67 * Remove all logins known to login manager.
michael@0 68 *
michael@0 69 * The browser sanitization feature allows the user to clear any stored
michael@0 70 * passwords. This interface allows that to be done without getting each
michael@0 71 * login first (which might require knowing the master password).
michael@0 72 *
michael@0 73 */
michael@0 74 void removeAllLogins();
michael@0 75
michael@0 76
michael@0 77 /**
michael@0 78 * Fetch all logins in the login manager. An array is always returned;
michael@0 79 * if there are no logins the array is empty.
michael@0 80 *
michael@0 81 * @param count
michael@0 82 * The number of elements in the array. JS callers can simply use
michael@0 83 * the array's .length property and omit this param.
michael@0 84 * @param logins
michael@0 85 * An array of nsILoginInfo objects.
michael@0 86 *
michael@0 87 * NOTE: This can be called from JS as:
michael@0 88 * var logins = pwmgr.getAllLogins();
michael@0 89 * (|logins| is an array).
michael@0 90 */
michael@0 91 void getAllLogins([optional] out unsigned long count,
michael@0 92 [retval, array, size_is(count)] out nsILoginInfo logins);
michael@0 93
michael@0 94
michael@0 95 /**
michael@0 96 * Obtain a list of all hosts for which password saving is disabled.
michael@0 97 *
michael@0 98 * @param count
michael@0 99 * The number of elements in the array. JS callers can simply use
michael@0 100 * the array's .length property and omit this param.
michael@0 101 * @param hostnames
michael@0 102 * An array of hostname strings, in origin URL format without a
michael@0 103 * pathname. For example: "https://www.site.com".
michael@0 104 *
michael@0 105 * NOTE: This can be called from JS as:
michael@0 106 * var logins = pwmgr.getDisabledAllLogins();
michael@0 107 */
michael@0 108 void getAllDisabledHosts([optional] out unsigned long count,
michael@0 109 [retval, array, size_is(count)] out wstring hostnames);
michael@0 110
michael@0 111
michael@0 112 /**
michael@0 113 * Check to see if saving logins has been disabled for a host.
michael@0 114 *
michael@0 115 * @param aHost
michael@0 116 * The hostname to check. This argument should be in the origin
michael@0 117 * URL format, without a pathname. For example: "http://foo.com".
michael@0 118 */
michael@0 119 boolean getLoginSavingEnabled(in AString aHost);
michael@0 120
michael@0 121
michael@0 122 /**
michael@0 123 * Disable (or enable) storing logins for the specified host. When
michael@0 124 * disabled, the login manager will not prompt to store logins for
michael@0 125 * that host. Existing logins are not affected.
michael@0 126 *
michael@0 127 * @param aHost
michael@0 128 * The hostname to set. This argument should be in the origin
michael@0 129 * URL format, without a pathname. For example: "http://foo.com".
michael@0 130 * @param isEnabled
michael@0 131 * Specify if saving logins should be enabled (true) or
michael@0 132 * disabled (false)
michael@0 133 */
michael@0 134 void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
michael@0 135
michael@0 136
michael@0 137 /**
michael@0 138 * Search for logins matching the specified criteria. Called when looking
michael@0 139 * for logins that might be applicable to a form or authentication request.
michael@0 140 *
michael@0 141 * @param count
michael@0 142 * The number of elements in the array. JS callers can simply use
michael@0 143 * the array's .length property, and supply an dummy object for
michael@0 144 * this out param. For example: |findLogins({}, hostname, ...)|
michael@0 145 * @param aHostname
michael@0 146 * The hostname to restrict searches to, in URL format. For
michael@0 147 * example: "http://www.site.com".
michael@0 148 * To find logins for a given nsIURI, you would typically pass in
michael@0 149 * its prePath.
michael@0 150 * @param aActionURL
michael@0 151 * For form logins, this argument should be the URL to which the
michael@0 152 * form will be submitted. For protocol logins, specify null.
michael@0 153 * An empty string ("") will match any value (except null).
michael@0 154 * @param aHttpRealm
michael@0 155 * For protocol logins, this argument should be the HTTP Realm
michael@0 156 * for which the login applies. This is obtained from the
michael@0 157 * WWW-Authenticate header. See RFC2617. For form logins,
michael@0 158 * specify null.
michael@0 159 * An empty string ("") will match any value (except null).
michael@0 160 * @param logins
michael@0 161 * An array of nsILoginInfo objects.
michael@0 162 *
michael@0 163 * NOTE: This can be called from JS as:
michael@0 164 * var logins = pwmgr.findLogins({}, hostname, ...);
michael@0 165 *
michael@0 166 */
michael@0 167 void findLogins(out unsigned long count, in AString aHostname,
michael@0 168 in AString aActionURL, in AString aHttpRealm,
michael@0 169 [retval, array, size_is(count)] out nsILoginInfo logins);
michael@0 170
michael@0 171
michael@0 172 /**
michael@0 173 * Search for logins matching the specified criteria, as with
michael@0 174 * findLogins(). This interface only returns the number of matching
michael@0 175 * logins (and not the logins themselves), which allows a caller to
michael@0 176 * check for logins without causing the user to be prompted for a master
michael@0 177 * password to decrypt the logins.
michael@0 178 *
michael@0 179 * @param aHostname
michael@0 180 * The hostname to restrict searches to. Specify an empty string
michael@0 181 * to match all hosts. A null value will not match any logins, and
michael@0 182 * will thus always return a count of 0.
michael@0 183 * @param aActionURL
michael@0 184 * The URL to which a form login will be submitted. To match any
michael@0 185 * form login, specify an empty string. To not match any form
michael@0 186 * login, specify null.
michael@0 187 * @param aHttpRealm
michael@0 188 * The HTTP Realm for which the login applies. To match logins for
michael@0 189 * any realm, specify an empty string. To not match logins for any
michael@0 190 * realm, specify null.
michael@0 191 */
michael@0 192 unsigned long countLogins(in AString aHostname, in AString aActionURL,
michael@0 193 in AString aHttpRealm);
michael@0 194
michael@0 195
michael@0 196 /**
michael@0 197 * Generate results for a userfield autocomplete menu.
michael@0 198 *
michael@0 199 * NOTE: This interface is provided for use only by the FormFillController,
michael@0 200 * which calls it directly. This isn't really ideal, it should
michael@0 201 * probably be callback registered through the FFC.
michael@0 202 */
michael@0 203 nsIAutoCompleteResult autoCompleteSearch(in AString aSearchString,
michael@0 204 in nsIAutoCompleteResult aPreviousResult,
michael@0 205 in nsIDOMHTMLInputElement aElement);
michael@0 206
michael@0 207 /**
michael@0 208 * Fill a form with login information if we have it. This method will fill
michael@0 209 * aForm regardless of the signon.autofillForms preference.
michael@0 210 *
michael@0 211 * @param aForm
michael@0 212 * The form to fill
michael@0 213 * @return Success of attempt fill form
michael@0 214 */
michael@0 215 boolean fillForm(in nsIDOMHTMLFormElement aForm);
michael@0 216
michael@0 217 /**
michael@0 218 * Search for logins in the login manager. An array is always returned;
michael@0 219 * if there are no logins the array is empty.
michael@0 220 *
michael@0 221 * @param count
michael@0 222 * The number of elements in the array. JS callers can simply use
michael@0 223 * the array's .length property, and supply an dummy object for
michael@0 224 * this out param. For example: |searchLogins({}, matchData)|
michael@0 225 * @param matchData
michael@0 226 * The data used to search. This does not follow the same
michael@0 227 * requirements as findLogins for those fields. Wildcard matches are
michael@0 228 * simply not specified.
michael@0 229 * @param logins
michael@0 230 * An array of nsILoginInfo objects.
michael@0 231 *
michael@0 232 * NOTE: This can be called from JS as:
michael@0 233 * var logins = pwmgr.searchLogins({}, matchData);
michael@0 234 * (|logins| is an array).
michael@0 235 */
michael@0 236 void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
michael@0 237 [retval, array, size_is(count)] out nsILoginInfo logins);
michael@0 238
michael@0 239 /**
michael@0 240 * True when a master password prompt is being displayed.
michael@0 241 */
michael@0 242 readonly attribute boolean uiBusy;
michael@0 243
michael@0 244 /**
michael@0 245 * True when the master password has already been entered, and so a caller
michael@0 246 * can ask for decrypted logins without triggering a prompt.
michael@0 247 */
michael@0 248 readonly attribute boolean isLoggedIn;
michael@0 249 };
michael@0 250
michael@0 251 %{C++
michael@0 252
michael@0 253 #define NS_LOGINMANAGER_CONTRACTID "@mozilla.org/login-manager;1"
michael@0 254
michael@0 255 %}

mercurial