OLD | NEW |
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 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 // The UI to display and manage keyboard shortcuts set for extension commands. | 8 // The UI to display and manage keyboard shortcuts set for extension commands. |
9 var ShortcutInput = Polymer({ | 9 var ShortcutInput = Polymer({ |
10 is: 'extensions-shortcut-input', | 10 is: 'extensions-shortcut-input', |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 if (extensions.isValidKeyCode(e.keyCode)) { | 125 if (extensions.isValidKeyCode(e.keyCode)) { |
126 this.commitPending_(); | 126 this.commitPending_(); |
127 this.endCapture_(); | 127 this.endCapture_(); |
128 } | 128 } |
129 }, | 129 }, |
130 | 130 |
131 /** @private */ | 131 /** @private */ |
132 commitPending_: function() { | 132 commitPending_: function() { |
133 this.shortcut = this.pendingShortcut_; | 133 this.shortcut = this.pendingShortcut_; |
134 this.fire('shortcut-updated', {keybinding: this.shortcut, | 134 this.fire('shortcut-updated', { |
135 item: this.item, | 135 keybinding: this.shortcut, |
136 commandName: this.commandName}); | 136 item: this.item, |
| 137 commandName: this.commandName |
| 138 }); |
137 }, | 139 }, |
138 | 140 |
139 /** | 141 /** |
140 * @return {string} The text to be displayed in the shortcut field. | 142 * @return {string} The text to be displayed in the shortcut field. |
141 * @private | 143 * @private |
142 */ | 144 */ |
143 computeText_: function() { | 145 computeText_: function() { |
144 if (this.capturing_) | 146 if (this.capturing_) |
145 return this.pendingShortcut_; | 147 return this.pendingShortcut_; |
146 return this.shortcut; | 148 return this.shortcut; |
(...skipping 13 matching lines...) Expand all Loading... |
160 onClearTap_: function() { | 162 onClearTap_: function() { |
161 if (this.shortcut) { | 163 if (this.shortcut) { |
162 this.pendingShortcut_ = ''; | 164 this.pendingShortcut_ = ''; |
163 this.commitPending_(); | 165 this.commitPending_(); |
164 } | 166 } |
165 }, | 167 }, |
166 }); | 168 }); |
167 | 169 |
168 return {ShortcutInput: ShortcutInput}; | 170 return {ShortcutInput: ShortcutInput}; |
169 }); | 171 }); |
OLD | NEW |