Index: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js |
index 34c38384223afcd81faf8bbb4c8044bbb62e25fe..ce0ca87611133434bdcc40bcf714d2533147de99 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js |
@@ -27,283 +27,261 @@ |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
- |
/** |
- * @constructor |
* @implements {WebInspector.Searchable} |
- * @extends {WebInspector.Panel} |
- * @param {!WebInspector.ExtensionServer} server |
- * @param {string} panelName |
- * @param {string} id |
- * @param {string} pageURL |
+ * @unrestricted |
*/ |
-WebInspector.ExtensionPanel = function(server, panelName, id, pageURL) |
-{ |
- WebInspector.Panel.call(this, panelName); |
+WebInspector.ExtensionPanel = class extends WebInspector.Panel { |
+ /** |
+ * @param {!WebInspector.ExtensionServer} server |
+ * @param {string} panelName |
+ * @param {string} id |
+ * @param {string} pageURL |
+ */ |
+ constructor(server, panelName, id, pageURL) { |
+ super(panelName); |
this._server = server; |
this._id = id; |
this.setHideOnDetach(); |
- this._panelToolbar = new WebInspector.Toolbar("hidden", this.element); |
+ this._panelToolbar = new WebInspector.Toolbar('hidden', this.element); |
this._searchableView = new WebInspector.SearchableView(this); |
this._searchableView.show(this.element); |
- var extensionView = new WebInspector.ExtensionView(server, this._id, pageURL, "extension"); |
+ var extensionView = new WebInspector.ExtensionView(server, this._id, pageURL, 'extension'); |
extensionView.show(this._searchableView.element); |
-}; |
- |
-WebInspector.ExtensionPanel.prototype = { |
- /** |
- * @param {!WebInspector.ToolbarItem} item |
- */ |
- addToolbarItem: function(item) |
- { |
- this._panelToolbar.element.classList.remove("hidden"); |
- this._panelToolbar.appendToolbarItem(item); |
- }, |
+ } |
- /** |
- * @override |
- */ |
- searchCanceled: function() |
- { |
- this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.CancelSearch); |
- this._searchableView.updateSearchMatchesCount(0); |
- }, |
+ /** |
+ * @param {!WebInspector.ToolbarItem} item |
+ */ |
+ addToolbarItem(item) { |
+ this._panelToolbar.element.classList.remove('hidden'); |
+ this._panelToolbar.appendToolbarItem(item); |
+ } |
- /** |
- * @override |
- * @return {!WebInspector.SearchableView} |
- */ |
- searchableView: function() |
- { |
- return this._searchableView; |
- }, |
+ /** |
+ * @override |
+ */ |
+ searchCanceled() { |
+ this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.CancelSearch); |
+ this._searchableView.updateSearchMatchesCount(0); |
+ } |
- /** |
- * @override |
- * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
- * @param {boolean} shouldJump |
- * @param {boolean=} jumpBackwards |
- */ |
- performSearch: function(searchConfig, shouldJump, jumpBackwards) |
- { |
- var query = searchConfig.query; |
- this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.PerformSearch, query); |
- }, |
+ /** |
+ * @override |
+ * @return {!WebInspector.SearchableView} |
+ */ |
+ searchableView() { |
+ return this._searchableView; |
+ } |
- /** |
- * @override |
- */ |
- jumpToNextSearchResult: function() |
- { |
- this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.NextSearchResult); |
- }, |
+ /** |
+ * @override |
+ * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
+ * @param {boolean} shouldJump |
+ * @param {boolean=} jumpBackwards |
+ */ |
+ performSearch(searchConfig, shouldJump, jumpBackwards) { |
+ var query = searchConfig.query; |
+ this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.PerformSearch, query); |
+ } |
- /** |
- * @override |
- */ |
- jumpToPreviousSearchResult: function() |
- { |
- this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult); |
- }, |
+ /** |
+ * @override |
+ */ |
+ jumpToNextSearchResult() { |
+ this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.NextSearchResult); |
+ } |
- /** |
- * @override |
- * @return {boolean} |
- */ |
- supportsCaseSensitiveSearch: function() |
- { |
- return false; |
- }, |
+ /** |
+ * @override |
+ */ |
+ jumpToPreviousSearchResult() { |
+ this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult); |
+ } |
- /** |
- * @override |
- * @return {boolean} |
- */ |
- supportsRegexSearch: function() |
- { |
- return false; |
- }, |
+ /** |
+ * @override |
+ * @return {boolean} |
+ */ |
+ supportsCaseSensitiveSearch() { |
+ return false; |
+ } |
- __proto__: WebInspector.Panel.prototype |
+ /** |
+ * @override |
+ * @return {boolean} |
+ */ |
+ supportsRegexSearch() { |
+ return false; |
+ } |
}; |
/** |
- * @constructor |
- * @param {!WebInspector.ExtensionServer} server |
- * @param {string} id |
- * @param {string} iconURL |
- * @param {string=} tooltip |
- * @param {boolean=} disabled |
+ * @unrestricted |
*/ |
-WebInspector.ExtensionButton = function(server, id, iconURL, tooltip, disabled) |
-{ |
+WebInspector.ExtensionButton = class { |
+ /** |
+ * @param {!WebInspector.ExtensionServer} server |
+ * @param {string} id |
+ * @param {string} iconURL |
+ * @param {string=} tooltip |
+ * @param {boolean=} disabled |
+ */ |
+ constructor(server, id, iconURL, tooltip, disabled) { |
this._id = id; |
- this._toolbarButton = new WebInspector.ToolbarButton("", ""); |
- this._toolbarButton.addEventListener("click", server.notifyButtonClicked.bind(server, this._id)); |
+ this._toolbarButton = new WebInspector.ToolbarButton('', ''); |
+ this._toolbarButton.addEventListener('click', server.notifyButtonClicked.bind(server, this._id)); |
this.update(iconURL, tooltip, disabled); |
-}; |
+ } |
-WebInspector.ExtensionButton.prototype = { |
- /** |
- * @param {string} iconURL |
- * @param {string=} tooltip |
- * @param {boolean=} disabled |
- */ |
- update: function(iconURL, tooltip, disabled) |
- { |
- if (typeof iconURL === "string") |
- this._toolbarButton.setBackgroundImage(iconURL); |
- if (typeof tooltip === "string") |
- this._toolbarButton.setTitle(tooltip); |
- if (typeof disabled === "boolean") |
- this._toolbarButton.setEnabled(!disabled); |
- }, |
+ /** |
+ * @param {string} iconURL |
+ * @param {string=} tooltip |
+ * @param {boolean=} disabled |
+ */ |
+ update(iconURL, tooltip, disabled) { |
+ if (typeof iconURL === 'string') |
+ this._toolbarButton.setBackgroundImage(iconURL); |
+ if (typeof tooltip === 'string') |
+ this._toolbarButton.setTitle(tooltip); |
+ if (typeof disabled === 'boolean') |
+ this._toolbarButton.setEnabled(!disabled); |
+ } |
- /** |
- * @return {!WebInspector.ToolbarButton} |
- */ |
- toolbarButton: function() |
- { |
- return this._toolbarButton; |
- } |
+ /** |
+ * @return {!WebInspector.ToolbarButton} |
+ */ |
+ toolbarButton() { |
+ return this._toolbarButton; |
+ } |
}; |
/** |
- * @constructor |
- * @extends {WebInspector.SimpleView} |
- * @param {!WebInspector.ExtensionServer} server |
- * @param {string} panelName |
- * @param {string} title |
- * @param {string} id |
+ * @unrestricted |
*/ |
-WebInspector.ExtensionSidebarPane = function(server, panelName, title, id) |
-{ |
- WebInspector.SimpleView.call(this, title); |
- this.element.classList.add("fill"); |
+WebInspector.ExtensionSidebarPane = class extends WebInspector.SimpleView { |
+ /** |
+ * @param {!WebInspector.ExtensionServer} server |
+ * @param {string} panelName |
+ * @param {string} title |
+ * @param {string} id |
+ */ |
+ constructor(server, panelName, title, id) { |
+ super(title); |
+ this.element.classList.add('fill'); |
this._panelName = panelName; |
this._server = server; |
this._id = id; |
-}; |
- |
-WebInspector.ExtensionSidebarPane.prototype = { |
- /** |
- * @return {string} |
- */ |
- id: function() |
- { |
- return this._id; |
- }, |
+ } |
- /** |
- * @return {string} |
- */ |
- panelName: function() |
- { |
- return this._panelName; |
- }, |
+ /** |
+ * @return {string} |
+ */ |
+ id() { |
+ return this._id; |
+ } |
- /** |
- * @param {!Object} object |
- * @param {string} title |
- * @param {function(?string=)} callback |
- */ |
- setObject: function(object, title, callback) |
- { |
- this._createObjectPropertiesView(); |
- this._setObject(WebInspector.RemoteObject.fromLocalObject(object), title, callback); |
- }, |
+ /** |
+ * @return {string} |
+ */ |
+ panelName() { |
+ return this._panelName; |
+ } |
- /** |
- * @param {string} expression |
- * @param {string} title |
- * @param {!Object} evaluateOptions |
- * @param {string} securityOrigin |
- * @param {function(?string=)} callback |
- */ |
- setExpression: function(expression, title, evaluateOptions, securityOrigin, callback) |
- { |
- this._createObjectPropertiesView(); |
- this._server.evaluate(expression, true, false, evaluateOptions, securityOrigin, this._onEvaluate.bind(this, title, callback)); |
- }, |
+ /** |
+ * @param {!Object} object |
+ * @param {string} title |
+ * @param {function(?string=)} callback |
+ */ |
+ setObject(object, title, callback) { |
+ this._createObjectPropertiesView(); |
+ this._setObject(WebInspector.RemoteObject.fromLocalObject(object), title, callback); |
+ } |
- /** |
- * @param {string} url |
- */ |
- setPage: function(url) |
- { |
- if (this._objectPropertiesView) { |
- this._objectPropertiesView.detach(); |
- delete this._objectPropertiesView; |
- } |
- if (this._extensionView) |
- this._extensionView.detach(); |
+ /** |
+ * @param {string} expression |
+ * @param {string} title |
+ * @param {!Object} evaluateOptions |
+ * @param {string} securityOrigin |
+ * @param {function(?string=)} callback |
+ */ |
+ setExpression(expression, title, evaluateOptions, securityOrigin, callback) { |
+ this._createObjectPropertiesView(); |
+ this._server.evaluate( |
+ expression, true, false, evaluateOptions, securityOrigin, this._onEvaluate.bind(this, title, callback)); |
+ } |
- this._extensionView = new WebInspector.ExtensionView(this._server, this._id, url, "extension fill"); |
- this._extensionView.show(this.element); |
+ /** |
+ * @param {string} url |
+ */ |
+ setPage(url) { |
+ if (this._objectPropertiesView) { |
+ this._objectPropertiesView.detach(); |
+ delete this._objectPropertiesView; |
+ } |
+ if (this._extensionView) |
+ this._extensionView.detach(); |
- if (!this.element.style.height) |
- this.setHeight("150px"); |
- }, |
+ this._extensionView = new WebInspector.ExtensionView(this._server, this._id, url, 'extension fill'); |
+ this._extensionView.show(this.element); |
- /** |
- * @param {string} height |
- */ |
- setHeight: function(height) |
- { |
- this.element.style.height = height; |
- }, |
+ if (!this.element.style.height) |
+ this.setHeight('150px'); |
+ } |
- /** |
- * @param {string} title |
- * @param {function(?string=)} callback |
- * @param {?Protocol.Error} error |
- * @param {?WebInspector.RemoteObject} result |
- * @param {boolean=} wasThrown |
- */ |
- _onEvaluate: function(title, callback, error, result, wasThrown) |
- { |
- if (error) |
- callback(error.toString()); |
- else |
- this._setObject(/** @type {!WebInspector.RemoteObject} */ (result), title, callback); |
- }, |
+ /** |
+ * @param {string} height |
+ */ |
+ setHeight(height) { |
+ this.element.style.height = height; |
+ } |
- _createObjectPropertiesView: function() |
- { |
- if (this._objectPropertiesView) |
- return; |
- if (this._extensionView) { |
- this._extensionView.detach(); |
- delete this._extensionView; |
- } |
- this._objectPropertiesView = new WebInspector.ExtensionNotifierView(this._server, this._id); |
- this._objectPropertiesView.show(this.element); |
- }, |
+ /** |
+ * @param {string} title |
+ * @param {function(?string=)} callback |
+ * @param {?Protocol.Error} error |
+ * @param {?WebInspector.RemoteObject} result |
+ * @param {boolean=} wasThrown |
+ */ |
+ _onEvaluate(title, callback, error, result, wasThrown) { |
+ if (error) |
+ callback(error.toString()); |
+ else |
+ this._setObject(/** @type {!WebInspector.RemoteObject} */ (result), title, callback); |
+ } |
- /** |
- * @param {!WebInspector.RemoteObject} object |
- * @param {string} title |
- * @param {function(?string=)} callback |
- */ |
- _setObject: function(object, title, callback) |
- { |
- // This may only happen if setPage() was called while we were evaluating the expression. |
- if (!this._objectPropertiesView) { |
- callback("operation cancelled"); |
- return; |
- } |
- this._objectPropertiesView.element.removeChildren(); |
- var section = new WebInspector.ObjectPropertiesSection(object, title); |
- if (!title) |
- section.titleLessMode(); |
- section.expand(); |
- section.editable = false; |
- this._objectPropertiesView.element.appendChild(section.element); |
- callback(); |
- }, |
+ _createObjectPropertiesView() { |
+ if (this._objectPropertiesView) |
+ return; |
+ if (this._extensionView) { |
+ this._extensionView.detach(); |
+ delete this._extensionView; |
+ } |
+ this._objectPropertiesView = new WebInspector.ExtensionNotifierView(this._server, this._id); |
+ this._objectPropertiesView.show(this.element); |
+ } |
- __proto__: WebInspector.SimpleView.prototype |
+ /** |
+ * @param {!WebInspector.RemoteObject} object |
+ * @param {string} title |
+ * @param {function(?string=)} callback |
+ */ |
+ _setObject(object, title, callback) { |
+ // This may only happen if setPage() was called while we were evaluating the expression. |
+ if (!this._objectPropertiesView) { |
+ callback('operation cancelled'); |
+ return; |
+ } |
+ this._objectPropertiesView.element.removeChildren(); |
+ var section = new WebInspector.ObjectPropertiesSection(object, title); |
+ if (!title) |
+ section.titleLessMode(); |
+ section.expand(); |
+ section.editable = false; |
+ this._objectPropertiesView.element.appendChild(section.element); |
+ callback(); |
+ } |
}; |