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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js

Issue 2145763002: Reland 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js
index b46e31b1d92bb7b024be40c34cad56ee1f7b6c04..c48d5c8701508976d5c9ac7a935943ec6224be5b 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js
@@ -171,11 +171,14 @@
/**
* @param {string} label
* @param {boolean=} disabled
+ * @param {string=} subMenuId
* @return {!WebInspector.ContextSubMenuItem}
*/
- appendSubMenuItem: function(label, disabled)
+ appendSubMenuItem: function(label, disabled, subMenuId)
{
var item = new WebInspector.ContextSubMenuItem(this._contextMenu, label, disabled);
+ if (subMenuId)
+ this._contextMenu._namedSubMenus.set(subMenuId, item);
this._pushItem(item);
return item;
},
@@ -246,7 +249,7 @@
{
var subMenuId = extension.descriptor()["subMenuId"];
if (subMenuId) {
- var subMenuItem = menu.appendSubMenuItem(extension.title(WebInspector.platform()));
+ var subMenuItem = menu.appendSubMenuItem(extension.title(), false, subMenuId);
subMenuItem.appendItemsAtLocation(subMenuId);
} else {
menu.appendAction(extension.descriptor()["actionId"]);
@@ -309,6 +312,8 @@
this._y = y === undefined ? event.y : y;
this._handlers = {};
this._id = 0;
+ /** @type {!Map<string, !WebInspector.ContextSubMenuItem>} */
+ this._namedSubMenus = new Map();
}
WebInspector.ContextMenu.initialize = function()
@@ -483,6 +488,15 @@
this._pendingTargets.push(target);
},
+ /**
+ * @param {string} name
+ * @return {?WebInspector.ContextSubMenuItem}
+ */
+ namedSubMenu: function(name)
+ {
+ return this._namedSubMenus.get(name) || null;
+ },
+
__proto__: WebInspector.ContextSubMenuItem.prototype
}

Powered by Google App Engine
This is Rietveld 408576698