Chromium Code Reviews| 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.ActionRegistry = function() | 8 WebInspector.ActionRegistry = function() |
| 9 { | 9 { |
| 10 /** @type {!Map.<string, !Runtime.Extension>} */ | 10 /** @type {!Map.<string, !Runtime.Extension>} */ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 console.assert(extension, "No action found for actionId '" + actionId + "'"); | 58 console.assert(extension, "No action found for actionId '" + actionId + "'"); |
| 59 return extension.instancePromise().then(handleAction); | 59 return extension.instancePromise().then(handleAction); |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * @param {!Object} actionDelegate | 62 * @param {!Object} actionDelegate |
| 63 */ | 63 */ |
| 64 function handleAction(actionDelegate) | 64 function handleAction(actionDelegate) |
| 65 { | 65 { |
| 66 /** @type {!WebInspector.ActionDelegate} */(actionDelegate).handleAc tion(WebInspector.context, actionId); | 66 /** @type {!WebInspector.ActionDelegate} */(actionDelegate).handleAc tion(WebInspector.context, actionId); |
| 67 } | 67 } |
| 68 }, | |
| 69 | |
| 70 /** | |
| 71 * @param {string} actionId | |
| 72 * @return {!Object} | |
| 73 */ | |
| 74 getActionDescriptor: function(actionId) | |
|
pfeldman
2015/08/18 05:08:31
s/get//
samli
2015/08/19 05:27:15
Ack.
| |
| 75 { | |
| 76 var extension = this._actionsById.get(actionId); | |
| 77 console.assert(extension, "No action found for actionId '" + actionId + "'"); | |
| 78 return extension.descriptor(); | |
| 68 } | 79 } |
| 69 } | 80 } |
| 70 | 81 |
| 71 /** | 82 /** |
| 72 * @interface | 83 * @interface |
| 73 */ | 84 */ |
| 74 WebInspector.ActionDelegate = function() | 85 WebInspector.ActionDelegate = function() |
| 75 { | 86 { |
| 76 } | 87 } |
| 77 | 88 |
| 78 WebInspector.ActionDelegate.prototype = { | 89 WebInspector.ActionDelegate.prototype = { |
| 79 /** | 90 /** |
| 80 * @param {!WebInspector.Context} context | 91 * @param {!WebInspector.Context} context |
| 81 * @param {string} actionId | 92 * @param {string} actionId |
| 82 */ | 93 */ |
| 83 handleAction: function(context, actionId) {} | 94 handleAction: function(context, actionId) {} |
| 84 } | 95 } |
| 85 | 96 |
| 86 /** @type {!WebInspector.ActionRegistry} */ | 97 /** @type {!WebInspector.ActionRegistry} */ |
| 87 WebInspector.actionRegistry; | 98 WebInspector.actionRegistry; |
| OLD | NEW |