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

Unified Diff: remoting/tools/javascript_key_tester/event_listeners.js

Issue 882063007: Improve consistency between event sources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | remoting/tools/javascript_key_tester/keyboard_map.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/tools/javascript_key_tester/event_listeners.js
diff --git a/remoting/tools/javascript_key_tester/event_listeners.js b/remoting/tools/javascript_key_tester/event_listeners.js
index 73c67e997cafea5a9a59bf75870949270f9c3448..529a08d69adf49f1b3b890393e007bbaf4492266 100644
--- a/remoting/tools/javascript_key_tester/event_listeners.js
+++ b/remoting/tools/javascript_key_tester/event_listeners.js
@@ -34,6 +34,7 @@ var EventListeners = function(jsLog, pnaclLog, textLog,
this.onKeyDownHandler_ = this.onKeyDown_.bind(this);
this.onKeyUpHandler_ = this.onKeyUp_.bind(this);
+ this.onKeyPressHandler_ = this.onKeyPress_.bind(this);
this.onMessageHandler_ = this.onMessage_.bind(this);
this.onBlurHandler_ = this.onBlur_.bind(this);
@@ -49,6 +50,7 @@ var EventListeners = function(jsLog, pnaclLog, textLog,
EventListeners.prototype.activate = function() {
document.body.addEventListener('keydown', this.onKeyDownHandler_, false);
document.body.addEventListener('keyup', this.onKeyUpHandler_, false);
+ document.body.addEventListener('keypress', this.onKeyPressHandler_, false);
this.pnaclListener_.addEventListener('message', this.onMessageHandler_, true);
this.pnaclPlugin_.addEventListener('blur', this.onBlurHandler_, false);
this.onBlur_();
@@ -60,6 +62,7 @@ EventListeners.prototype.activate = function() {
EventListeners.prototype.deactivate = function() {
document.body.removeEventListener('keydown', this.onKeyDownHandler_, false);
document.body.removeEventListener('keyup', this.onKeyUpHandler_, false);
+ document.body.removeEventListener('keypress', this.onKeyPressHandler_, false);
this.pnaclListener_.removeEventListener(
'message', this.onMessageHandler_, true);
this.pnaclPlugin_.removeEventListener('blur', this.onBlurHandler_, false);
@@ -89,6 +92,17 @@ EventListeners.prototype.onKeyUp_ = function(event) {
* @param {Event} event
* @return {void}
*/
+EventListeners.prototype.onKeyPress_ = function(event) {
+ this.appendToTextLog_(this.jsonifyJavascriptKeyEvent_(event, 'keypress'));
+ this.jsChordTracker_.addCharEvent(
+ String.fromCharCode(event.keyCode),
+ this.jsonifyJavascriptKeyEvent_(event, 'keypress', 2));
+}
+
+/**
+ * @param {Event} event
+ * @return {void}
+ */
EventListeners.prototype.onMessage_ = function (event) {
var pnaclEvent = /** @type {PNaClEvent} */ (event['data']);
« no previous file with comments | « no previous file | remoting/tools/javascript_key_tester/keyboard_map.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698