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

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

Issue 2795353002: WebUI: For cr-dialog, handle Enter keys in paper-inputs. (Closed)
Patch Set: update tests 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 'password-edit-dialog' is the dialog that allows showing a 6 * @fileoverview 'password-edit-dialog' is the dialog that allows showing a
7 * saved password. 7 * saved password.
8 */ 8 */
9 9
10 (function() { 10 (function() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 * @param {string} password 63 * @param {string} password
64 * @private 64 * @private
65 */ 65 */
66 getPassword_: function(item, password) { 66 getPassword_: function(item, password) {
67 if (password) 67 if (password)
68 return password; 68 return password;
69 return item ? ' '.repeat(item.numCharactersInPassword) : ''; 69 return item ? ' '.repeat(item.numCharactersInPassword) : '';
70 }, 70 },
71 71
72 /** 72 /**
73 * @param {!KeyboardEvent} e
74 * @private
75 */
76 onKeypress_: function(e) {
77 if (e.key == 'Enter' && !this.$.actionButton.disabled)
78 this.onActionButtonTap_();
79 },
80
81 /**
82 * Handler for tapping the show/hide button. Will fire an event to request the 73 * Handler for tapping the show/hide button. Will fire an event to request the
83 * password for this login pair. 74 * password for this login pair.
84 * @private 75 * @private
85 */ 76 */
86 onShowPasswordButtonTap_: function() { 77 onShowPasswordButtonTap_: function() {
87 if (this.password) 78 if (this.password)
88 this.password = ''; 79 this.password = '';
89 else 80 else
90 this.fire('show-password', this.item.loginPair); // Request the password. 81 this.fire('show-password', this.item.loginPair); // Request the password.
91 }, 82 },
92 83
93 /** 84 /**
94 * Handler for tapping the 'done' button. Should just dismiss the dialog. 85 * Handler for tapping the 'done' button. Should just dismiss the dialog.
95 * @private 86 * @private
96 */ 87 */
97 onActionButtonTap_: function() { 88 onActionButtonTap_: function() {
98 this.close(); 89 this.close();
99 }, 90 },
100 91
101 /** 92 /**
102 * @param {!Event} event 93 * @param {!Event} event
103 * @private 94 * @private
104 */ 95 */
105 onReadonlyInputTap_: function(event) { 96 onReadonlyInputTap_: function(event) {
106 /** @type {!PaperInputElement} */ (Polymer.dom(event).localTarget) 97 /** @type {!PaperInputElement} */ (Polymer.dom(event).localTarget)
107 .inputElement.select(); 98 .inputElement.select();
108 } 99 }
109 }); 100 });
110 })(); 101 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698