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 bc1011a90c9d92a38f37dea6359ffd5942d73e27..03ea62b8a04f70562a14bf355c15d7a1278f7a78 100644 |
--- a/ui/keyboard/resources/elements/kb-key.html |
+++ b/ui/keyboard/resources/elements/kb-key.html |
@@ -77,26 +77,38 @@ |
</script> |
</polymer-element> |
-<!-- |
- -- TODO(kevers): Rip this out if and when we are done implementing the proper |
- -- layout switcher. |
- --> |
-<polymer-element name="kb-layout-selector" class="layout-selector dark" char="Invalid" |
- extends="kb-key"> |
- <script> |
- Polymer('kb-layout-selector', { |
- toLayout: 'qwerty' |
- }); |
- </script> |
-</polymer-element> |
- |
-<polymer-element name="kb-hide-keyboard-key" class="hide-keyboard dark" char="Invalid" |
- extends="kb-key"> |
+<polymer-element name="kb-hide-keyboard-key" class="hide-keyboard dark" |
+ char="Invalid" extends="kb-key"> |
<script> |
Polymer('kb-hide-keyboard-key', { |
- down: function(event) {}, |
+ /** |
+ * Timer for a long press event which triggers the display of a keyboard |
+ * options menu. |
+ * @type {?Function} |
+ */ |
+ longPressTimer: undefined, |
+ |
+ down: function(event) { |
+ var self = this; |
+ this.longPressTimer = this.asyncMethod(function() { |
+ if (self.longPressTimer) { |
+ clearTimeout(self.longPressTimer); |
+ self.longPressTimer = undefined; |
+ var details = { |
+ left: this.offsetLeft, |
+ top: this.offsetTop, |
+ width: this.clientWidth, |
+ }; |
+ this.fire('show-options', details); |
+ } |
+ }, null, LONGPRESS_DELAY_MSEC); |
+ }, |
+ |
up: function(event) { |
- hideKeyboard(); |
+ if (this.longPressTimer) { |
+ hideKeyboard(); |
+ this.longPressTimer = undefined; |
+ } |
} |
}); |
</script> |