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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 buttons[i].element.classList.remove("emulate-active"); | 615 buttons[i].element.classList.remove("emulate-active"); |
| 616 buttons[i]._clicked(e); | 616 buttons[i]._clicked(e); |
| 617 break; | 617 break; |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 | 623 |
| 624 /** | 624 /** |
| 625 * @param {string} actionId | |
| 626 * @return {?WebInspector.ToolbarItem} | |
| 627 */ | |
| 628 WebInspector.Toolbar.createActionButtonForId = function(actionId) | |
| 629 { | |
| 630 var action = WebInspector.actionRegistry.action(actionId); | |
| 631 return /** @type {?WebInspector.ToolbarItem} */(action ? WebInspector.Toolba r.createActionButton(action) : null) | |
|
dgozman
2016/08/11 01:42:16
style: semicolon
| |
| 632 } | |
| 633 | |
| 634 /** | |
| 625 * @constructor | 635 * @constructor |
| 626 * @extends {WebInspector.ToolbarButton} | 636 * @extends {WebInspector.ToolbarButton} |
| 627 * @param {function(!WebInspector.ContextMenu)} contextMenuHandler | 637 * @param {function(!WebInspector.ContextMenu)} contextMenuHandler |
| 628 * @param {boolean=} useSoftMenu | 638 * @param {boolean=} useSoftMenu |
| 629 */ | 639 */ |
| 630 WebInspector.ToolbarMenuButton = function(contextMenuHandler, useSoftMenu) | 640 WebInspector.ToolbarMenuButton = function(contextMenuHandler, useSoftMenu) |
| 631 { | 641 { |
| 632 WebInspector.ToolbarButton.call(this, "", "menu-toolbar-item"); | 642 WebInspector.ToolbarButton.call(this, "", "menu-toolbar-item"); |
| 633 this._contextMenuHandler = contextMenuHandler; | 643 this._contextMenuHandler = contextMenuHandler; |
| 634 this._useSoftMenu = !!useSoftMenu; | 644 this._useSoftMenu = !!useSoftMenu; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 } | 750 } |
| 741 | 751 |
| 742 WebInspector.ToolbarItem.Provider.prototype = { | 752 WebInspector.ToolbarItem.Provider.prototype = { |
| 743 /** | 753 /** |
| 744 * @return {?WebInspector.ToolbarItem} | 754 * @return {?WebInspector.ToolbarItem} |
| 745 */ | 755 */ |
| 746 item: function() {} | 756 item: function() {} |
| 747 } | 757 } |
| 748 | 758 |
| 749 /** | 759 /** |
| 760 * @interface | |
| 761 */ | |
| 762 WebInspector.ToolbarItem.ItemsProvider = function() | |
| 763 { | |
| 764 } | |
| 765 | |
| 766 WebInspector.ToolbarItem.ItemsProvider.prototype = { | |
| 767 /** | |
| 768 * @return {!Array<!WebInspector.ToolbarItem>} | |
| 769 */ | |
| 770 toolbarItems: function() {} | |
| 771 } | |
| 772 | |
| 773 /** | |
| 750 * @constructor | 774 * @constructor |
| 751 * @extends {WebInspector.ToolbarItem} | 775 * @extends {WebInspector.ToolbarItem} |
| 752 * @param {?function(!Event)} changeHandler | 776 * @param {?function(!Event)} changeHandler |
| 753 * @param {string=} className | 777 * @param {string=} className |
| 754 */ | 778 */ |
| 755 WebInspector.ToolbarComboBox = function(changeHandler, className) | 779 WebInspector.ToolbarComboBox = function(changeHandler, className) |
| 756 { | 780 { |
| 757 WebInspector.ToolbarItem.call(this, createElementWithClass("span", "toolbar- select-container")); | 781 WebInspector.ToolbarItem.call(this, createElementWithClass("span", "toolbar- select-container")); |
| 758 | 782 |
| 759 this._selectElement = this.element.createChild("select", "toolbar-item"); | 783 this._selectElement = this.element.createChild("select", "toolbar-item"); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 949 | 973 |
| 950 /** | 974 /** |
| 951 * @param {!Runtime.Extension} extension | 975 * @param {!Runtime.Extension} extension |
| 952 * @return {!Promise.<?WebInspector.ToolbarItem>} | 976 * @return {!Promise.<?WebInspector.ToolbarItem>} |
| 953 */ | 977 */ |
| 954 function resolveItem(extension) | 978 function resolveItem(extension) |
| 955 { | 979 { |
| 956 var descriptor = extension.descriptor(); | 980 var descriptor = extension.descriptor(); |
| 957 if (descriptor["separator"]) | 981 if (descriptor["separator"]) |
| 958 return Promise.resolve(/** @type {?WebInspector.ToolbarItem} */( new WebInspector.ToolbarSeparator())); | 982 return Promise.resolve(/** @type {?WebInspector.ToolbarItem} */( new WebInspector.ToolbarSeparator())); |
| 959 if (descriptor["actionId"]) { | 983 if (descriptor["actionId"]) |
| 960 var action = WebInspector.actionRegistry.action(descriptor["acti onId"]); | 984 return Promise.resolve(WebInspector.Toolbar.createActionButtonFo rId(descriptor["actionId"])); |
| 961 return Promise.resolve(/** @type {?WebInspector.ToolbarItem} */( action ? WebInspector.Toolbar.createActionButton(action) : null)); | |
| 962 } | |
| 963 return extension.instance().then(fetchItemFromProvider); | 985 return extension.instance().then(fetchItemFromProvider); |
| 964 | 986 |
| 965 /** | 987 /** |
| 966 * @param {!Object} provider | 988 * @param {!Object} provider |
| 967 */ | 989 */ |
| 968 function fetchItemFromProvider(provider) | 990 function fetchItemFromProvider(provider) |
| 969 { | 991 { |
| 970 return /** @type {!WebInspector.ToolbarItem.Provider} */ (provid er).item(); | 992 return /** @type {!WebInspector.ToolbarItem.Provider} */ (provid er).item(); |
| 971 } | 993 } |
| 972 } | 994 } |
| 973 | 995 |
| 974 /** | 996 /** |
| 975 * @param {!Array.<?WebInspector.ToolbarItem>} items | 997 * @param {!Array.<?WebInspector.ToolbarItem>} items |
| 976 * @this {WebInspector.ExtensibleToolbar} | 998 * @this {WebInspector.ExtensibleToolbar} |
| 977 */ | 999 */ |
| 978 function appendItemsInOrder(items) | 1000 function appendItemsInOrder(items) |
| 979 { | 1001 { |
| 980 for (var i = 0; i < items.length; ++i) { | 1002 for (var i = 0; i < items.length; ++i) { |
| 981 var item = items[i]; | 1003 var item = items[i]; |
| 982 if (item) | 1004 if (item) |
| 983 this.appendToolbarItem(item); | 1005 this.appendToolbarItem(item); |
| 984 } | 1006 } |
| 985 } | 1007 } |
| 986 }, | 1008 }, |
| 987 | 1009 |
| 988 __proto__: WebInspector.Toolbar.prototype | 1010 __proto__: WebInspector.Toolbar.prototype |
| 989 } | 1011 } |
| OLD | NEW |