Chromium Code Reviews| Index: Source/devtools/front_end/ExtensionServer.js |
| diff --git a/Source/devtools/front_end/ExtensionServer.js b/Source/devtools/front_end/ExtensionServer.js |
| index c3e0e97e9744c38f6135f7040af1b2fc69a0fdcd..249b52168cfac35cbdda2b27b9c59ed8684f250b 100644 |
| --- a/Source/devtools/front_end/ExtensionServer.js |
| +++ b/Source/devtools/front_end/ExtensionServer.js |
| @@ -54,6 +54,7 @@ WebInspector.ExtensionServer = function() |
| this._registerHandler(commands.CreateSidebarPane, this._onCreateSidebarPane.bind(this)); |
| this._registerHandler(commands.CreateStatusBarButton, this._onCreateStatusBarButton.bind(this)); |
| this._registerHandler(commands.EvaluateOnInspectedPage, this._onEvaluateOnInspectedPage.bind(this)); |
| + this._registerHandler(commands.ForwardKeyboardEvent, this._onForwardKeyboardEvent.bind(this)); |
| this._registerHandler(commands.GetHAR, this._onGetHAR.bind(this)); |
| this._registerHandler(commands.GetConsoleMessages, this._onGetConsoleMessages.bind(this)); |
| this._registerHandler(commands.GetPageResources, this._onGetPageResources.bind(this)); |
| @@ -566,6 +567,25 @@ WebInspector.ExtensionServer.prototype = { |
| auditRun.done(); |
| }, |
| + _onForwardKeyboardEvent: function(message) |
| + { |
| + const Esc = "U+001B"; |
| + |
| + if (!message.ctrlKey && !message.altKey && !message.metaKey && !/^F\d+$/.test(message.keyIdentifier) && message.keyIdentifier != Esc) |
|
apavlov
2013/07/09 06:51:59
!==
|
| + return; |
| + // Fool around closure compiler -- it has it's own notion of both KeyboardEvent constructor |
|
apavlov
2013/07/09 06:51:59
"it's" -> "its"
|
| + // and initKeyboardEvent methods and overriding these in externs.js does not have effect. |
| + var event = new window.KeyboardEvent(message.eventType, { |
| + keyIdentifier: message.keyIdentifier, |
| + keyLocation: message.keyLocation, |
| + ctrlKey: message.ctrlKey, |
| + altKey: message.altKey, |
| + shiftKey: message.shiftKey, |
| + metaKey: message.metaKey |
| + }); |
| + document.dispatchEvent(event); |
| + }, |
| + |
| _dispatchCallback: function(requestId, port, result) |
| { |
| if (requestId) |