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

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

Issue 1477133002: Enables opening an origin from password exceptions list ("Never save" list) with keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« 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) 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // The URL of the site. 71 // The URL of the site.
72 var urlDiv = this.ownerDocument.createElement('div'); 72 var urlDiv = this.ownerDocument.createElement('div');
73 urlDiv.className = 'favicon-cell left-elided-url url'; 73 urlDiv.className = 'favicon-cell left-elided-url url';
74 urlDiv.setAttribute( 74 urlDiv.setAttribute(
75 'title', getTitleForPasswordOrigin(this.url, this.isUrlSecure)); 75 'title', getTitleForPasswordOrigin(this.url, this.isUrlSecure));
76 var urlLink = this.ownerDocument.createElement('a'); 76 var urlLink = this.ownerDocument.createElement('a');
77 urlLink.href = this.url; 77 urlLink.href = this.url;
78 urlLink.setAttribute('target', '_blank'); 78 urlLink.setAttribute('target', '_blank');
79 urlLink.textContent = this.shownUrl.split('').reverse().join(''); 79 urlLink.textContent = this.shownUrl.split('').reverse().join('');
80 urlLink.addEventListener('focus', function() {
81 this.handleFocus();
82 }.bind(this));
80 urlDiv.appendChild(urlLink); 83 urlDiv.appendChild(urlLink);
81 urlDiv.style.backgroundImage = getFaviconImageSet( 84 urlDiv.style.backgroundImage = getFaviconImageSet(
82 'origin/' + this.url, 16); 85 'origin/' + this.url, 16);
83 this.contentElement.appendChild(urlDiv); 86 this.contentElement.appendChild(urlDiv);
84 this.urlLink = urlLink; 87 this.urlLink = urlLink;
85 88
86 // The stored username. 89 // The stored username.
87 var usernameDiv = this.ownerDocument.createElement('div'); 90 var usernameDiv = this.ownerDocument.createElement('div');
88 usernameDiv.className = 'name'; 91 usernameDiv.className = 'name';
89 usernameDiv.title = this.username; 92 usernameDiv.title = this.username;
90 this.contentElement.appendChild(usernameDiv); 93 this.contentElement.appendChild(usernameDiv);
91 var usernameInput = this.ownerDocument.createElement('input'); 94 var usernameInput = this.ownerDocument.createElement('input');
92 usernameInput.type = 'text'; 95 usernameInput.type = 'text';
93 usernameInput.className = 'inactive-item'; 96 usernameInput.className = 'inactive-item';
94 usernameInput.readOnly = true; 97 usernameInput.readOnly = true;
95 usernameInput.value = this.username; 98 usernameInput.value = this.username;
99 usernameInput.addEventListener('focus', function() {
100 this.handleFocus();
101 }.bind(this));
96 usernameDiv.appendChild(usernameInput); 102 usernameDiv.appendChild(usernameInput);
97 this.usernameField = usernameInput; 103 this.usernameField = usernameInput;
98 104
99 if (this.federation) { 105 if (this.federation) {
100 // The federation. 106 // The federation.
101 var federationDiv = this.ownerDocument.createElement('div'); 107 var federationDiv = this.ownerDocument.createElement('div');
102 federationDiv.className = 'federation'; 108 federationDiv.className = 'federation';
103 federationDiv.textContent = this.federation; 109 federationDiv.textContent = this.federation;
104 this.contentElement.appendChild(federationDiv); 110 this.contentElement.appendChild(federationDiv);
105 } else { 111 } else {
106 // The stored password. 112 // The stored password.
107 var passwordInputDiv = this.ownerDocument.createElement('div'); 113 var passwordInputDiv = this.ownerDocument.createElement('div');
108 passwordInputDiv.className = 'password'; 114 passwordInputDiv.className = 'password';
109 115
110 // The password input field. 116 // The password input field.
111 var passwordInput = this.ownerDocument.createElement('input'); 117 var passwordInput = this.ownerDocument.createElement('input');
112 passwordInput.type = 'password'; 118 passwordInput.type = 'password';
113 passwordInput.className = 'inactive-item'; 119 passwordInput.className = 'inactive-item';
114 passwordInput.readOnly = true; 120 passwordInput.readOnly = true;
115 passwordInput.value = this.showPasswords_ ? this.password : '********'; 121 passwordInput.value = this.showPasswords_ ? this.password : '********';
116 passwordInputDiv.appendChild(passwordInput); 122 passwordInputDiv.appendChild(passwordInput);
117 var deletableItem = this;
118 passwordInput.addEventListener('focus', function() { 123 passwordInput.addEventListener('focus', function() {
119 deletableItem.handleFocus(); 124 this.handleFocus();
120 }); 125 }.bind(this));
121 this.passwordField = passwordInput; 126 this.passwordField = passwordInput;
122 this.setFocusable_(false); 127 this.setFocusable_(false);
123 128
124 // The show/hide button. 129 // The show/hide button.
125 if (this.showPasswords_) { 130 if (this.showPasswords_) {
126 var button = this.ownerDocument.createElement('button'); 131 var button = this.ownerDocument.createElement('button');
127 button.hidden = true; 132 button.hidden = true;
128 button.className = 'list-inline-button custom-appearance'; 133 button.className = 'list-inline-button custom-appearance';
129 button.textContent = loadTimeData.getString('passwordShowButton'); 134 button.textContent = loadTimeData.getString('passwordShowButton');
130 button.addEventListener('click', this.onClick_.bind(this), true); 135 button.addEventListener('click', this.onClick_.bind(this), true);
131 button.addEventListener('mousedown', function(event) { 136 button.addEventListener('mousedown', function(event) {
132 // Don't focus on this button by mousedown. 137 // Don't focus on this button by mousedown.
133 event.preventDefault(); 138 event.preventDefault();
134 // Don't handle list item selection. It causes focus change. 139 // Don't handle list item selection. It causes focus change.
135 event.stopPropagation(); 140 event.stopPropagation();
136 }, false); 141 }, false);
137 button.addEventListener('focus', function() { 142 button.addEventListener('focus', function() {
138 deletableItem.handleFocus(); 143 this.handleFocus();
139 }); 144 }.bind(this));
140 passwordInputDiv.appendChild(button); 145 passwordInputDiv.appendChild(button);
141 this.passwordShowButton = button; 146 this.passwordShowButton = button;
142 } 147 }
143 this.contentElement.appendChild(passwordInputDiv); 148 this.contentElement.appendChild(passwordInputDiv);
144 } 149 }
145 }, 150 },
146 151
147 /** @override */ 152 /** @override */
148 selectionChanged: function() { 153 selectionChanged: function() {
149 var usernameInput = this.usernameField; 154 var usernameInput = this.usernameField;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 var urlDiv = this.ownerDocument.createElement('div'); 327 var urlDiv = this.ownerDocument.createElement('div');
323 urlDiv.className = 'url'; 328 urlDiv.className = 'url';
324 urlDiv.classList.add('favicon-cell'); 329 urlDiv.classList.add('favicon-cell');
325 urlDiv.classList.add('left-elided-url'); 330 urlDiv.classList.add('left-elided-url');
326 urlDiv.setAttribute( 331 urlDiv.setAttribute(
327 'title', getTitleForPasswordOrigin(this.url, this.isUrlSecure)); 332 'title', getTitleForPasswordOrigin(this.url, this.isUrlSecure));
328 var urlLink = this.ownerDocument.createElement('a'); 333 var urlLink = this.ownerDocument.createElement('a');
329 urlLink.href = this.url; 334 urlLink.href = this.url;
330 urlLink.textContent = this.shownUrl.split('').reverse().join(''); 335 urlLink.textContent = this.shownUrl.split('').reverse().join('');
331 urlLink.setAttribute('target', '_blank'); 336 urlLink.setAttribute('target', '_blank');
337 urlLink.addEventListener('focus', function() {
338 this.handleFocus();
339 }.bind(this));
340 this.urlLink = urlLink;
332 urlDiv.appendChild(urlLink); 341 urlDiv.appendChild(urlLink);
333 urlDiv.style.backgroundImage = getFaviconImageSet( 342 urlDiv.style.backgroundImage = getFaviconImageSet(
334 'origin/' + this.url, 16); 343 'origin/' + this.url, 16);
335 urlLink.tabIndex = -1;
336 this.contentElement.appendChild(urlDiv); 344 this.contentElement.appendChild(urlDiv);
337 }, 345 },
338 346
347 /** @override */
348 selectionChanged: function() {
349 if (this.selected) {
350 this.setFocusable_(true);
351 this.urlLink.focus();
352 } else {
353 this.setFocusable_(false);
354 }
355 },
356
357 /**
358 * Set the focusability of this row.
359 * @param {boolean} focusable
360 * @private
361 */
362 setFocusable_: function(focusable) {
363 var tabIndex = focusable ? 0 : -1;
364 this.urlLink.tabIndex = tabIndex;
365 this.closeButtonElement.tabIndex = tabIndex;
366 },
367
339 /** 368 /**
340 * Get the url for the entry. 369 * Get the url for the entry.
341 * @type {string} 370 * @type {string}
342 */ 371 */
343 get url() { 372 get url() {
344 return this.dataItem[ORIGIN_FIELD]; 373 return this.dataItem[ORIGIN_FIELD];
345 }, 374 },
346 set url(url) { 375 set url(url) {
347 this.dataItem[ORIGIN_FIELD] = url; 376 this.dataItem[ORIGIN_FIELD] = url;
348 }, 377 },
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 PasswordExceptionsList: PasswordExceptionsList, 515 PasswordExceptionsList: PasswordExceptionsList,
487 ORIGIN_FIELD: ORIGIN_FIELD, 516 ORIGIN_FIELD: ORIGIN_FIELD,
488 SHOWN_URL_FIELD: SHOWN_URL_FIELD, 517 SHOWN_URL_FIELD: SHOWN_URL_FIELD,
489 IS_SECURE_FIELD: IS_SECURE_FIELD, 518 IS_SECURE_FIELD: IS_SECURE_FIELD,
490 USERNAME_FIELD: USERNAME_FIELD, 519 USERNAME_FIELD: USERNAME_FIELD,
491 PASSWORD_FIELD: PASSWORD_FIELD, 520 PASSWORD_FIELD: PASSWORD_FIELD,
492 FEDERATION_FIELD: FEDERATION_FIELD, 521 FEDERATION_FIELD: FEDERATION_FIELD,
493 ORIGINAL_INDEX_FIELD: ORIGINAL_INDEX_FIELD 522 ORIGINAL_INDEX_FIELD: ORIGINAL_INDEX_FIELD
494 }; 523 };
495 }); 524 });
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