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 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 this.contentElement.appendChild(usernameLabel); | 62 this.contentElement.appendChild(usernameLabel); |
63 | 63 |
64 // The stored password. | 64 // The stored password. |
65 var passwordInputDiv = this.ownerDocument.createElement('div'); | 65 var passwordInputDiv = this.ownerDocument.createElement('div'); |
66 passwordInputDiv.className = 'password'; | 66 passwordInputDiv.className = 'password'; |
67 | 67 |
68 // The password input field. | 68 // The password input field. |
69 var passwordInput = this.ownerDocument.createElement('input'); | 69 var passwordInput = this.ownerDocument.createElement('input'); |
70 passwordInput.type = 'password'; | 70 passwordInput.type = 'password'; |
71 passwordInput.className = 'inactive-password'; | 71 passwordInput.className = 'inactive-password'; |
72 this.closeButtonElement.tabIndex = -1; | |
73 passwordInput.tabIndex = -1; | |
Dan Beam
2015/01/22 00:39:59
make a
setFocusable: function(focusable) {
| |
72 passwordInput.readOnly = true; | 74 passwordInput.readOnly = true; |
73 passwordInput.value = this.showPasswords_ ? this.password : '********'; | 75 passwordInput.value = this.showPasswords_ ? this.password : '********'; |
74 passwordInputDiv.appendChild(passwordInput); | 76 passwordInputDiv.appendChild(passwordInput); |
75 this.passwordField = passwordInput; | 77 this.passwordField = passwordInput; |
76 | 78 |
77 // The show/hide button. | 79 // The show/hide button. |
78 if (this.showPasswords_) { | 80 if (this.showPasswords_) { |
79 var button = this.ownerDocument.createElement('button'); | 81 var button = this.ownerDocument.createElement('button'); |
80 button.hidden = true; | 82 button.hidden = true; |
81 button.className = 'list-inline-button custom-appearance'; | 83 button.className = 'list-inline-button custom-appearance'; |
(...skipping 14 matching lines...) Expand all Loading... | |
96 | 98 |
97 /** @override */ | 99 /** @override */ |
98 selectionChanged: function() { | 100 selectionChanged: function() { |
99 var input = this.passwordField; | 101 var input = this.passwordField; |
100 var button = this.passwordShowButton; | 102 var button = this.passwordShowButton; |
101 // The button doesn't exist when passwords can't be shown. | 103 // The button doesn't exist when passwords can't be shown. |
102 if (!button) | 104 if (!button) |
103 return; | 105 return; |
104 | 106 |
105 if (this.selected) { | 107 if (this.selected) { |
108 input.focus(); | |
Dan Beam
2015/01/22 00:39:59
you should set the tabIndex = 0 before trying to f
| |
106 input.classList.remove('inactive-password'); | 109 input.classList.remove('inactive-password'); |
110 input.tabIndex = 0; | |
111 this.closeButtonElement.tabIndex = 0; | |
Dan Beam
2015/01/22 00:39:59
nit: arguably:
input.tabIndex = this.closeButtonE
| |
107 button.hidden = false; | 112 button.hidden = false; |
108 } else { | 113 } else { |
109 input.classList.add('inactive-password'); | 114 input.classList.add('inactive-password'); |
115 input.tabIndex = -1; | |
116 this.closeButtonElement.tabIndex = -1; | |
Dan Beam
2015/01/22 00:39:59
nit: arguably
this.closeButtonElement.tabIndex =
| |
110 button.hidden = true; | 117 button.hidden = true; |
111 } | 118 } |
112 }, | 119 }, |
113 | 120 |
114 /** | 121 /** |
115 * Reveals the plain text password of this entry. | 122 * Reveals the plain text password of this entry. |
116 */ | 123 */ |
117 showPassword: function(password) { | 124 showPassword: function(password) { |
118 this.passwordField.value = password; | 125 this.passwordField.value = password; |
119 this.passwordField.type = 'text'; | 126 this.passwordField.type = 'text'; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 }, | 349 }, |
343 }; | 350 }; |
344 | 351 |
345 return { | 352 return { |
346 PasswordListItem: PasswordListItem, | 353 PasswordListItem: PasswordListItem, |
347 PasswordExceptionsListItem: PasswordExceptionsListItem, | 354 PasswordExceptionsListItem: PasswordExceptionsListItem, |
348 PasswordsList: PasswordsList, | 355 PasswordsList: PasswordsList, |
349 PasswordExceptionsList: PasswordExceptionsList, | 356 PasswordExceptionsList: PasswordExceptionsList, |
350 }; | 357 }; |
351 }); | 358 }); |
OLD | NEW |