| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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. | 
|  | 4 | 
|  | 5 /** | 
|  | 6  * @constructor | 
|  | 7  */ | 
|  | 8 WebInspector.ActionRegistry = function() | 
|  | 9 { | 
|  | 10     /** @type {!StringMap.<!WebInspector.ModuleManager.Extension>} */ | 
|  | 11     this._actionsById = new StringMap(); | 
|  | 12     this._registerActions(); | 
|  | 13 } | 
|  | 14 | 
|  | 15 WebInspector.ActionRegistry.prototype = { | 
|  | 16     _registerActions: function() | 
|  | 17     { | 
|  | 18         WebInspector.moduleManager.extensions(WebInspector.ActionDelegate).forEa
    ch(registerExtension, this); | 
|  | 19 | 
|  | 20         /** | 
|  | 21          * @param {!WebInspector.ModuleManager.Extension} extension | 
|  | 22          * @this {WebInspector.ActionRegistry} | 
|  | 23          */ | 
|  | 24         function registerExtension(extension) | 
|  | 25         { | 
|  | 26             var actionId = extension.descriptor()["actionId"]; | 
|  | 27             console.assert(actionId); | 
|  | 28             console.assert(!this._actionsById.get(actionId)); | 
|  | 29             this._actionsById.put(actionId, extension); | 
|  | 30         } | 
|  | 31     }, | 
|  | 32 | 
|  | 33     /** | 
|  | 34      * @param {string} actionId | 
|  | 35      * @param {!Event} event | 
|  | 36      * @return {boolean} | 
|  | 37      */ | 
|  | 38     execute: function(actionId, event) | 
|  | 39     { | 
|  | 40         var extension = this._actionsById.get(actionId); | 
|  | 41         console.assert(extension, "No action found for actionId '" + actionId + 
    "'"); | 
|  | 42         return extension.instance().handleAction(WebInspector.context, event); | 
|  | 43     } | 
|  | 44 } | 
|  | 45 | 
|  | 46 /** | 
|  | 47  * @interface | 
|  | 48  */ | 
|  | 49 WebInspector.ActionDelegate = function() | 
|  | 50 { | 
|  | 51 } | 
|  | 52 | 
|  | 53 WebInspector.ActionDelegate.prototype = { | 
|  | 54     /** | 
|  | 55      * @param {!WebInspector.Context} context | 
|  | 56      * @param {!Event} event | 
|  | 57      * @return {boolean} | 
|  | 58      */ | 
|  | 59     handleAction: function(context, event) {} | 
|  | 60 } | 
|  | 61 | 
|  | 62 /** @type {!WebInspector.ActionRegistry} */ | 
|  | 63 WebInspector.actionRegistry; | 
| OLD | NEW | 
|---|