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

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

Issue 730573002: Remove dead code for system VK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « ui/keyboard/resources/elements/kb-modifier-key.html ('k') | ui/keyboard/resources/elements/kb-row.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/resources/elements/kb-modifier-key.js
diff --git a/ui/keyboard/resources/elements/kb-modifier-key.js b/ui/keyboard/resources/elements/kb-modifier-key.js
deleted file mode 100644
index 0f9fd8a1da03cecd9962c34756e44ce8bad1faaa..0000000000000000000000000000000000000000
--- a/ui/keyboard/resources/elements/kb-modifier-key.js
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function () {
-
- /**
- * The possible states of the key.
- * @const
- * @type {Enum}
- */
- var KEY_STATES = {
- PRESSED: "pressed", // Key-down.
- UNLOCKED: "unlocked", // Default state.
- TAPPED: "tapped", // Key-down followed by key-up.
- CHORDING: "chording", // Chording mode.
- };
-
- /**
- * A map of the state of all modifier keys.
- * @type {Object}
- */
- var states = {};
-
- Polymer('kb-modifier-key', {
- up: function(event) {
- if (this.state == KEY_STATES.PRESSED)
- this.state = KEY_STATES.TAPPED;
- else
- this.state = KEY_STATES.UNLOCKED;
- this.super([event]);
- },
-
- down: function(event) {
- // First transition state so that populateDetails generates
- // correct data.
- switch (this.state) {
- case KEY_STATES.UNLOCKED:
- this.state = KEY_STATES.PRESSED;
- break;
- case KEY_STATES.TAPPED:
- this.state = KEY_STATES.UNLOCKED;
- break;
- case KEY_STATES.PRESSED:
- case KEY_STATES.CHORDING:
- // We pressed another key at the same time,
- // so ignore second press.
- return;
- default:
- console.error("Undefined key state: " + state);
- break;
- }
- this.super([event]);
- },
-
- /**
- * Returns whether the modifier for this key is active.
- * @return {boolean}
- */
- isActive: function() {
- return this.state != KEY_STATES.UNLOCKED;
- },
-
- /**
- * Notifies key that a non-control keyed down.
- * A control key is defined as one of shift, control or alt.
- */
- onNonControlKeyDown: function() {
- switch(this.state) {
- case (KEY_STATES.PRESSED):
- this.state = KEY_STATES.CHORDING;
- break;
- }
- },
-
- /**
- * Notifies key that a non-control keyed was typed.
- * A control key is defined as one of shift, control or alt.
- */
- onNonControlKeyTyped: function() {
- switch(this.state) {
- case (KEY_STATES.TAPPED):
- this.state = KEY_STATES.UNLOCKED;
- break;
- }
- },
-
- /**
- * Called on a pointer-out event. Ends chording.
- * @param {event} event The pointer-out event.
- */
- out: function(event) {
- // TODO(rsadam): Add chording event so that we don't reset
- // when shift-chording.
- if (this.state == KEY_STATES.CHORDING) {
- this.state = KEY_STATES.UNLOCKED;
- }
- },
-
- /*
- * Overrides the autoRelease function to enable chording.
- */
- autoRelease: function() {
- },
-
- populateDetails: function(caller) {
- var detail = this.super([caller]);
- if (this.state != KEY_STATES.UNLOCKED)
- detail.activeModifier = this.charValue;
- return detail;
- },
-
- /**
- * Resets the modifier key state.
- */
- reset: function() {
- this.state = KEY_STATES.UNLOCKED;
- },
-
- get state() {
- var key = this.charValue;
- if (!key)
- console.error("missing key for kb-modifier-key state: " + this);
- // All keys default to the unlock state.
- if (!(key in states))
- states[key] = KEY_STATES.UNLOCKED;
- return states[key];
- },
-
- set state(value) {
- var key = this.charValue;
- states[key] = value;
- }
- });
-})();
« no previous file with comments | « ui/keyboard/resources/elements/kb-modifier-key.html ('k') | ui/keyboard/resources/elements/kb-row.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698