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

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js

Issue 2177383003: [Devtools] Added Copy All as cURL to network log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: requested changes 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/HandlerRegistry.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/network/NetworkLogView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js
index 3e8c48459315aeac5e765d59755ca51643fb8c3e..cfd70e927a3f3a3ecc8ed0451c407bf21667e398 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js
@@ -841,23 +841,32 @@ WebInspector.NetworkLogView.prototype = {
InspectorFrontendHost.openInNewTab(url);
}
+ contextMenu.appendApplicableItems(request);
+ var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy"));
if (request) {
- contextMenu.appendApplicableItems(request);
+ copyMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFrontendHost.copyText.bind(InspectorFrontendHost, request.contentURL()));
+ copyMenu.appendSeparator();
+
if (request.requestHeadersText())
- contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^request ^headers"), this._copyRequestHeaders.bind(this, request));
+ copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^request ^headers"), this._copyRequestHeaders.bind(this, request));
if (request.responseHeadersText)
- contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^response ^headers"), this._copyResponseHeaders.bind(this, request));
+ copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^response ^headers"), this._copyResponseHeaders.bind(this, request));
if (request.finished)
- contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^response"), this._copyResponse.bind(this, request));
+ copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^response"), this._copyResponse.bind(this, request));
if (WebInspector.isWin()) {
- contextMenu.appendItem(WebInspector.UIString("Copy as cURL (cmd)"), this._copyCurlCommand.bind(this, request, "win"));
- contextMenu.appendItem(WebInspector.UIString("Copy as cURL (bash)"), this._copyCurlCommand.bind(this, request, "unix"));
+ copyMenu.appendItem(WebInspector.UIString("Copy as cURL (cmd)"), this._copyCurlCommand.bind(this, request, "win"));
+ copyMenu.appendItem(WebInspector.UIString("Copy as cURL (bash)"), this._copyCurlCommand.bind(this, request, "unix"));
+ copyMenu.appendItem(WebInspector.UIString("Copy All as cURL (cmd)"), this._copyAllCurlCommand.bind(this, "win"));
+ copyMenu.appendItem(WebInspector.UIString("Copy All as cURL (bash)"), this._copyAllCurlCommand.bind(this, "unix"));
} else {
- contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._copyCurlCommand.bind(this, request, "unix"));
+ copyMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._copyCurlCommand.bind(this, request, "unix"));
+ copyMenu.appendItem(WebInspector.UIString("Copy All as cURL"), this._copyAllCurlCommand.bind(this, "unix"));
}
+ } else {
+ copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy"));
}
- contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HAR"), this._copyAll.bind(this));
+ copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HAR"), this._copyAll.bind(this));
contextMenu.appendSeparator();
contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR with ^content"), this._exportAll.bind(this));
@@ -953,6 +962,21 @@ WebInspector.NetworkLogView.prototype = {
InspectorFrontendHost.copyText(this._generateCurlCommand(request, platform));
},
+ /**
+ * @param {string} platform
+ */
+ _copyAllCurlCommand: function(platform)
+ {
+ var requests = this._nodesByRequestId.valuesArray().map(node => node.request());
+ var commands = [];
+ for (var request of requests)
+ commands.push(this._generateCurlCommand(request, platform));
+ if (platform === "win")
+ InspectorFrontendHost.copyText(commands.join(" &\r\n"));
+ else
+ InspectorFrontendHost.copyText(commands.join(" ;\n"));
+ },
+
_exportAll: function()
{
var filename = WebInspector.targetManager.inspectedPageDomain() + ".har";
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/HandlerRegistry.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698