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

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

Issue 868663007: Reinstated onBlur handler and added images for CWS. (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 | « remoting/remoting_key_tester.gypi ('k') | remoting/tools/javascript_key_tester/icon_128.png » ('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..f20385ca38d0ce21f7401b59bcc176688aa9d488 100644
--- a/remoting/tools/javascript_key_tester/event_listeners.js
+++ b/remoting/tools/javascript_key_tester/event_listeners.js
@@ -35,7 +35,8 @@ var EventListeners = function(jsLog, pnaclLog, textLog,
this.onKeyDownHandler_ = this.onKeyDown_.bind(this);
this.onKeyUpHandler_ = this.onKeyUp_.bind(this);
this.onMessageHandler_ = this.onMessage_.bind(this);
- this.onBlurHandler_ = this.onBlur_.bind(this);
+ this.onPluginBlurHandler_ = this.onPluginBlur_.bind(this);
+ this.onWindowBlurHandler_ = this.onWindowBlur_.bind(this);
this.jsChordTracker_ = new ChordTracker(jsLog);
this.pnaclChordTracker_ = new ChordTracker(pnaclLog);
@@ -47,22 +48,25 @@ var EventListeners = function(jsLog, pnaclLog, textLog,
* Start listening for keyboard events.
*/
EventListeners.prototype.activate = function() {
+ window.addEventListener('blur', this.onWindowBlurHandler_, false);
document.body.addEventListener('keydown', this.onKeyDownHandler_, false);
document.body.addEventListener('keyup', this.onKeyUpHandler_, false);
this.pnaclListener_.addEventListener('message', this.onMessageHandler_, true);
- this.pnaclPlugin_.addEventListener('blur', this.onBlurHandler_, false);
- this.onBlur_();
+ this.pnaclPlugin_.addEventListener('blur', this.onPluginBlurHandler_, false);
+ this.onPluginBlur_();
};
/**
* Stop listening for keyboard events.
*/
EventListeners.prototype.deactivate = function() {
+ window.removeEventListener('blur', this.onWindowBlurHandler_, false);
document.body.removeEventListener('keydown', this.onKeyDownHandler_, false);
document.body.removeEventListener('keyup', this.onKeyUpHandler_, false);
this.pnaclListener_.removeEventListener(
'message', this.onMessageHandler_, true);
- this.pnaclPlugin_.removeEventListener('blur', this.onBlurHandler_, false);
+ this.pnaclPlugin_.removeEventListener(
+ 'blur', this.onPluginBlurHandler_, false);
};
/**
@@ -108,11 +112,19 @@ EventListeners.prototype.onMessage_ = function (event) {
/**
* @return {void}
*/
-EventListeners.prototype.onBlur_ = function() {
+EventListeners.prototype.onPluginBlur_ = function() {
this.pnaclPlugin_.focus();
};
/**
+ * @return {void}
+ */
+EventListeners.prototype.onWindowBlur_ = function() {
+ this.jsChordTracker_.releaseAllKeys();
+ this.pnaclChordTracker_.releaseAllKeys();
+};
+
+/**
* @param {string} str
* @private
*/
« no previous file with comments | « remoting/remoting_key_tester.gypi ('k') | remoting/tools/javascript_key_tester/icon_128.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698