Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 { | 1266 { |
| 1267 /** @type {!Map.<string, !Runtime.Extension>} */ | 1267 /** @type {!Map.<string, !Runtime.Extension>} */ |
| 1268 this._extensions = new Map(); | 1268 this._extensions = new Map(); |
| 1269 var extensions = self.runtime.extensions(this._extensionPoint); | 1269 var extensions = self.runtime.extensions(this._extensionPoint); |
| 1270 | 1270 |
| 1271 for (var i = 0; i < extensions.length; ++i) { | 1271 for (var i = 0; i < extensions.length; ++i) { |
| 1272 var id = extensions[i].descriptor()["name"]; | 1272 var id = extensions[i].descriptor()["name"]; |
| 1273 this._extensions.set(id, extensions[i]); | 1273 this._extensions.set(id, extensions[i]); |
| 1274 if (this._isPermanentTab(id)) | 1274 if (this._isPermanentTab(id)) |
| 1275 this._appendTab(extensions[i]); | 1275 this._appendTab(extensions[i]); |
| 1276 } | 1276 else if (this._isCloseableTab(id) && this._closeableTabSetting.get() [id]) |
| 1277 | |
| 1278 for (var i = 0; i < extensions.length; i++) { | |
|
dgozman
2016/07/09 01:12:15
This code made it so all permanent tabs are always
pfeldman
2016/07/09 01:37:03
We are controlling this using extension order.
| |
| 1279 var id = extensions[i].descriptor()["name"]; | |
| 1280 if (this._isCloseableTab(id) && this._closeableTabSetting.get()[id]) | |
| 1281 this._appendTab(extensions[i]); | 1277 this._appendTab(extensions[i]); |
| 1282 } | 1278 } |
| 1283 }, | 1279 }, |
| 1284 | 1280 |
| 1285 /** | 1281 /** |
| 1286 * @param {string} id | 1282 * @param {string} id |
| 1287 * @return {boolean} | 1283 * @return {boolean} |
| 1288 */ | 1284 */ |
| 1289 _isPermanentTab: function(id) | 1285 _isPermanentTab: function(id) |
| 1290 { | 1286 { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1306 toolbar.appendToolbarItem(new WebInspector.ToolbarMenuButton(this._appen dTabsToMenu.bind(this))); | 1302 toolbar.appendToolbarItem(new WebInspector.ToolbarMenuButton(this._appen dTabsToMenu.bind(this))); |
| 1307 this._tabbedPane.insertBeforeTabStrip(toolbar.element); | 1303 this._tabbedPane.insertBeforeTabStrip(toolbar.element); |
| 1308 this._tabbedPane.disableOverflowMenu(); | 1304 this._tabbedPane.disableOverflowMenu(); |
| 1309 }, | 1305 }, |
| 1310 | 1306 |
| 1311 /** | 1307 /** |
| 1312 * @param {!WebInspector.ContextMenu} contextMenu | 1308 * @param {!WebInspector.ContextMenu} contextMenu |
| 1313 */ | 1309 */ |
| 1314 _appendTabsToMenu: function(contextMenu) | 1310 _appendTabsToMenu: function(contextMenu) |
| 1315 { | 1311 { |
| 1316 for (var id of this._extensions.keysArray().filter(this._isPermanentTab. bind(this))) { | 1312 var extensions = self.runtime.extensions(this._extensionPoint, undefined , true); |
| 1317 var title = WebInspector.UIString(this._extensions.get(id).title(Web Inspector.platform())); | 1313 for (var extension of extensions) { |
| 1318 contextMenu.appendItem(title, this.showTab.bind(this, id)); | 1314 var title = WebInspector.UIString(extension.title(WebInspector.platf orm())); |
| 1319 } | 1315 contextMenu.appendItem(title, this.showTab.bind(this, extension.desc riptor()["name"])); |
| 1320 for (var id of this._extensions.keysArray().filter(this._isCloseableTab. bind(this))) { | |
| 1321 var title = WebInspector.UIString(this._extensions.get(id).title(Web Inspector.platform())); | |
| 1322 contextMenu.appendItem(title, this.showTab.bind(this, id)); | |
| 1323 } | 1316 } |
| 1324 }, | 1317 }, |
| 1325 | 1318 |
| 1326 /** | 1319 /** |
| 1327 * @param {!Runtime.Extension} extension | 1320 * @param {!Runtime.Extension} extension |
| 1328 */ | 1321 */ |
| 1329 _appendTab: function(extension) | 1322 _appendTab: function(extension) |
| 1330 { | 1323 { |
| 1331 var descriptor = extension.descriptor(); | 1324 var descriptor = extension.descriptor(); |
| 1332 var id = descriptor["name"]; | 1325 var id = descriptor["name"]; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 if (this._viewCallback && view) | 1423 if (this._viewCallback && view) |
| 1431 this._viewCallback(id, view); | 1424 this._viewCallback(id, view); |
| 1432 var shouldFocus = this._tabbedPane.visibleView.element.isSelfOrAnces tor(WebInspector.currentFocusElement()); | 1425 var shouldFocus = this._tabbedPane.visibleView.element.isSelfOrAnces tor(WebInspector.currentFocusElement()); |
| 1433 this._tabbedPane.changeTabView(id, view); | 1426 this._tabbedPane.changeTabView(id, view); |
| 1434 if (shouldFocus) | 1427 if (shouldFocus) |
| 1435 view.focus(); | 1428 view.focus(); |
| 1436 return view; | 1429 return view; |
| 1437 } | 1430 } |
| 1438 } | 1431 } |
| 1439 } | 1432 } |
| OLD | NEW |