OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 })(); |
OLD | NEW |