| OLD | NEW |
| 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.accounts', function() { | 5 cr.define('options.accounts', function() { |
| 6 /** | 6 /** |
| 7 * Email alias only, assuming it's a gmail address. | 7 * Email alias only, assuming it's a gmail address. |
| 8 * e.g. 'john' | 8 * e.g. 'john' |
| 9 * {name: 'john', email: 'john@gmail.com'} | 9 * {name: 'john', email: 'john@gmail.com'} |
| 10 * @const | 10 * @const |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 return null; | 102 return null; |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Handler for key down event. | 106 * Handler for key down event. |
| 107 * @private | 107 * @private |
| 108 * @param {Event} e The keydown event object. | 108 * @param {Event} e The keydown event object. |
| 109 */ | 109 */ |
| 110 handleKeyDown_: function(e) { | 110 handleKeyDown_: function(e) { |
| 111 if (e.keyIdentifier == 'Enter') { | 111 if (e.key == 'Enter') { |
| 112 var user = this.parse(this.value); | 112 var user = this.parse(this.value); |
| 113 if (user) { | 113 if (user) { |
| 114 var event = new Event('add'); | 114 var event = new Event('add'); |
| 115 event.user = user; | 115 event.user = user; |
| 116 this.dispatchEvent(event); | 116 this.dispatchEvent(event); |
| 117 } | 117 } |
| 118 this.select(); | 118 this.select(); |
| 119 // Avoid double-handling so the dialog doesn't close. | 119 // Avoid double-handling so the dialog doesn't close. |
| 120 e.stopPropagation(); | 120 e.stopPropagation(); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 return { | 125 return { |
| 126 UserNameEdit: UserNameEdit | 126 UserNameEdit: UserNameEdit |
| 127 }; | 127 }; |
| 128 }); | 128 }); |
| 129 | 129 |
| OLD | NEW |