| 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', |
| 11 | 11 |
| 12 behaviors: [I18nBehavior], |
| 13 |
| 12 properties: { | 14 properties: { |
| 13 item: { | 15 item: { |
| 14 type: String, | 16 type: String, |
| 15 value: '', | 17 value: '', |
| 16 }, | 18 }, |
| 17 commandName: { | 19 commandName: { |
| 18 type: String, | 20 type: String, |
| 19 value: '', | 21 value: '', |
| 20 }, | 22 }, |
| 21 shortcut: { | 23 shortcut: { |
| 22 type: String, | 24 type: String, |
| 23 value: '', | 25 value: '', |
| 24 }, | 26 }, |
| 25 /** @private */ | 27 /** @private */ |
| 26 capturing_: { | 28 capturing_: { |
| 27 type: Boolean, | 29 type: Boolean, |
| 28 value: false, | 30 value: false, |
| 29 }, | 31 }, |
| 30 /** @private */ | 32 /** @private */ |
| 31 pendingShortcut_: { | 33 pendingShortcut_: { |
| 32 type: String, | 34 type: String, |
| 33 value: '', | 35 value: '', |
| 34 }, | 36 }, |
| 35 }, | 37 }, |
| 36 | 38 |
| 37 behaviors: [I18nBehavior], | |
| 38 | |
| 39 ready: function() { | 39 ready: function() { |
| 40 var node = this.$['input']; | 40 var node = this.$['input']; |
| 41 node.addEventListener('mouseup', this.startCapture_.bind(this)); | 41 node.addEventListener('mouseup', this.startCapture_.bind(this)); |
| 42 node.addEventListener('blur', this.endCapture_.bind(this)); | 42 node.addEventListener('blur', this.endCapture_.bind(this)); |
| 43 node.addEventListener('focus', this.startCapture_.bind(this)); | 43 node.addEventListener('focus', this.startCapture_.bind(this)); |
| 44 node.addEventListener('keydown', this.onKeyDown_.bind(this)); | 44 node.addEventListener('keydown', this.onKeyDown_.bind(this)); |
| 45 node.addEventListener('keyup', this.onKeyUp_.bind(this)); | 45 node.addEventListener('keyup', this.onKeyUp_.bind(this)); |
| 46 }, | 46 }, |
| 47 | 47 |
| 48 /** @private */ | 48 /** @private */ |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 onClearTap_: function() { | 150 onClearTap_: function() { |
| 151 if (this.shortcut) { | 151 if (this.shortcut) { |
| 152 this.pendingShortcut_ = ''; | 152 this.pendingShortcut_ = ''; |
| 153 this.commitPending_(); | 153 this.commitPending_(); |
| 154 } | 154 } |
| 155 }, | 155 }, |
| 156 }); | 156 }); |
| 157 | 157 |
| 158 return {ShortcutInput: ShortcutInput}; | 158 return {ShortcutInput: ShortcutInput}; |
| 159 }); | 159 }); |
| OLD | NEW |