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 {string} |
| 73 */ |
| 74 actionTitle: function(actionId) |
| 75 { |
| 76 var extension = this._actionsById.get(actionId); |
| 77 console.assert(extension, "No action found for actionId '" + actionId +
"'"); |
| 78 return extension.descriptor()["title"] || ""; |
| 79 }, |
| 80 |
| 81 /** |
| 82 * @param {string} actionId |
| 83 * @return {string} |
| 84 */ |
| 85 actionIcon: function(actionId) |
| 86 { |
| 87 var extension = this._actionsById.get(actionId); |
| 88 console.assert(extension, "No action found for actionId '" + actionId +
"'"); |
| 89 return extension.descriptor()["iconClass"] || ""; |
68 } | 90 } |
69 } | 91 } |
70 | 92 |
71 /** | 93 /** |
72 * @interface | 94 * @interface |
73 */ | 95 */ |
74 WebInspector.ActionDelegate = function() | 96 WebInspector.ActionDelegate = function() |
75 { | 97 { |
76 } | 98 } |
77 | 99 |
78 WebInspector.ActionDelegate.prototype = { | 100 WebInspector.ActionDelegate.prototype = { |
79 /** | 101 /** |
80 * @param {!WebInspector.Context} context | 102 * @param {!WebInspector.Context} context |
81 * @param {string} actionId | 103 * @param {string} actionId |
82 */ | 104 */ |
83 handleAction: function(context, actionId) {} | 105 handleAction: function(context, actionId) {} |
84 } | 106 } |
85 | 107 |
86 /** @type {!WebInspector.ActionRegistry} */ | 108 /** @type {!WebInspector.ActionRegistry} */ |
87 WebInspector.actionRegistry; | 109 WebInspector.actionRegistry; |
OLD | NEW |