Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js

Issue 2142303002: Revert of DevTools: automatically populate 'More tools' submenu with the drawer views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 else if (this._isCloseableTab(id) && this._closeableTabSetting.get() [id]) 1276 }
1277
1278 for (var i = 0; i < extensions.length; i++) {
1279 var id = extensions[i].descriptor()["name"];
1280 if (this._isCloseableTab(id) && this._closeableTabSetting.get()[id])
1277 this._appendTab(extensions[i]); 1281 this._appendTab(extensions[i]);
1278 } 1282 }
1279 }, 1283 },
1280 1284
1281 /** 1285 /**
1282 * @param {string} id 1286 * @param {string} id
1283 * @return {boolean} 1287 * @return {boolean}
1284 */ 1288 */
1285 _isPermanentTab: function(id) 1289 _isPermanentTab: function(id)
1286 { 1290 {
(...skipping 15 matching lines...) Expand all
1302 toolbar.appendToolbarItem(new WebInspector.ToolbarMenuButton(this._appen dTabsToMenu.bind(this))); 1306 toolbar.appendToolbarItem(new WebInspector.ToolbarMenuButton(this._appen dTabsToMenu.bind(this)));
1303 this._tabbedPane.insertBeforeTabStrip(toolbar.element); 1307 this._tabbedPane.insertBeforeTabStrip(toolbar.element);
1304 this._tabbedPane.disableOverflowMenu(); 1308 this._tabbedPane.disableOverflowMenu();
1305 }, 1309 },
1306 1310
1307 /** 1311 /**
1308 * @param {!WebInspector.ContextMenu} contextMenu 1312 * @param {!WebInspector.ContextMenu} contextMenu
1309 */ 1313 */
1310 _appendTabsToMenu: function(contextMenu) 1314 _appendTabsToMenu: function(contextMenu)
1311 { 1315 {
1312 var extensions = self.runtime.extensions(this._extensionPoint, undefined , true); 1316 for (var id of this._extensions.keysArray().filter(this._isPermanentTab. bind(this))) {
1313 for (var extension of extensions) { 1317 var title = WebInspector.UIString(this._extensions.get(id).title(Web Inspector.platform()));
1314 var title = WebInspector.UIString(extension.title()); 1318 contextMenu.appendItem(title, this.showTab.bind(this, id));
1315 contextMenu.appendItem(title, this.showTab.bind(this, extension.desc riptor()["name"])); 1319 }
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));
1316 } 1323 }
1317 }, 1324 },
1318 1325
1319 /** 1326 /**
1320 * @param {!Runtime.Extension} extension 1327 * @param {!Runtime.Extension} extension
1321 */ 1328 */
1322 _appendTab: function(extension) 1329 _appendTab: function(extension)
1323 { 1330 {
1324 var descriptor = extension.descriptor(); 1331 var descriptor = extension.descriptor();
1325 var id = descriptor["name"]; 1332 var id = descriptor["name"];
1326 var title = WebInspector.UIString(extension.title()); 1333 var title = WebInspector.UIString(extension.title(WebInspector.platform( )));
1327 var closeable = descriptor["persistence"] === "closeable" || descriptor[ "persistence"] === "temporary"; 1334 var closeable = descriptor["persistence"] === "closeable" || descriptor[ "persistence"] === "temporary";
1328 this._tabbedPane.appendTab(id, title, this._views.get(id) || new WebInsp ector.Widget(), undefined, false, closeable); 1335 this._tabbedPane.appendTab(id, title, this._views.get(id) || new WebInsp ector.Widget(), undefined, false, closeable);
1329 }, 1336 },
1330 1337
1331 /** 1338 /**
1332 * @param {string} id 1339 * @param {string} id
1333 * @return {!Promise.<?WebInspector.Widget>} 1340 * @return {!Promise.<?WebInspector.Widget>}
1334 */ 1341 */
1335 showTab: function(id) 1342 showTab: function(id)
1336 { 1343 {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 if (this._viewCallback && view) 1430 if (this._viewCallback && view)
1424 this._viewCallback(id, view); 1431 this._viewCallback(id, view);
1425 var shouldFocus = this._tabbedPane.visibleView.element.isSelfOrAnces tor(WebInspector.currentFocusElement()); 1432 var shouldFocus = this._tabbedPane.visibleView.element.isSelfOrAnces tor(WebInspector.currentFocusElement());
1426 this._tabbedPane.changeTabView(id, view); 1433 this._tabbedPane.changeTabView(id, view);
1427 if (shouldFocus) 1434 if (shouldFocus)
1428 view.focus(); 1435 view.focus();
1429 return view; 1436 return view;
1430 } 1437 }
1431 } 1438 }
1432 } 1439 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698