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

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

Issue 1136843010: DevTools: display 2 versions of "Copy as cURL" in Network panel on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed trailing whitespace Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/network/NetworkLogView.js
diff --git a/Source/devtools/front_end/network/NetworkLogView.js b/Source/devtools/front_end/network/NetworkLogView.js
index 6140c0a17d0e928d3da67226a5e447abe455ab3a..57c25379d487a0855e5e677eee413427cf811fa6 100644
--- a/Source/devtools/front_end/network/NetworkLogView.js
+++ b/Source/devtools/front_end/network/NetworkLogView.js
@@ -1248,7 +1248,13 @@ WebInspector.NetworkLogView.prototype = {
contextMenu.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));
- contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._copyCurlCommand.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"));
+ } else {
+ contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._copyCurlCommand.bind(this, request, "unix"));
+ }
}
contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HAR"), this._copyAll.bind(this));
@@ -1318,10 +1324,11 @@ WebInspector.NetworkLogView.prototype = {
/**
* @param {!WebInspector.NetworkRequest} request
+ * @param {string} platform
*/
- _copyCurlCommand: function(request)
+ _copyCurlCommand: function(request, platform)
{
- InspectorFrontendHost.copyText(this._generateCurlCommand(request));
+ InspectorFrontendHost.copyText(this._generateCurlCommand(request, platform));
},
_exportAll: function()
@@ -1710,9 +1717,10 @@ WebInspector.NetworkLogView.prototype = {
/**
* @param {!WebInspector.NetworkRequest} request
+ * @param {string} platform
* @return {string}
*/
- _generateCurlCommand: function(request)
+ _generateCurlCommand: function(request, platform)
{
var command = ["curl"];
// These headers are derived from URL (except "version") and would be added by cURL anyway.
@@ -1768,7 +1776,7 @@ WebInspector.NetworkLogView.prototype = {
// cURL command expected to run on the same platform that DevTools run
// (it may be different from the inspected page platform).
- var escapeString = WebInspector.isWin() ? escapeStringWin : escapeStringPosix;
+ var escapeString = platform === "win" ? escapeStringWin : escapeStringPosix;
command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&"));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698