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 /** | 5 /** |
6 * @fileoverview 'passwords-section' is the collapsible section containing | 6 * @fileoverview 'passwords-section' is the collapsible section containing |
7 * the list of saved passwords as well as the list of sites that will never | 7 * the list of saved passwords as well as the list of sites that will never |
8 * save any passwords. | 8 * save any passwords. |
9 */ | 9 */ |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 /** | 235 /** |
236 * @type {?function(!Array<PasswordManager.ExceptionEntry>):void} | 236 * @type {?function(!Array<PasswordManager.ExceptionEntry>):void} |
237 * @private | 237 * @private |
238 */ | 238 */ |
239 setPasswordExceptionsListener_: null, | 239 setPasswordExceptionsListener_: null, |
240 | 240 |
241 /** @override */ | 241 /** @override */ |
242 attached: function() { | 242 attached: function() { |
243 // Create listener functions. | 243 // Create listener functions. |
244 var setSavedPasswordsListener = function(list) { | 244 var setSavedPasswordsListener = list => { |
245 this.savedPasswords = list; | 245 this.savedPasswords = list; |
246 }.bind(this); | 246 }; |
247 | 247 |
248 var setPasswordExceptionsListener = function(list) { | 248 var setPasswordExceptionsListener = list => { |
249 this.passwordExceptions = list; | 249 this.passwordExceptions = list; |
250 }.bind(this); | 250 }; |
251 | 251 |
252 this.setSavedPasswordsListener_ = setSavedPasswordsListener; | 252 this.setSavedPasswordsListener_ = setSavedPasswordsListener; |
253 this.setPasswordExceptionsListener_ = setPasswordExceptionsListener; | 253 this.setPasswordExceptionsListener_ = setPasswordExceptionsListener; |
254 | 254 |
255 // Set the manager. These can be overridden by tests. | 255 // Set the manager. These can be overridden by tests. |
256 this.passwordManager_ = PasswordManagerImpl.getInstance(); | 256 this.passwordManager_ = PasswordManagerImpl.getInstance(); |
257 | 257 |
258 // Request initial data. | 258 // Request initial data. |
259 this.passwordManager_.getSavedPasswordList(setSavedPasswordsListener); | 259 this.passwordManager_.getSavedPasswordList(setSavedPasswordsListener); |
260 this.passwordManager_.getExceptionList(setPasswordExceptionsListener); | 260 this.passwordManager_.getExceptionList(setPasswordExceptionsListener); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 return !!(list && list.length); | 378 return !!(list && list.length); |
379 }, | 379 }, |
380 | 380 |
381 /** | 381 /** |
382 * Listens for the show-password event, and calls the private API. | 382 * Listens for the show-password event, and calls the private API. |
383 * @param {!Event} event | 383 * @param {!Event} event |
384 * @private | 384 * @private |
385 */ | 385 */ |
386 showPassword_: function(event) { | 386 showPassword_: function(event) { |
387 this.passwordManager_.getPlaintextPassword( | 387 this.passwordManager_.getPlaintextPassword( |
388 /** @type {!PasswordManager.LoginPair} */ (event.detail), | 388 /** @type {!PasswordManager.LoginPair} */ (event.detail), item => { |
389 function(item) { | |
390 this.setPassword(item.loginPair, item.plaintextPassword); | 389 this.setPassword(item.loginPair, item.plaintextPassword); |
391 }.bind(this)); | 390 }); |
392 }, | 391 }, |
393 | 392 |
394 /** | 393 /** |
395 * @private | 394 * @private |
396 * @param {boolean} toggleValue | 395 * @param {boolean} toggleValue |
397 * @return {string} | 396 * @return {string} |
398 */ | 397 */ |
399 getOnOffLabel_: function(toggleValue) { | 398 getOnOffLabel_: function(toggleValue) { |
400 return toggleValue ? this.i18n('toggleOn') : this.i18n('toggleOff'); | 399 return toggleValue ? this.i18n('toggleOn') : this.i18n('toggleOff'); |
401 } | 400 } |
402 }); | 401 }); |
403 })(); | 402 })(); |
OLD | NEW |