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

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

Issue 2137763002: DevTools: automatically populate 'More tools' submenu with the drawer views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 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 } 1276 else if (this._isCloseableTab(id) && this._closeableTabSetting.get() [id])
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])
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
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());
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"];
1333 var title = WebInspector.UIString(extension.title(WebInspector.platform( ))); 1326 var title = WebInspector.UIString(extension.title());
1334 var closeable = descriptor["persistence"] === "closeable" || descriptor[ "persistence"] === "temporary"; 1327 var closeable = descriptor["persistence"] === "closeable" || descriptor[ "persistence"] === "temporary";
1335 this._tabbedPane.appendTab(id, title, this._views.get(id) || new WebInsp ector.Widget(), undefined, false, closeable); 1328 this._tabbedPane.appendTab(id, title, this._views.get(id) || new WebInsp ector.Widget(), undefined, false, closeable);
1336 }, 1329 },
1337 1330
1338 /** 1331 /**
1339 * @param {string} id 1332 * @param {string} id
1340 * @return {!Promise.<?WebInspector.Widget>} 1333 * @return {!Promise.<?WebInspector.Widget>}
1341 */ 1334 */
1342 showTab: function(id) 1335 showTab: function(id)
1343 { 1336 {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698