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

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

Issue 2157713002: DevTools: introduce View: a named widget with the toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean 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/Widget.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
index 3b53ce0c2860e11b181e989b9535da5aab4071f9..5558f589144f8b9e4e97f525bef41f9e0d87a232 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
@@ -635,19 +635,83 @@ WebInspector.VBoxWithResizeCallback.prototype = {
/**
* @constructor
* @extends {WebInspector.VBox}
+ * @param {string} title
+ * @param {boolean=} isWebComponent
*/
-WebInspector.VBoxWithToolbarItems = function()
+WebInspector.View = function(title, isWebComponent)
{
- WebInspector.VBox.call(this);
+ WebInspector.VBox.call(this, isWebComponent);
+ this._title = title;
+ /** @type {!Array<!WebInspector.ToolbarItem>} */
+ this._toolbarItems = [];
}
-WebInspector.VBoxWithToolbarItems.prototype = {
+WebInspector.View.prototype = {
+ /**
+ * @return {string}
+ */
+ title: function()
+ {
+ return this._title;
+ },
+
+ /**
+ * @param {function()} callback
+ */
+ setRevealCallback: function(callback)
+ {
+ this._revealCallback = callback;
+ if (this._setRevealRequested) {
+ callback();
+ delete this._setRevealRequested;
+ }
+ },
+
+ /**
+ * @param {function(boolean)} callback
+ */
+ setRequestVisibleCallback: function(callback)
+ {
+ this._requestVisibleCallback = callback;
+ if (this._setVisibleRequested !== undefined) {
+ callback(this._setVisibleRequested);
+ delete this._setVisibleRequested;
+ }
+ },
+
+ requestReveal: function()
+ {
+ if (this._revealCallback)
+ this._revealCallback();
+ else
+ this._setRevealRequested = true;
+ },
+
+ /**
+ * @param {boolean} visible
+ */
+ requestSetVisible: function(visible)
+ {
+ if (this._requestVisibleCallback)
+ this._requestVisibleCallback(visible);
+ else
+ this._setVisibleRequested = visible;
+ },
+
+ /**
+ * @param {!WebInspector.ToolbarItem} item
+ */
+ addToolbarItem: function(item)
+ {
+ this._toolbarItems.push(item);
+ },
+
/**
* @return {!Array<!WebInspector.ToolbarItem>}
*/
toolbarItems: function()
{
- return [];
+ return this._toolbarItems;
},
__proto__: WebInspector.VBox.prototype

Powered by Google App Engine
This is Rietveld 408576698