Index: ui/keyboard/resources/elements/kb-key.html |
diff --git a/ui/keyboard/resources/elements/kb-key.html b/ui/keyboard/resources/elements/kb-key.html |
index 75033967571603a62532c080254afcb564380718..aafb53b9ff3ba5d01be504f255190456641a0bec 100644 |
--- a/ui/keyboard/resources/elements/kb-key.html |
+++ b/ui/keyboard/resources/elements/kb-key.html |
@@ -60,27 +60,50 @@ |
<polymer-element name="kb-shift-key" attributes="unlockedCase lockedCase" |
class="shift dark" char="Shift" extends="kb-key"> |
<script> |
- Polymer('kb-shift-key', { |
- /** |
- * Defines how capslock effects keyset transition. We always transition |
- * from the unlockedCase to the lockedCase if capslock is on. |
- * @type {string} |
- */ |
- unlockedCase: 'lower', |
- lockedCase: 'upper', |
- down: function(event) { |
- this.super(); |
- var detail = {}; |
- if (this.keysetRules && this.keysetRules.dbl != undefined) { |
- detail.char = this.char || this.textContent; |
- detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET]; |
- detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET]; |
- } |
- this.fire('enable-dbl', detail); |
- this.fire('enable-sel'); |
- }, |
- }); |
+ (function () { |
+ /** |
+ * Uses a closure to define one long press timer among all shift keys |
+ * regardless of the layout they are in. |
+ * @type {function} |
+ */ |
+ var shiftLongPressTimer = undefined; |
+ |
+ Polymer('kb-shift-key', { |
+ /** |
+ * Defines how capslock effects keyset transition. We always transition |
+ * from the unlockedCase to the lockedCase if capslock is on. |
+ * @type {string} |
+ */ |
+ unlockedCase: 'lower', |
+ lockedCase: 'upper', |
+ control: true, |
+ |
+ down: function(event) { |
+ this.super(); |
+ var detail = {}; |
+ if (this.keysetRules && this.keysetRules.dbl != undefined) { |
+ detail.char = this.char || this.textContent; |
+ detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET]; |
+ detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET]; |
+ } |
+ this.fire('enable-dbl', detail); |
+ this.fire('enable-sel'); |
+ }, |
+ |
+ /** |
+ * Overrides longPressTimer for the shift key. |
+ */ |
+ get longPressTimer() { |
+ return shiftLongPressTimer; |
+ }, |
+ |
+ set longPressTimer(timer) { |
+ shiftLongPressTimer = timer; |
+ }, |
+ }); |
+ })(); |
+ |
</script> |
</polymer-element> |