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

Side by Side Diff: chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js

Issue 2789783002: MD Settings: Restore focus after closing dialogs, for passwords page. (Closed)
Patch Set: fix compilation Created 3 years, 8 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
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 'passwords-section' is the collapsible section containing 6 * @fileoverview 'passwords-section' is the collapsible section containing
7 * the list of saved passwords as well as the list of sites that will never 7 * the list of saved passwords as well as the list of sites that will never
8 * save any passwords. 8 * save any passwords.
9 */ 9 */
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 type: String, 209 type: String,
210 value: '', 210 value: '',
211 }, 211 },
212 }, 212 },
213 213
214 listeners: { 214 listeners: {
215 'show-password': 'showPassword_', 215 'show-password': 'showPassword_',
216 }, 216 },
217 217
218 /** 218 /**
219 * The element to return focus to, when the currently active dialog is
220 * closed.
221 * @private {?HTMLElement}
222 */
223 activeDialogAnchor_: null,
224
225 /**
219 * @type {PasswordManager} 226 * @type {PasswordManager}
220 * @private 227 * @private
221 */ 228 */
222 passwordManager_: null, 229 passwordManager_: null,
223 230
224 /** 231 /**
225 * @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} 232 * @type {?function(!Array<PasswordManager.PasswordUiEntry>):void}
226 * @private 233 * @private
227 */ 234 */
228 setSavedPasswordsListener_: null, 235 setSavedPasswordsListener_: null,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 */ 298 */
292 onMenuEditPasswordTap_: function(e) { 299 onMenuEditPasswordTap_: function(e) {
293 e.preventDefault(); 300 e.preventDefault();
294 /** @type {CrActionMenuElement} */(this.$.menu).close(); 301 /** @type {CrActionMenuElement} */(this.$.menu).close();
295 this.showPasswordEditDialog_ = true; 302 this.showPasswordEditDialog_ = true;
296 }, 303 },
297 304
298 /** @private */ 305 /** @private */
299 onPasswordEditDialogClosed_: function() { 306 onPasswordEditDialogClosed_: function() {
300 this.showPasswordEditDialog_ = false; 307 this.showPasswordEditDialog_ = false;
308 this.activeDialogAnchor_.focus();
309 this.activeDialogAnchor_ = null;
301 }, 310 },
302 311
303 /** 312 /**
304 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} savedPasswords 313 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} savedPasswords
305 * @param {string} filter 314 * @param {string} filter
306 * @return {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} 315 * @return {!Array<!chrome.passwordsPrivate.PasswordUiEntry>}
307 * @private 316 * @private
308 */ 317 */
309 getFilteredPasswords_: function(savedPasswords, filter) { 318 getFilteredPasswords_: function(savedPasswords, filter) {
310 if (!filter) 319 if (!filter)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 getEmptyPassword_: function(length) { 363 getEmptyPassword_: function(length) {
355 return ' '.repeat(length); 364 return ' '.repeat(length);
356 }, 365 },
357 366
358 /** 367 /**
359 * Opens the password action menu. 368 * Opens the password action menu.
360 * @private 369 * @private
361 */ 370 */
362 onPasswordMenuTap_: function(e) { 371 onPasswordMenuTap_: function(e) {
363 var menu = /** @type {!CrActionMenuElement} */(this.$.menu); 372 var menu = /** @type {!CrActionMenuElement} */(this.$.menu);
364 var target = /** @type {!Element} */(Polymer.dom(e).localTarget); 373 var target = /** @type {!HTMLElement} */(Polymer.dom(e).localTarget);
365 var passwordUiEntryEvent = /** @type {!PasswordUiEntryEvent} */(e); 374 var passwordUiEntryEvent = /** @type {!PasswordUiEntryEvent} */(e);
366 375
367 this.activePassword = 376 this.activePassword =
368 /** @type {!chrome.passwordsPrivate.PasswordUiEntry} */ ( 377 /** @type {!chrome.passwordsPrivate.PasswordUiEntry} */ (
369 passwordUiEntryEvent.model.item); 378 passwordUiEntryEvent.model.item);
370 menu.showAt(target); 379 menu.showAt(target);
380 this.activeDialogAnchor_ = target;
371 }, 381 },
372 382
373 /** 383 /**
374 * Returns true if the list exists and has items. 384 * Returns true if the list exists and has items.
375 * @param {Array<Object>} list 385 * @param {Array<Object>} list
376 * @return {boolean} 386 * @return {boolean}
377 * @private 387 * @private
378 */ 388 */
379 hasSome_: function(list) { 389 hasSome_: function(list) {
380 return !!(list && list.length); 390 return !!(list && list.length);
(...skipping 15 matching lines...) Expand all
396 /** 406 /**
397 * @private 407 * @private
398 * @param {boolean} toggleValue 408 * @param {boolean} toggleValue
399 * @return {string} 409 * @return {string}
400 */ 410 */
401 getOnOffLabel_: function(toggleValue) { 411 getOnOffLabel_: function(toggleValue) {
402 return toggleValue ? this.i18n('toggleOn') : this.i18n('toggleOff'); 412 return toggleValue ? this.i18n('toggleOn') : this.i18n('toggleOff');
403 } 413 }
404 }); 414 });
405 })(); 415 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698