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

Unified Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2805763002: DevTools: Use ToolbarMenuButton for MainMenuItem (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index df312c2bad76782f6b54dfe39d80c1d7f2adc629..d7d545edc0588ffe44c26f298ca845cf5abc2407 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -662,12 +662,11 @@ Main.Main.WarningErrorCounter = class {
/**
* @implements {UI.ToolbarItem.Provider}
- * @unrestricted
*/
Main.Main.MainMenuItem = class {
constructor() {
- this._item = new UI.ToolbarButton(Common.UIString('Customize and control DevTools'), 'largeicon-menu');
- this._item.addEventListener(UI.ToolbarButton.Events.MouseDown, this._mouseDown, this);
+ this._item = new UI.ToolbarMenuButton(this._handleContextMenu.bind(this), true);
+ this._item.setTitle(Common.UIString('Customize and control DevTools'));
}
/**
@@ -679,13 +678,9 @@ Main.Main.MainMenuItem = class {
}
/**
- * @param {!Common.Event} event
+ * @param {!UI.ContextMenu} contextMenu
*/
- _mouseDown(event) {
- var contextMenu = new UI.ContextMenu(
- /** @type {!Event} */ (event.data), true, this._item.element.totalOffsetLeft(),
- this._item.element.totalOffsetTop() + this._item.element.offsetHeight);
-
+ _handleContextMenu(contextMenu) {
if (Components.dockController.canDock()) {
var dockItemElement = createElementWithClass('div', 'flex-centered flex-auto');
var titleElement = dockItemElement.createChild('span', 'flex-auto');
@@ -746,7 +741,6 @@ Main.Main.MainMenuItem = class {
var helpSubMenu = contextMenu.namedSubMenu('mainMenuHelp');
helpSubMenu.appendAction('settings.documentation');
helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openInNewTab(Help.latestReleaseNote().link));
- contextMenu.show();
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698