| 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
|
| */
|
|
|