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

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: changes Created 4 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 unified diff | 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 »
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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 var request = gridNode && gridNode.request(); 834 var request = gridNode && gridNode.request();
835 835
836 /** 836 /**
837 * @param {string} url 837 * @param {string} url
838 */ 838 */
839 function openResourceInNewTab(url) 839 function openResourceInNewTab(url)
840 { 840 {
841 InspectorFrontendHost.openInNewTab(url); 841 InspectorFrontendHost.openInNewTab(url);
842 } 842 }
843 843
844 contextMenu.appendApplicableItems(request);
845 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy ..."));
lushnikov 2016/07/26 22:52:11 Let's drop the "..." to be consistent with Element
allada 2016/07/27 17:24:42 Done.
844 if (request) { 846 if (request) {
845 contextMenu.appendApplicableItems(request); 847 copyMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFr ontendHost.copyText.bind(InspectorFrontendHost, request.contentURL()));
848 copyMenu.appendSeparator();
849
846 if (request.requestHeadersText()) 850 if (request.requestHeadersText())
847 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r equest ^headers"), this._copyRequestHeaders.bind(this, request)); 851 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^requ est ^headers"), this._copyRequestHeaders.bind(this, request));
848 if (request.responseHeadersText) 852 if (request.responseHeadersText)
849 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r esponse ^headers"), this._copyResponseHeaders.bind(this, request)); 853 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^resp onse ^headers"), this._copyResponseHeaders.bind(this, request));
850 if (request.finished) 854 if (request.finished)
851 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r esponse"), this._copyResponse.bind(this, request)); 855 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^resp onse"), this._copyResponse.bind(this, request));
852 856
853 if (WebInspector.isWin()) { 857 if (WebInspector.isWin()) {
854 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (cmd) "), this._copyCurlCommand.bind(this, request, "win")); 858 copyMenu.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")); 859 copyMenu.appendItem(WebInspector.UIString("Copy as cURL (bash)") , this._copyCurlCommand.bind(this, request, "unix"));
860 copyMenu.appendItem(WebInspector.UIString("Copy All as cURL (cmd )"), this._copyAllCurlCommand.bind(this, "win"));
861 copyMenu.appendItem(WebInspector.UIString("Copy All as cURL (bas h)"), this._copyAllCurlCommand.bind(this, "unix"));
856 } else { 862 } else {
857 contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), th is._copyCurlCommand.bind(this, request, "unix")); 863 copyMenu.appendItem(WebInspector.UIString("Copy as cURL"), this. _copyCurlCommand.bind(this, request, "unix"));
864 copyMenu.appendItem(WebInspector.UIString("Copy All as cURL"), t his._copyAllCurlCommand.bind(this, "unix"));
858 } 865 }
866 } else {
867 copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy ..."));
859 } 868 }
860 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HA R"), this._copyAll.bind(this)); 869 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HAR") , this._copyAll.bind(this));
861 870
862 contextMenu.appendSeparator(); 871 contextMenu.appendSeparator();
863 contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR wit h ^content"), this._exportAll.bind(this)); 872 contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR wit h ^content"), this._exportAll.bind(this));
864 873
865 contextMenu.appendSeparator(); 874 contextMenu.appendSeparator();
866 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser ^cache"), this._clearBrowserCache.bind(this)); 875 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)); 876 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser ^cookies"), this._clearBrowserCookies.bind(this));
868 877
869 var blockedSetting = WebInspector.moduleSetting("blockedURLs"); 878 var blockedSetting = WebInspector.moduleSetting("blockedURLs");
870 if (request && Runtime.experiments.isEnabled("requestBlocking")) { // D isabled until ready. 879 if (request && Runtime.experiments.isEnabled("requestBlocking")) { // D isabled until ready.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 955
947 /** 956 /**
948 * @param {!WebInspector.NetworkRequest} request 957 * @param {!WebInspector.NetworkRequest} request
949 * @param {string} platform 958 * @param {string} platform
950 */ 959 */
951 _copyCurlCommand: function(request, platform) 960 _copyCurlCommand: function(request, platform)
952 { 961 {
953 InspectorFrontendHost.copyText(this._generateCurlCommand(request, platfo rm)); 962 InspectorFrontendHost.copyText(this._generateCurlCommand(request, platfo rm));
954 }, 963 },
955 964
965 /**
966 * @param {string} platform
967 */
968 _copyAllCurlCommand: function(platform)
969 {
970 var requests = this._nodesByRequestId.valuesArray().map(node => node.req uest());
971 var commands = [];
972 for (var request of requests)
973 commands.push(this._generateCurlCommand(request, platform));
974 var newLine = platform === "win" ? "\r\n" : "\n";
975 InspectorFrontendHost.copyText(commands.join(" ;" + newLine));
lushnikov 2016/07/26 22:52:11 why " ;"?
allada 2016/07/27 17:24:42 This allows the commands to be ran just by pasting
976 },
977
956 _exportAll: function() 978 _exportAll: function()
957 { 979 {
958 var filename = WebInspector.targetManager.inspectedPageDomain() + ".har" ; 980 var filename = WebInspector.targetManager.inspectedPageDomain() + ".har" ;
959 var stream = new WebInspector.FileOutputStream(); 981 var stream = new WebInspector.FileOutputStream();
960 stream.open(filename, openCallback.bind(this)); 982 stream.open(filename, openCallback.bind(this));
961 983
962 /** 984 /**
963 * @param {boolean} accepted 985 * @param {boolean} accepted
964 * @this {WebInspector.NetworkLogView} 986 * @this {WebInspector.NetworkLogView}
965 */ 987 */
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 return false; 1710 return false;
1689 return true; 1711 return true;
1690 } 1712 }
1691 1713
1692 WebInspector.NetworkLogView.EventTypes = { 1714 WebInspector.NetworkLogView.EventTypes = {
1693 RequestSelected: "RequestSelected", 1715 RequestSelected: "RequestSelected",
1694 SearchCountUpdated: "SearchCountUpdated", 1716 SearchCountUpdated: "SearchCountUpdated",
1695 SearchIndexUpdated: "SearchIndexUpdated", 1717 SearchIndexUpdated: "SearchIndexUpdated",
1696 UpdateRequest: "UpdateRequest" 1718 UpdateRequest: "UpdateRequest"
1697 }; 1719 };
OLDNEW
« 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