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 * @param {!WebInspector.ActionRegistry} actionRegistry | 7 * @param {!WebInspector.ActionRegistry} actionRegistry |
8 * @param {!Document} document | 8 * @param {!Document} document |
9 */ | 9 */ |
10 WebInspector.ShortcutRegistry = function(actionRegistry, document) | 10 WebInspector.ShortcutRegistry = function(actionRegistry, document) |
11 { | 11 { |
12 this._actionRegistry = actionRegistry; | 12 this._actionRegistry = actionRegistry; |
13 /** @type {!Multimap.<string, string>} */ | 13 /** @type {!Multimap.<string, string>} */ |
14 this._defaultKeyToActions = new Multimap(); | 14 this._defaultKeyToActions = new Multimap(); |
15 /** @type {!Multimap.<string, !WebInspector.KeyboardShortcut.Descriptor>} */ | 15 /** @type {!Multimap.<string, !WebInspector.KeyboardShortcut.Descriptor>} */ |
16 this._defaultActionToShortcut = new Multimap(); | 16 this._defaultActionToShortcut = new Multimap(); |
17 this._registerBindings(document); | 17 this._registerBindings(document); |
18 } | 18 }; |
19 | 19 |
20 WebInspector.ShortcutRegistry.prototype = { | 20 WebInspector.ShortcutRegistry.prototype = { |
21 /** | 21 /** |
22 * @param {number} key | 22 * @param {number} key |
23 * @return {!Array.<!WebInspector.Action>} | 23 * @return {!Array.<!WebInspector.Action>} |
24 */ | 24 */ |
25 _applicableActions: function(key) | 25 _applicableActions: function(key) |
26 { | 26 { |
27 return this._actionRegistry.applicableActions(this._defaultActionsForKey
(key).valuesArray(), WebInspector.context); | 27 return this._actionRegistry.applicableActions(this._defaultActionsForKey
(key).valuesArray(), WebInspector.context); |
28 }, | 28 }, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (!platformsString) | 201 if (!platformsString) |
202 return true; | 202 return true; |
203 var platforms = platformsString.split(","); | 203 var platforms = platformsString.split(","); |
204 var isMatch = false; | 204 var isMatch = false; |
205 var currentPlatform = WebInspector.platform(); | 205 var currentPlatform = WebInspector.platform(); |
206 for (var i = 0; !isMatch && i < platforms.length; ++i) | 206 for (var i = 0; !isMatch && i < platforms.length; ++i) |
207 isMatch = platforms[i] === currentPlatform; | 207 isMatch = platforms[i] === currentPlatform; |
208 return isMatch; | 208 return isMatch; |
209 } | 209 } |
210 } | 210 } |
211 } | 211 }; |
212 | 212 |
213 /** | 213 /** |
214 * @constructor | 214 * @constructor |
215 */ | 215 */ |
216 WebInspector.ShortcutRegistry.ForwardedShortcut = function() | 216 WebInspector.ShortcutRegistry.ForwardedShortcut = function() |
217 { | 217 { |
218 } | 218 }; |
219 | 219 |
220 WebInspector.ShortcutRegistry.ForwardedShortcut.instance = new WebInspector.Shor
tcutRegistry.ForwardedShortcut(); | 220 WebInspector.ShortcutRegistry.ForwardedShortcut.instance = new WebInspector.Shor
tcutRegistry.ForwardedShortcut(); |
221 | 221 |
222 /** @type {!WebInspector.ShortcutRegistry} */ | 222 /** @type {!WebInspector.ShortcutRegistry} */ |
223 WebInspector.shortcutRegistry; | 223 WebInspector.shortcutRegistry; |
OLD | NEW |