Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 setBackgroundImage: function(iconURL) | 659 setBackgroundImage: function(iconURL) |
| 660 { | 660 { |
| 661 this.element.style.backgroundImage = "url(" + iconURL + ")"; | 661 this.element.style.backgroundImage = "url(" + iconURL + ")"; |
| 662 this._glyphElement.classList.add("hidden"); | 662 this._glyphElement.classList.add("hidden"); |
| 663 }, | 663 }, |
| 664 | 664 |
| 665 __proto__: WebInspector.ToolbarButtonBase.prototype | 665 __proto__: WebInspector.ToolbarButtonBase.prototype |
| 666 } | 666 } |
| 667 | 667 |
| 668 /** | 668 /** |
| 669 * @param {string} actionId | |
| 670 * @return {!WebInspector.ToolbarButton} | |
| 671 */ | |
| 672 WebInspector.ToolbarButton.createActionButton = function(actionId) | |
| 673 { | |
| 674 var action = WebInspector.actionRegistry.getActionDescriptor(actionId); | |
|
pfeldman
2015/08/18 05:08:31
I would expose actionTitle and actionIcon by id in
samli
2015/08/19 05:27:15
Done.
| |
| 675 var button = new WebInspector.ToolbarButton(action["title"] || "", action["i conClass"]); | |
| 676 button.setAction(actionId); | |
| 677 return button; | |
| 678 } | |
| 679 | |
| 680 /** | |
| 669 * @constructor | 681 * @constructor |
| 670 * @extends {WebInspector.ToolbarButton} | 682 * @extends {WebInspector.ToolbarButton} |
| 671 * @param {string} title | 683 * @param {string} title |
| 672 * @param {string} className | 684 * @param {string} className |
| 673 * @param {function(!WebInspector.ContextMenu)} contextMenuHandler | 685 * @param {function(!WebInspector.ContextMenu)} contextMenuHandler |
| 674 */ | 686 */ |
| 675 WebInspector.ToolbarMenuButton = function(title, className, contextMenuHandler) | 687 WebInspector.ToolbarMenuButton = function(title, className, contextMenuHandler) |
| 676 { | 688 { |
| 677 WebInspector.ToolbarButton.call(this, title, className); | 689 WebInspector.ToolbarButton.call(this, title, className); |
| 678 this._contextMenuHandler = contextMenuHandler; | 690 this._contextMenuHandler = contextMenuHandler; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 for (var i = 0; i < items.length; ++i) { | 1029 for (var i = 0; i < items.length; ++i) { |
| 1018 var item = items[i]; | 1030 var item = items[i]; |
| 1019 if (item) | 1031 if (item) |
| 1020 this.appendToolbarItem(item); | 1032 this.appendToolbarItem(item); |
| 1021 } | 1033 } |
| 1022 } | 1034 } |
| 1023 }, | 1035 }, |
| 1024 | 1036 |
| 1025 __proto__: WebInspector.Toolbar.prototype | 1037 __proto__: WebInspector.Toolbar.prototype |
| 1026 } | 1038 } |
| OLD | NEW |