Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/resources/options/password_manager_list.js

Issue 6246011: DOMUI: Make the password input field readonly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delete fix. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 usernameLabel.textContent = this.username; 44 usernameLabel.textContent = this.username;
45 this.contentElement.appendChild(usernameLabel); 45 this.contentElement.appendChild(usernameLabel);
46 46
47 // The stored password. 47 // The stored password.
48 var passwordInputDiv = this.ownerDocument.createElement('div'); 48 var passwordInputDiv = this.ownerDocument.createElement('div');
49 passwordInputDiv.className = 'password'; 49 passwordInputDiv.className = 'password';
50 50
51 // The password input field. 51 // The password input field.
52 var passwordInput = this.ownerDocument.createElement('input'); 52 var passwordInput = this.ownerDocument.createElement('input');
53 passwordInput.className = 'inactive-password'; 53 passwordInput.className = 'inactive-password';
54 passwordInput.readOnly = true;
54 passwordInput.type = 'password'; 55 passwordInput.type = 'password';
55 passwordInput.value = this.password; 56 passwordInput.value = this.password;
56 passwordInputDiv.appendChild(passwordInput); 57 passwordInputDiv.appendChild(passwordInput);
57 58
58 // The show/hide button. 59 // The show/hide button.
59 var buttonSpan = this.ownerDocument.createElement('span'); 60 var buttonSpan = this.ownerDocument.createElement('span');
60 buttonSpan.className = 'hidden'; 61 buttonSpan.className = 'hidden';
61 buttonSpan.addEventListener('click', this.onClick_, true); 62 buttonSpan.addEventListener('click', this.onClick_, true);
62 passwordInputDiv.appendChild(buttonSpan); 63 passwordInputDiv.appendChild(buttonSpan);
63 64
64 this.contentElement.appendChild(passwordInputDiv); 65 this.contentElement.appendChild(passwordInputDiv);
65 }, 66 },
66 67
67 /** @inheritDoc */ 68 /** @inheritDoc */
68 selectionChanged: function() { 69 selectionChanged: function() {
69 var passwordInput = this.querySelector('input[type=password]'); 70 var passwordInput = this.querySelector('input[type=password]');
70 var buttonSpan = passwordInput.nextSibling; 71 var textInput = this.querySelector('input[type=text]');
72 var input = passwordInput != undefined ? passwordInput : textInput;
stuartmorgan 2011/01/20 01:52:48 I believe in JS you can just do: var input = passw
James Hawkins 2011/01/20 01:54:55 Done.
73 var buttonSpan = input.nextSibling;
71 if (this.selected) { 74 if (this.selected) {
72 passwordInput.classList.remove('inactive-password'); 75 input.classList.remove('inactive-password');
73 buttonSpan.classList.remove('hidden'); 76 buttonSpan.classList.remove('hidden');
74 } else { 77 } else {
75 passwordInput.classList.add('inactive-password'); 78 input.classList.add('inactive-password');
76 buttonSpan.classList.add('hidden'); 79 buttonSpan.classList.add('hidden');
77 } 80 }
78 }, 81 },
79 82
80 /** 83 /**
81 * On-click event handler. Swaps the type of the input field from password 84 * On-click event handler. Swaps the type of the input field from password
82 * to text and back. 85 * to text and back.
83 * @private 86 * @private
84 */ 87 */
85 onClick_: function(event) { 88 onClick_: function(event) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 }, 228 },
226 }; 229 };
227 230
228 return { 231 return {
229 PasswordListItem: PasswordListItem, 232 PasswordListItem: PasswordListItem,
230 PasswordExceptionsListItem: PasswordExceptionsListItem, 233 PasswordExceptionsListItem: PasswordExceptionsListItem,
231 PasswordsList: PasswordsList, 234 PasswordsList: PasswordsList,
232 PasswordExceptionsList: PasswordExceptionsList, 235 PasswordExceptionsList: PasswordExceptionsList,
233 }; 236 };
234 }); 237 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698