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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r esponse ^headers"), this._copyResponseHeaders.bind(this, request)); 849 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r esponse ^headers"), this._copyResponseHeaders.bind(this, request));
850 if (request.finished) 850 if (request.finished)
851 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r esponse"), this._copyResponse.bind(this, request)); 851 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r esponse"), this._copyResponse.bind(this, request));
852 852
853 if (WebInspector.isWin()) { 853 if (WebInspector.isWin()) {
854 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (cmd) "), this._copyCurlCommand.bind(this, request, "win")); 854 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (cmd) "), this._copyCurlCommand.bind(this, request, "win"));
855 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (bash )"), this._copyCurlCommand.bind(this, request, "unix")); 855 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (bash )"), this._copyCurlCommand.bind(this, request, "unix"));
856 } else { 856 } else {
857 contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), th is._copyCurlCommand.bind(this, request, "unix")); 857 contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), th is._copyCurlCommand.bind(this, request, "unix"));
858 } 858 }
859 if (WebInspector.isWin()) {
860 contextMenu.appendItem(WebInspector.UIString("Copy All as cURL ( cmd)"), this._copyAllCurlCommand.bind(this, "win"));
lushnikov 2016/07/26 01:23:09 maybe it's time to introduce the "Copy..." submenu
allada 2016/07/26 18:05:45 Done.
861 contextMenu.appendItem(WebInspector.UIString("Copy All as cURL ( bash)"), this._copyAllCurlCommand.bind(this, "unix"));
862 } else {
863 contextMenu.appendItem(WebInspector.UIString("Copy All as cURL") , this._copyAllCurlCommand.bind(this, "unix"));
864 }
859 } 865 }
860 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HA R"), this._copyAll.bind(this)); 866 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HA R"), this._copyAll.bind(this));
861 867
862 contextMenu.appendSeparator(); 868 contextMenu.appendSeparator();
863 contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR wit h ^content"), this._exportAll.bind(this)); 869 contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR wit h ^content"), this._exportAll.bind(this));
864 870
865 contextMenu.appendSeparator(); 871 contextMenu.appendSeparator();
866 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser ^cache"), this._clearBrowserCache.bind(this)); 872 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser ^cache"), this._clearBrowserCache.bind(this));
867 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser ^cookies"), this._clearBrowserCookies.bind(this)); 873 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser ^cookies"), this._clearBrowserCookies.bind(this));
868 874
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 952
947 /** 953 /**
948 * @param {!WebInspector.NetworkRequest} request 954 * @param {!WebInspector.NetworkRequest} request
949 * @param {string} platform 955 * @param {string} platform
950 */ 956 */
951 _copyCurlCommand: function(request, platform) 957 _copyCurlCommand: function(request, platform)
952 { 958 {
953 InspectorFrontendHost.copyText(this._generateCurlCommand(request, platfo rm)); 959 InspectorFrontendHost.copyText(this._generateCurlCommand(request, platfo rm));
954 }, 960 },
955 961
962 /**
963 * @param {string} platform
964 */
965 _copyAllCurlCommand: function(platform)
lushnikov 2016/07/26 01:23:09 let's make a bool argument "useCRLF"
allada 2016/07/26 18:05:45 _generateCurlCommand() needs platform.
966 {
967 var requests = this._nodesByRequestId.valuesArray().map(function(node) { return node.request(); });
lushnikov 2016/07/26 01:23:09 .map(node => node.request());
allada 2016/07/26 18:05:44 Done.
968 var commands = [];
969 for (var request of requests)
970 commands.push(this._generateCurlCommand(request, platform));
971 var newLineChars = "\n";
lushnikov 2016/07/26 01:23:09 var newLine = platform === "win" ? "\r\n" : "\n";
allada 2016/07/26 18:05:45 Done.
972 if (platform === "win")
973 newLineChars = "\r\n";
974 InspectorFrontendHost.copyText(commands.join(" ;" + newLineChars));
975 },
976
956 _exportAll: function() 977 _exportAll: function()
957 { 978 {
958 var filename = WebInspector.targetManager.inspectedPageDomain() + ".har" ; 979 var filename = WebInspector.targetManager.inspectedPageDomain() + ".har" ;
959 var stream = new WebInspector.FileOutputStream(); 980 var stream = new WebInspector.FileOutputStream();
960 stream.open(filename, openCallback.bind(this)); 981 stream.open(filename, openCallback.bind(this));
961 982
962 /** 983 /**
963 * @param {boolean} accepted 984 * @param {boolean} accepted
964 * @this {WebInspector.NetworkLogView} 985 * @this {WebInspector.NetworkLogView}
965 */ 986 */
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 return false; 1709 return false;
1689 return true; 1710 return true;
1690 } 1711 }
1691 1712
1692 WebInspector.NetworkLogView.EventTypes = { 1713 WebInspector.NetworkLogView.EventTypes = {
1693 RequestSelected: "RequestSelected", 1714 RequestSelected: "RequestSelected",
1694 SearchCountUpdated: "SearchCountUpdated", 1715 SearchCountUpdated: "SearchCountUpdated",
1695 SearchIndexUpdated: "SearchIndexUpdated", 1716 SearchIndexUpdated: "SearchIndexUpdated",
1696 UpdateRequest: "UpdateRequest" 1717 UpdateRequest: "UpdateRequest"
1697 }; 1718 };
OLDNEW
« 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