OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options.passwordManager', function() { | 5 cr.define('options.passwordManager', function() { |
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
7 /** @const */ var DeletableItemList = options.DeletableItemList; | 7 /** @const */ var DeletableItemList = options.DeletableItemList; |
8 /** @const */ var DeletableItem = options.DeletableItem; | 8 /** @const */ var DeletableItem = options.DeletableItem; |
9 /** @const */ var List = cr.ui.List; | 9 /** @const */ var List = cr.ui.List; |
10 | 10 |
11 /** | 11 /** |
12 * Creates a new passwords list item. | 12 * Creates a new passwords list item. |
13 * @param {cr.ui.ArrayDataModel} dataModel The data model that contains this | 13 * @param {cr.ui.ArrayDataModel} dataModel The data model that contains this |
14 * item. | 14 * item. |
15 * @param {Array} entry An array of the form [url, username, password]. When | 15 * @param {Array} entry An array of the form [url, username, password]. When |
16 * the list has been filtered, a fourth element [index] may be present. | 16 * the list has been filtered, a fourth element [index] may be present. |
17 * @param {boolean} showPasswords If true, add a button to the element to | 17 * @param {boolean} showPasswords If true, add a button to the element to |
18 * allow the user to reveal the saved password. | 18 * allow the user to reveal the saved password. |
19 * @constructor | 19 * @constructor |
20 * @extends {cr.ui.ListItem} | 20 * @extends {options.DeletableItem} |
21 */ | 21 */ |
22 function PasswordListItem(dataModel, entry, showPasswords) { | 22 function PasswordListItem(dataModel, entry, showPasswords) { |
23 var el = cr.doc.createElement('div'); | 23 var el = cr.doc.createElement('div'); |
24 el.dataItem = entry; | 24 el.dataItem = entry; |
25 el.dataModel = dataModel; | 25 el.dataModel = dataModel; |
26 el.__proto__ = PasswordListItem.prototype; | 26 el.__proto__ = PasswordListItem.prototype; |
27 el.decorate(showPasswords); | 27 el.decorate(showPasswords); |
28 | 28 |
29 return el; | 29 return el; |
30 } | 30 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 }, | 188 }, |
189 set password(password) { | 189 set password(password) { |
190 this.dataItem[2] = password; | 190 this.dataItem[2] = password; |
191 }, | 191 }, |
192 }; | 192 }; |
193 | 193 |
194 /** | 194 /** |
195 * Creates a new PasswordExceptions list item. | 195 * Creates a new PasswordExceptions list item. |
196 * @param {Array} entry A pair of the form [url, username]. | 196 * @param {Array} entry A pair of the form [url, username]. |
197 * @constructor | 197 * @constructor |
198 * @extends {options.DeletableListItem} | 198 * @extends {options.DeletableItem} |
199 */ | 199 */ |
200 function PasswordExceptionsListItem(entry) { | 200 function PasswordExceptionsListItem(entry) { |
201 var el = cr.doc.createElement('div'); | 201 var el = cr.doc.createElement('div'); |
202 el.dataItem = entry; | 202 el.dataItem = entry; |
203 el.__proto__ = PasswordExceptionsListItem.prototype; | 203 el.__proto__ = PasswordExceptionsListItem.prototype; |
204 el.decorate(); | 204 el.decorate(); |
205 | 205 |
206 return el; | 206 return el; |
207 } | 207 } |
208 | 208 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 }, | 335 }, |
336 }; | 336 }; |
337 | 337 |
338 return { | 338 return { |
339 PasswordListItem: PasswordListItem, | 339 PasswordListItem: PasswordListItem, |
340 PasswordExceptionsListItem: PasswordExceptionsListItem, | 340 PasswordExceptionsListItem: PasswordExceptionsListItem, |
341 PasswordsList: PasswordsList, | 341 PasswordsList: PasswordsList, |
342 PasswordExceptionsList: PasswordExceptionsList, | 342 PasswordExceptionsList: PasswordExceptionsList, |
343 }; | 343 }; |
344 }); | 344 }); |
OLD | NEW |