| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 'password-edit-dialog' is the dialog that allows showing a | 6 * @fileoverview 'password-edit-dialog' is the dialog that allows showing a |
| 7 * saved password. | 7 * saved password. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 (function() { | 10 (function() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 this.$.dialog.showModal(); | 30 this.$.dialog.showModal(); |
| 31 }, | 31 }, |
| 32 | 32 |
| 33 /** Closes the dialog. */ | 33 /** Closes the dialog. */ |
| 34 close: function() { | 34 close: function() { |
| 35 this.$.dialog.close(); | 35 this.$.dialog.close(); |
| 36 }, | 36 }, |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Gets the password input's type. Should be 'text' when password is visible | 39 * Gets the password input's type. Should be 'text' when password is visible |
| 40 * and 'password' when it's not. | 40 * or when there's federated text otherwise 'password'. |
| 41 * @param {string} password | |
| 42 * @private | 41 * @private |
| 43 */ | 42 */ |
| 44 getPasswordInputType_: function(password) { | 43 getPasswordInputType_: function() { |
| 45 return password ? 'text' : 'password'; | 44 return this.password || this.item.federationText ? 'text' : 'password'; |
| 46 }, | 45 }, |
| 47 | 46 |
| 48 /** | 47 /** |
| 49 * Gets the title text for the show/hide icon. | 48 * Gets the title text for the show/hide icon. |
| 50 * @param {string} password | 49 * @param {string} password |
| 51 * @param {string} hide The i18n text to use for 'Hide' | 50 * @param {string} hide The i18n text to use for 'Hide' |
| 52 * @param {string} show The i18n text to use for 'Show' | 51 * @param {string} show The i18n text to use for 'Show' |
| 53 * @private | 52 * @private |
| 54 */ | 53 */ |
| 55 showPasswordTitle_: function(password, hide, show) { | 54 showPasswordTitle_: function(password, hide, show) { |
| 56 return password ? hide : show; | 55 return password ? hide : show; |
| 57 }, | 56 }, |
| 58 | 57 |
| 59 /** | 58 /** |
| 60 * Gets the text of the password. Will use the value of |password| unless it | 59 * Gets the text of the password. Will use the value of |password| unless it |
| 61 * cannot be shown, in which case it will be spaces. | 60 * cannot be shown, in which case it will be spaces. It can also be the |
| 62 * @param {!chrome.passwordsPrivate.PasswordUiEntry} item | 61 * federated text. |
| 63 * @param {string} password | |
| 64 * @private | 62 * @private |
| 65 */ | 63 */ |
| 66 getPassword_: function(item, password) { | 64 getPassword_: function() { |
| 67 if (password) | 65 if (!this.item) |
| 68 return password; | 66 return ''; |
| 69 return item ? ' '.repeat(item.numCharactersInPassword) : ''; | 67 |
| 68 return this.item.federationText || this.password || |
| 69 ' '.repeat(this.item.numCharactersInPassword); |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Handler for tapping the show/hide button. Will fire an event to request the | 73 * Handler for tapping the show/hide button. Will fire an event to request the |
| 74 * password for this login pair. | 74 * password for this login pair. |
| 75 * @private | 75 * @private |
| 76 */ | 76 */ |
| 77 onShowPasswordButtonTap_: function() { | 77 onShowPasswordButtonTap_: function() { |
| 78 if (this.password) | 78 if (this.password) |
| 79 this.password = ''; | 79 this.password = ''; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 /** | 92 /** |
| 93 * @param {!Event} event | 93 * @param {!Event} event |
| 94 * @private | 94 * @private |
| 95 */ | 95 */ |
| 96 onReadonlyInputTap_: function(event) { | 96 onReadonlyInputTap_: function(event) { |
| 97 /** @type {!PaperInputElement} */ (Polymer.dom(event).localTarget) | 97 /** @type {!PaperInputElement} */ (Polymer.dom(event).localTarget) |
| 98 .inputElement.select(); | 98 .inputElement.select(); |
| 99 } | 99 } |
| 100 }); | 100 }); |
| 101 })(); | 101 })(); |
| OLD | NEW |