Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: ui/keyboard/resources/elements/kb-key.html

Issue 43593003: Add layout switcher for virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting tweaks. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698