Changeset 84358 in webkit
- Timestamp:
- Apr 20, 2011 5:27:15 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84357 r84358 1 2011-04-20 Pavel Feldman <pfeldman@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: add saveAs into the InspectorFrontendHost binding. 6 https://bugs.webkit.org/show_bug.cgi?id=58979 7 8 * English.lproj/localizedStrings.js: 9 * inspector/InspectorFrontendClient.h: 10 (WebCore::InspectorFrontendClient::saveAs): 11 (WebCore::InspectorFrontendClient::saveSessionSetting): 12 (WebCore::InspectorFrontendClient::loadSessionSetting): 13 * inspector/InspectorFrontendHost.cpp: 14 (WebCore::InspectorFrontendHost::saveAs): 15 * inspector/InspectorFrontendHost.h: 16 * inspector/InspectorFrontendHost.idl: 17 * inspector/front-end/InspectorFrontendHostStub.js: 18 (.WebInspector.InspectorFrontendHostStub.prototype.saveAs.fr.onload): 19 (.WebInspector.InspectorFrontendHostStub.prototype.saveAs): 20 * inspector/front-end/NetworkPanel.js: 21 (WebInspector.NetworkPanel.prototype._contextMenu): 22 (WebInspector.NetworkPanel.prototype._copyAll): 23 (WebInspector.NetworkPanel.prototype._copyResource): 24 (WebInspector.NetworkPanel.prototype._exportAll): 25 (WebInspector.NetworkPanel.prototype._exportResource): 26 * inspector/front-end/Settings.js: 27 * inspector/front-end/utilities.js: 28 (): 29 1 30 2011-04-20 Yury Semikhatsky <yurys@chromium.org> 2 31 -
trunk/Source/WebCore/inspector/InspectorFrontendClient.h
r81470 r84358 59 59 virtual void requestDetachWindow() = 0; 60 60 virtual void changeAttachedWindowHeight(unsigned) = 0; 61 virtual void saveAs(const WTF::String& fileName, const WTF::String& content) { } 61 62 62 63 virtual void inspectedURLChanged(const String&) = 0; … … 64 65 virtual void sendMessageToBackend(const String&) = 0; 65 66 66 virtual void saveSessionSetting(const String&, const String&) { }67 virtual void loadSessionSetting(const String&, String*) { }67 virtual void saveSessionSetting(const String&, const String&) { } 68 virtual void loadSessionSetting(const String&, String*) { } 68 69 }; 69 70 -
trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp
r81470 r84358 221 221 } 222 222 223 void InspectorFrontendHost::saveAs(const String& fileName, const String& content) 224 { 225 if (m_client) 226 m_client->saveAs(fileName, content); 227 } 228 223 229 void InspectorFrontendHost::saveSessionSetting(const String& key, const String& value) 224 230 { -
trunk/Source/WebCore/inspector/InspectorFrontendHost.h
r81470 r84358 75 75 76 76 void copyText(const String& text); 77 void saveAs(const String& fileName, const String& content); 77 78 78 79 void saveSessionSetting(const String& key, const String& value); -
trunk/Source/WebCore/inspector/InspectorFrontendHost.idl
r81470 r84358 52 52 53 53 void copyText(in DOMString text); 54 void saveAs(in DOMString fileName, in DOMString content); 54 55 55 56 [Custom] DOMString platform(); -
trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
r82106 r84358 116 116 }, 117 117 118 saveAs: function(fileName, content) 119 { 120 var builder = new WebKitBlobBuilder(); 121 builder.append(content); 122 var blob = builder.getBlob("application/octet-stream"); 123 124 var fr = new FileReader(); 125 fr.onload = function(e) { 126 // Force download 127 window.location = this.result; 128 } 129 fr.readAsDataURL(blob); 130 }, 131 118 132 canAttachWindow: function() 119 133 { -
trunk/Source/WebCore/inspector/front-end/NetworkPanel.js
r83564 r84358 998 998 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target); 999 999 var resource = gridNode && gridNode._resource; 1000 1000 1001 if (resource) 1001 contextMenu.appendItem(WebInspector.UIString("Copy entry as HAR"), this._exportResource.bind(this, resource)); 1002 contextMenu.appendItem(WebInspector.UIString("Copy network log as HAR"), this._exportAll.bind(this)); 1002 contextMenu.appendItem(WebInspector.UIString("Copy entry as HAR"), this._copyResource.bind(this, resource)); 1003 contextMenu.appendItem(WebInspector.UIString("Copy all as HAR"), this._copyAll.bind(this)); 1004 1005 if (Preferences.saveAsAvailable) { 1006 contextMenu.appendSeparator(); 1007 if (resource) 1008 contextMenu.appendItem(WebInspector.UIString("Save entry as HAR"), this._exportResource.bind(this, resource)); 1009 contextMenu.appendItem(WebInspector.UIString("Save all as HAR"), this._exportAll.bind(this)); 1010 } 1011 1003 1012 contextMenu.show(event); 1004 1013 }, 1005 1014 1006 _ exportAll: function()1015 _copyAll: function() 1007 1016 { 1008 1017 var harArchive = { 1009 1018 log: (new WebInspector.HARLog()).build() 1010 } 1019 }; 1011 1020 InspectorFrontendHost.copyText(JSON.stringify(harArchive)); 1012 1021 }, 1013 1022 1014 _ exportResource: function(resource)1023 _copyResource: function(resource) 1015 1024 { 1016 1025 var har = (new WebInspector.HAREntry(resource)).build(); 1017 1026 InspectorFrontendHost.copyText(JSON.stringify(har)); 1027 }, 1028 1029 _exportAll: function() 1030 { 1031 var harArchive = { 1032 log: (new WebInspector.HARLog()).build() 1033 }; 1034 InspectorFrontendHost.saveAs(WebInspector.mainResource.domain + ".har", JSON.stringify(harArchive)); 1035 }, 1036 1037 _exportResource: function(resource) 1038 { 1039 var har = (new WebInspector.HAREntry(resource)).build(); 1040 InspectorFrontendHost.saveAs(resource.displayName + ".har", JSON.stringify(har)); 1018 1041 }, 1019 1042 -
trunk/Source/WebCore/inspector/front-end/Settings.js
r83864 r84358 50 50 debugMode: false, 51 51 heapProfilerPresent: false, 52 detailedHeapProfiles: false 52 detailedHeapProfiles: false, 53 saveAsAvailable: false 53 54 } 54 55 -
trunk/Source/WebCore/inspector/front-end/utilities.js
r83864 r84358 1075 1075 return new RegExp(regex, "i" + (extraFlags || "")); 1076 1076 } 1077 1078 function offerFileForDownload(contents)1079 {1080 var builder = new BlobBuilder();1081 builder.append(contents);1082 var blob = builder.getBlob("application/octet-stream");1083 var url = window.webkitURL.createObjectURL(blob);1084 window.open(url);1085 } -
trunk/Source/WebKit/chromium/ChangeLog
r84342 r84358 1 2011-04-20 Pavel Feldman <pfeldman@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: add saveAs into the InspectorFrontendHost binding. 6 https://bugs.webkit.org/show_bug.cgi?id=58979 7 8 * public/WebDevToolsFrontendClient.h: 9 (WebKit::WebDevToolsFrontendClient::saveAs): 10 * src/InspectorFrontendClientImpl.cpp: 11 (WebKit::InspectorFrontendClientImpl::saveAs): 12 * src/InspectorFrontendClientImpl.h: 13 * src/js/DevTools.js: 14 1 15 2011-04-19 Naoki Takano <takano.naoki@gmail.com> 2 16 -
trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h
r64729 r84358 50 50 virtual void requestDockWindow() { } 51 51 virtual void requestUndockWindow() { } 52 virtual void saveAs(const WebString& fileName, const WebString& content) { } 52 53 53 54 virtual bool shouldHideScriptsPanel() { return false; } -
trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
r66720 r84358 126 126 } 127 127 128 void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content) 129 { 130 m_client->saveAs(fileName, content); 131 } 132 128 133 void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) 129 134 { -
trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
r76248 r84358 67 67 virtual void requestDetachWindow(); 68 68 virtual void changeAttachedWindowHeight(unsigned); 69 virtual void saveAs(const WTF::String& fileName, const WTF::String& content); 69 70 70 71 virtual void inspectedURLChanged(const WTF::String&); -
trunk/Source/WebKit/chromium/src/js/DevTools.js
r84254 r84358 51 51 Preferences.showTimingTab = true; 52 52 Preferences.showCookiesTab = true; 53 Preferences.saveAsAvailable = true; 53 54 })(); 54 55
Note: See TracChangeset
for help on using the changeset viewer.