1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 WebInspector
.ForwardedInputEventHandler = function()
10 InspectorFrontendHost
.events
.addEventListener(InspectorFrontendHostAPI
.Events
.KeyEventUnhandled
, this._onKeyEventUnhandled
, this);
13 WebInspector
.ForwardedInputEventHandler
.prototype = {
15 * @param {!WebInspector.Event} event
17 _onKeyEventUnhandled: function(event
)
19 var data
= event
.data
;
20 var type
= /** @type {string} */ (data
.type
);
21 var keyIdentifier
= /** @type {string} */ (data
.keyIdentifier
);
22 var keyCode
= /** @type {number} */ (data
.keyCode
);
23 var modifiers
=/** @type {number} */ (data
.modifiers
);
25 if (type
!== "keydown")
28 WebInspector
.context
.setFlavor(WebInspector
.ShortcutRegistry
.ForwardedShortcut
, WebInspector
.ShortcutRegistry
.ForwardedShortcut
.instance
);
29 WebInspector
.shortcutRegistry
.handleKey(WebInspector
.KeyboardShortcut
.makeKey(keyCode
, modifiers
), keyIdentifier
);
30 WebInspector
.context
.setFlavor(WebInspector
.ShortcutRegistry
.ForwardedShortcut
, null);
34 /** @type {!WebInspector.ForwardedInputEventHandler} */
35 WebInspector
.forwardedEventHandler
= new WebInspector
.ForwardedInputEventHandler();