| 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 * @param {string} location | 938 * @param {string} location |
| 939 */ | 939 */ |
| 940 _loadItems: function(location) | 940 _loadItems: function(location) |
| 941 { | 941 { |
| 942 var extensions = self.runtime.extensions(WebInspector.ToolbarItem.Provid
er); | 942 var extensions = self.runtime.extensions(WebInspector.ToolbarItem.Provid
er); |
| 943 var promises = []; | 943 var promises = []; |
| 944 for (var i = 0; i < extensions.length; ++i) { | 944 for (var i = 0; i < extensions.length; ++i) { |
| 945 if (extensions[i].descriptor()["location"] === location) | 945 if (extensions[i].descriptor()["location"] === location) |
| 946 promises.push(resolveItem(extensions[i])); | 946 promises.push(resolveItem(extensions[i])); |
| 947 } | 947 } |
| 948 this._promise = Promise.all(promises).then(appendItemsInOrder.bind(this)
); | 948 Promise.all(promises).then(appendItemsInOrder.bind(this)); |
| 949 | 949 |
| 950 /** | 950 /** |
| 951 * @param {!Runtime.Extension} extension | 951 * @param {!Runtime.Extension} extension |
| 952 * @return {!Promise.<?WebInspector.ToolbarItem>} | 952 * @return {!Promise.<?WebInspector.ToolbarItem>} |
| 953 */ | 953 */ |
| 954 function resolveItem(extension) | 954 function resolveItem(extension) |
| 955 { | 955 { |
| 956 var descriptor = extension.descriptor(); | 956 var descriptor = extension.descriptor(); |
| 957 if (descriptor["separator"]) | 957 if (descriptor["separator"]) |
| 958 return Promise.resolve(/** @type {?WebInspector.ToolbarItem} */(
new WebInspector.ToolbarSeparator())); | 958 return Promise.resolve(/** @type {?WebInspector.ToolbarItem} */(
new WebInspector.ToolbarSeparator())); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 978 function appendItemsInOrder(items) | 978 function appendItemsInOrder(items) |
| 979 { | 979 { |
| 980 for (var i = 0; i < items.length; ++i) { | 980 for (var i = 0; i < items.length; ++i) { |
| 981 var item = items[i]; | 981 var item = items[i]; |
| 982 if (item) | 982 if (item) |
| 983 this.appendToolbarItem(item); | 983 this.appendToolbarItem(item); |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 }, | 986 }, |
| 987 | 987 |
| 988 /** | |
| 989 * @return {!Promise} | |
| 990 */ | |
| 991 onLoad: function() | |
| 992 { | |
| 993 return this._promise; | |
| 994 }, | |
| 995 | |
| 996 __proto__: WebInspector.Toolbar.prototype | 988 __proto__: WebInspector.Toolbar.prototype |
| 997 } | 989 } |
| OLD | NEW |