Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / devtools / front_end / ui / ForwardedInputEventHandler.js
blob7ee28d552487fb1b91fc6c5465cd632918107967
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.
5 /**
6 * @constructor
7 */
8 WebInspector.ForwardedInputEventHandler = function()
10 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.KeyEventUnhandled, this._onKeyEventUnhandled, this);
13 WebInspector.ForwardedInputEventHandler.prototype = {
14 /**
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")
26 return;
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();