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

Unified Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 1310073007: Devtools UI: Add toggle record shortcut in network panel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update Mac shortcut Created 5 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 | « no previous file | Source/devtools/front_end/network/module.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/network/NetworkPanel.js
diff --git a/Source/devtools/front_end/network/NetworkPanel.js b/Source/devtools/front_end/network/NetworkPanel.js
index 61e8da516ba3d17df1f24ebf762cd80f8355d471..0e7746bcd1bd22fd698c0608554a565a2d0cf3b9 100644
--- a/Source/devtools/front_end/network/NetworkPanel.js
+++ b/Source/devtools/front_end/network/NetworkPanel.js
@@ -130,8 +130,7 @@ WebInspector.NetworkPanel.prototype = {
_createToolbarButtons: function()
{
- this._recordButton = new WebInspector.ToolbarButton("", "record-toolbar-item");
- this._recordButton.addEventListener("click", this._onRecordButtonClicked, this);
+ this._recordButton = WebInspector.ToolbarButton.createActionButton("network.toggle-recording");
this._panelToolbar.appendToolbarItem(this._recordButton);
this._clearButton = new WebInspector.ToolbarButton(WebInspector.UIString("Clear"), "clear-toolbar-item");
@@ -179,10 +178,7 @@ WebInspector.NetworkPanel.prototype = {
return toolbarItem;
},
- /**
- * @param {!WebInspector.Event} event
- */
- _onRecordButtonClicked: function(event)
+ _toggleRecording: function()
{
if (!this._preserveLogCheckbox.checked() && !this._recordButton.toggled())
this._reset();
@@ -349,7 +345,12 @@ WebInspector.NetworkPanel.prototype = {
wasShown: function()
{
- WebInspector.Panel.prototype.wasShown.call(this);
+ WebInspector.context.setFlavor(WebInspector.NetworkPanel, this);
+ },
+
+ willHide: function()
+ {
+ WebInspector.context.setFlavor(WebInspector.NetworkPanel, null);
},
/**
@@ -803,3 +804,24 @@ WebInspector.BlockedURLsBar.prototype = {
return this._toolbarButton;
}
}
+
+/**
+ * @constructor
+ * @implements {WebInspector.ActionDelegate}
+ */
+WebInspector.NetworkPanel.RecordActionDelegate = function()
+{
+}
+WebInspector.NetworkPanel.RecordActionDelegate.prototype = {
+ /**
+ * @override
+ * @param {!WebInspector.Context} context
+ * @param {string} actionId
+ */
+ handleAction: function(context, actionId)
+ {
+ var panel = WebInspector.context.flavor(WebInspector.NetworkPanel);
+ console.assert(panel && panel instanceof WebInspector.NetworkPanel);
+ panel._toggleRecording();
+ }
+}
« no previous file with comments | « no previous file | Source/devtools/front_end/network/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698