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

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

Issue 2234193002: DevTools: migrate some of the sources panel sidebar panes to view management, allow view toolbars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 4 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/ui/Toolbar.js ('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/View.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/View.js b/third_party/WebKit/Source/devtools/front_end/ui/View.js
index 8add5559f968f22a6cf94312fbbddf7f6db85288..5b866d8d444c30a7234c1ea124471a82210ca52c 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/View.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/View.js
@@ -41,6 +41,8 @@ WebInspector.View.prototype = {
widget: function() { }
}
+WebInspector.View._symbol = Symbol("view");
+
/**
* @constructor
* @extends {WebInspector.VBox}
@@ -54,6 +56,7 @@ WebInspector.SimpleView = function(title, isWebComponent)
this._title = title;
/** @type {!Array<!WebInspector.ToolbarItem>} */
this._toolbarItems = [];
+ this[WebInspector.View._symbol] = this;
}
WebInspector.SimpleView.prototype = {
@@ -191,6 +194,19 @@ WebInspector.ProvidedView.prototype = {
*/
toolbarItems: function()
{
+ var actionIds = this._extension.descriptor()["actionIds"];
+ if (actionIds) {
+ var result = []
+ for (var id of actionIds.split(",")) {
+ var item = WebInspector.Toolbar.createActionButtonForId(id.trim());
+ if (item)
+ result.push(item);
+ }
+ return Promise.resolve(result);
+ }
+
+ if (this._extension.descriptor()["hasToolbar"])
+ return this.widget().then(widget => /** @type {!WebInspector.ToolbarItem.ItemsProvider} */ (widget).toolbarItems());
return Promise.resolve([]);
},
@@ -200,7 +216,12 @@ WebInspector.ProvidedView.prototype = {
*/
widget: function()
{
- return /** @type {!Promise<!WebInspector.Widget>} */ (this._extension.instance());
+ return this._extension.instance().then(widget => {
+ if (!(widget instanceof WebInspector.Widget))
+ throw new Error("view className should point to a WebInspector.Widget");
+ widget[WebInspector.View._symbol] = this;
+ return /** @type {!WebInspector.Widget} */ (widget);
+ });
}
}
@@ -281,6 +302,16 @@ WebInspector.ViewManager = function()
WebInspector.ViewManager.prototype = {
/**
+ * @param {!WebInspector.Widget} widget
+ */
+ revealViewWithWidget: function(widget)
+ {
+ var view = widget[WebInspector.View._symbol];
+ if (view)
+ this.revealView(view);
+ },
+
+ /**
* @param {!WebInspector.View} view
* @return {!Promise}
*/
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698