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

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: Created 5 years, 7 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 df44004fc3b9e1a79ce2d02d5d811f2c744d3cf0..e60e950ad5150da2e27cb7cabbd6ee0add8ad087 100644
--- a/Source/devtools/front_end/network/NetworkLogView.js
+++ b/Source/devtools/front_end/network/NetworkLogView.js
@@ -1247,7 +1247,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));
@@ -1317,10 +1323,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()
@@ -1709,9 +1716,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.
@@ -1767,7 +1775,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;
alph 2015/06/03 19:01:16 please use === for comparison.
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