OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 */ | 7 */ |
8 WebInspector.ForwardedInputEventHandler = function() | 8 WebInspector.ForwardedInputEventHandler = function() |
9 { | 9 { |
10 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.KeyEventUnhandled, this._onKeyEventUnhandled, this); | 10 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.KeyEventUnhandled, this._onKeyEventUnhandled, this); |
11 } | 11 } |
12 | 12 |
13 WebInspector.ForwardedInputEventHandler.prototype = { | 13 WebInspector.ForwardedInputEventHandler.prototype = { |
14 /** | 14 /** |
15 * @param {!WebInspector.Event} event | 15 * @param {!WebInspector.Event} event |
16 */ | 16 */ |
17 _onKeyEventUnhandled: function(event) | 17 _onKeyEventUnhandled: function(event) |
18 { | 18 { |
19 var data = event.data; | 19 var data = event.data; |
20 var type = /** @type {string} */ (data.type); | 20 var type = /** @type {string} */ (data.type); |
21 var keyIdentifier = /** @type {string} */ (data.keyIdentifier); | 21 var key = /** @type {string} */ (data.key); |
22 var keyCode = /** @type {number} */ (data.keyCode); | 22 var keyCode = /** @type {number} */ (data.keyCode); |
23 var modifiers =/** @type {number} */ (data.modifiers); | 23 var modifiers =/** @type {number} */ (data.modifiers); |
24 | 24 |
25 if (type !== "keydown") | 25 if (type !== "keydown") |
26 return; | 26 return; |
27 | 27 |
28 WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedSh
ortcut, WebInspector.ShortcutRegistry.ForwardedShortcut.instance); | 28 WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedSh
ortcut, WebInspector.ShortcutRegistry.ForwardedShortcut.instance); |
29 WebInspector.shortcutRegistry.handleKey(WebInspector.KeyboardShortcut.ma
keKey(keyCode, modifiers), keyIdentifier); | 29 WebInspector.shortcutRegistry.handleKey(WebInspector.KeyboardShortcut.ma
keKey(keyCode, modifiers), key); |
30 WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedSh
ortcut, null); | 30 WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedSh
ortcut, null); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 /** @type {!WebInspector.ForwardedInputEventHandler} */ | 34 /** @type {!WebInspector.ForwardedInputEventHandler} */ |
35 WebInspector.forwardedEventHandler = new WebInspector.ForwardedInputEventHandler
(); | 35 WebInspector.forwardedEventHandler = new WebInspector.ForwardedInputEventHandler
(); |
OLD | NEW |