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

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

Issue 1413593008: DevTools: straw man adaptable implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « third_party/WebKit/Source/devtools/front_end/sdk/module.json ('k') | 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/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 5b988e9ef007f84be2540b5730cbb3224d7d61d1..f30bea1741433cf41deecda0305b7d0773add5da 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js
@@ -301,6 +301,7 @@ WebInspector.ContextMenu = function(event, useSoftMenu, x, y)
WebInspector.ContextSubMenuItem.call(this, this, "");
/** @type {!Array.<!Promise.<!Array.<!WebInspector.ContextMenu.Provider>>>} */
this._pendingPromises = [];
+ this._adapterPromises = [];
/** @type {!Array.<!Promise.<!Object>>} */
this._pendingTargets = [];
this._event = event;
@@ -352,8 +353,14 @@ WebInspector.ContextMenu.prototype = {
show: function()
{
- Promise.all(this._pendingPromises).then(populateAndShow.bind(this));
+ Promise.all(this._adapterPromises).then(this._showWithProviders.bind(this));
WebInspector.ContextMenu._pendingMenu = this;
+ this._event.consume(true);
+ },
+
+ _showWithProviders: function()
+ {
+ Promise.all(this._pendingPromises).then(populateAndShow.bind(this));
/**
* @param {!Array.<!Array.<!WebInspector.ContextMenu.Provider>>} appendCallResults
@@ -381,8 +388,6 @@ WebInspector.ContextMenu.prototype = {
this._pendingTargets = [];
this._innerShow();
}
-
- this._event.consume(true);
},
discard: function()
@@ -458,6 +463,19 @@ WebInspector.ContextMenu.prototype = {
{
this._pendingPromises.push(self.runtime.instancesPromise(WebInspector.ContextMenu.Provider, target));
this._pendingTargets.push(target);
+
+ this._adapterPromises.push(self.runtime.adapt(target).then(appendForAdapted.bind(this)));
+ /**
+ * @param {!Array<!Object>} adapted
+ * @this {WebInspector.ContextSubMenuItem}
+ */
+ function appendForAdapted(adapted)
+ {
+ for (var object of adapted) {
+ this._pendingPromises.push(self.runtime.instancesPromise(WebInspector.ContextMenu.Provider, object));
+ this._pendingTargets.push(object);
+ }
+ }
},
__proto__: WebInspector.ContextSubMenuItem.prototype
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/module.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698