| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 ArrayDataModel = cr.ui.ArrayDataModel; | 6 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 7 const DeletableItemList = options.DeletableItemList; | 7 const DeletableItemList = options.DeletableItemList; |
| 8 const DeletableItem = options.DeletableItem; | 8 const DeletableItem = options.DeletableItem; |
| 9 const List = cr.ui.List; | 9 const List = cr.ui.List; |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 var passwordInput = this.ownerDocument.createElement('input'); | 53 var passwordInput = this.ownerDocument.createElement('input'); |
| 54 passwordInput.type = 'password'; | 54 passwordInput.type = 'password'; |
| 55 passwordInput.className = 'inactive-password'; | 55 passwordInput.className = 'inactive-password'; |
| 56 passwordInput.readOnly = true; | 56 passwordInput.readOnly = true; |
| 57 passwordInput.value = showPasswords ? this.password : '********'; | 57 passwordInput.value = showPasswords ? this.password : '********'; |
| 58 passwordInputDiv.appendChild(passwordInput); | 58 passwordInputDiv.appendChild(passwordInput); |
| 59 | 59 |
| 60 // The show/hide button. | 60 // The show/hide button. |
| 61 if (showPasswords) { | 61 if (showPasswords) { |
| 62 var button = this.ownerDocument.createElement('button'); | 62 var button = this.ownerDocument.createElement('button'); |
| 63 button.classList.add('hidden'); | 63 button.hidden = true; |
| 64 button.classList.add('password-button'); | 64 button.classList.add('password-button'); |
| 65 button.textContent = localStrings.getString('passwordShowButton'); | 65 button.textContent = localStrings.getString('passwordShowButton'); |
| 66 button.addEventListener('click', this.onClick_, true); | 66 button.addEventListener('click', this.onClick_, true); |
| 67 passwordInputDiv.appendChild(button); | 67 passwordInputDiv.appendChild(button); |
| 68 } | 68 } |
| 69 | 69 |
| 70 this.contentElement.appendChild(passwordInputDiv); | 70 this.contentElement.appendChild(passwordInputDiv); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** @inheritDoc */ | 73 /** @inheritDoc */ |
| 74 selectionChanged: function() { | 74 selectionChanged: function() { |
| 75 var passwordInput = this.querySelector('input[type=password]'); | 75 var passwordInput = this.querySelector('input[type=password]'); |
| 76 var textInput = this.querySelector('input[type=text]'); | 76 var textInput = this.querySelector('input[type=text]'); |
| 77 var input = passwordInput || textInput; | 77 var input = passwordInput || textInput; |
| 78 var button = input.nextSibling; | 78 var button = input.nextSibling; |
| 79 // |button| doesn't exist when passwords can't be shown. | 79 // |button| doesn't exist when passwords can't be shown. |
| 80 if (!button) | 80 if (!button) |
| 81 return; | 81 return; |
| 82 if (this.selected) { | 82 if (this.selected) { |
| 83 input.classList.remove('inactive-password'); | 83 input.classList.remove('inactive-password'); |
| 84 button.classList.remove('hidden'); | 84 button.hidden = false; |
| 85 } else { | 85 } else { |
| 86 input.classList.add('inactive-password'); | 86 input.classList.add('inactive-password'); |
| 87 button.classList.add('hidden'); | 87 button.hidden = true; |
| 88 } | 88 } |
| 89 }, | 89 }, |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * On-click event handler. Swaps the type of the input field from password | 92 * On-click event handler. Swaps the type of the input field from password |
| 93 * to text and back. | 93 * to text and back. |
| 94 * @private | 94 * @private |
| 95 */ | 95 */ |
| 96 onClick_: function(event) { | 96 onClick_: function(event) { |
| 97 // The password is the input element previous to the button. | 97 // The password is the input element previous to the button. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 }, | 266 }, |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 return { | 269 return { |
| 270 PasswordListItem: PasswordListItem, | 270 PasswordListItem: PasswordListItem, |
| 271 PasswordExceptionsListItem: PasswordExceptionsListItem, | 271 PasswordExceptionsListItem: PasswordExceptionsListItem, |
| 272 PasswordsList: PasswordsList, | 272 PasswordsList: PasswordsList, |
| 273 PasswordExceptionsList: PasswordExceptionsList, | 273 PasswordExceptionsList: PasswordExceptionsList, |
| 274 }; | 274 }; |
| 275 }); | 275 }); |
| OLD | NEW |