From e01141468ce4b3c39da89c3516cd21cbcf3fc0f7 Mon Sep 17 00:00:00 2001 From: "pfeldman@chromium.org" Date: Wed, 4 Apr 2012 15:40:13 +0000 Subject: [PATCH] Web Inspector: migrate from InspectorFrontendHost.saveAs to InspectorFrontendHost.save. https://bugs.webkit.org/show_bug.cgi?id=83162 Reviewed by Yury Semikhatsky. Source/WebCore: This change adds Save item into the context menus for inspector. It also makes saveAs parameter optional in the InspectorFrontendHost.save so that we could skip the dialog for the paths that were already saved. Embedder tells the front-end what urls were successfully saved so that front-end could issue subsequent save commands for those files. * English.lproj/localizedStrings.js: * inspector/InspectorFrontendClient.h: (InspectorFrontendClient): * inspector/InspectorFrontendClientLocal.h: (WebCore::InspectorFrontendClientLocal::canSave): (WebCore::InspectorFrontendClientLocal::save): * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::canSave): (WebCore::InspectorFrontendHost::save): * inspector/InspectorFrontendHost.h: (InspectorFrontendHost): * inspector/InspectorFrontendHost.idl: * inspector/front-end/InspectorFrontendHostStub.js: (.WebInspector.InspectorFrontendHostStub.prototype.canSave): * inspector/front-end/JavaScriptSourceFrame.js: * inspector/front-end/NetworkPanel.js: (WebInspector.NetworkLogView.prototype._contextMenu): (WebInspector.NetworkLogView.prototype._exportAll): (WebInspector.NetworkLogView.prototype._exportResource): * inspector/front-end/ResourceView.js: * inspector/front-end/ResourcesPanel.js: (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction.doSave): (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction.save): (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction): (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent.doSave): (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent.save): (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent): * inspector/front-end/Settings.js: * inspector/front-end/SourceFrame.js: (WebInspector.TextViewerDelegateForSourceFrame.prototype.populateTextAreaContextMenu): * inspector/front-end/TextViewer.js: (WebInspector.TextViewer.prototype._contextMenu): (WebInspector.TextViewer.prototype._commitEditing): (WebInspector.TextViewerDelegate.prototype.populateTextAreaContextMenu): * inspector/front-end/TimelineModel.js: (WebInspector.TimelineModel.prototype.saveToFile): * inspector/front-end/TimelinePanel.js: (WebInspector.TimelinePanel.prototype._registerShortcuts): (WebInspector.TimelinePanel.prototype._contextMenu): * inspector/front-end/inspector.js: Source/WebKit/chromium: * public/WebDevToolsFrontendClient.h: * src/InspectorFrontendClientImpl.cpp: (WebKit::InspectorFrontendClientImpl::canSave): (WebKit::InspectorFrontendClientImpl::save): * src/InspectorFrontendClientImpl.h: (InspectorFrontendClientImpl): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113192 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/inspector/timeline/timeline-load.html | 4 +- Source/WebCore/ChangeLog | 54 +++++++++++++++++++++ Source/WebCore/English.lproj/localizedStrings.js | Bin 81488 -> 81558 bytes Source/WebCore/inspector/InspectorFrontendClient.h | 4 +- .../inspector/InspectorFrontendClientLocal.h | 4 +- Source/WebCore/inspector/InspectorFrontendHost.cpp | 8 +-- Source/WebCore/inspector/InspectorFrontendHost.h | 4 +- Source/WebCore/inspector/InspectorFrontendHost.idl | 4 +- .../front-end/InspectorFrontendHostStub.js | 4 +- .../inspector/front-end/JavaScriptSourceFrame.js | 5 -- Source/WebCore/inspector/front-end/NetworkPanel.js | 6 +-- Source/WebCore/inspector/front-end/ResourceView.js | 5 -- .../WebCore/inspector/front-end/ResourcesPanel.js | 31 ++++++++---- Source/WebCore/inspector/front-end/Settings.js | 1 + Source/WebCore/inspector/front-end/SourceFrame.js | 9 ---- Source/WebCore/inspector/front-end/TextViewer.js | 15 +++--- .../WebCore/inspector/front-end/TimelineModel.js | 4 +- .../WebCore/inspector/front-end/TimelinePanel.js | 4 +- Source/WebCore/inspector/front-end/inspector.js | 13 +++++ Source/WebKit/chromium/ChangeLog | 14 ++++++ .../chromium/src/InspectorFrontendClientImpl.cpp | 6 +-- .../chromium/src/InspectorFrontendClientImpl.h | 4 +- 22 files changed, 139 insertions(+), 64 deletions(-) diff --git a/LayoutTests/inspector/timeline/timeline-load.html b/LayoutTests/inspector/timeline/timeline-load.html index 1712a74..d77fb49 100644 --- a/LayoutTests/inspector/timeline/timeline-load.html +++ b/LayoutTests/inspector/timeline/timeline-load.html @@ -8,7 +8,7 @@ function test() { WebInspector.showPanel("timeline"); InspectorTest.addSniffer(WebInspector.TimelineModel.prototype, "_loadNextChunk", loadNextChunk); - InspectorFrontendHost.saveAs = saveAs; + InspectorFrontendHost.save = save; var data = [ {"startTime":1310749854316.8408,"data":{"requestId":43,"url":"http://www.webkit.org/","requestMethod":"GET"},"type":"ResourceSendRequest","usedHeapSize":1819936,"totalHeapSize":7629120}, {"startTime":1310749855118.9329,"data":{"requestId":43,"statusCode":200,"mimeType":"text/html"},"children":[],"endTime":1310749855118.968,"type":"ResourceReceiveResponse","usedHeapSize":1819936,"totalHeapSize":7629120}, @@ -27,7 +27,7 @@ function test() WebInspector.panels.timeline._model.saveToFile(); } - function saveAs(name, saveData) + function save(name, saveData, saveAs) { saveData = JSON.parse(saveData); saveData.shift(); // strip version info diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 326d9a0..919b127 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,57 @@ +2012-04-04 Pavel Feldman + + Web Inspector: migrate from InspectorFrontendHost.saveAs to InspectorFrontendHost.save. + https://bugs.webkit.org/show_bug.cgi?id=83162 + + Reviewed by Yury Semikhatsky. + + This change adds Save item into the context menus for inspector. It also makes + saveAs parameter optional in the InspectorFrontendHost.save so that we could + skip the dialog for the paths that were already saved. Embedder tells the front-end + what urls were successfully saved so that front-end could issue subsequent save commands + for those files. + + * English.lproj/localizedStrings.js: + * inspector/InspectorFrontendClient.h: + (InspectorFrontendClient): + * inspector/InspectorFrontendClientLocal.h: + (WebCore::InspectorFrontendClientLocal::canSave): + (WebCore::InspectorFrontendClientLocal::save): + * inspector/InspectorFrontendHost.cpp: + (WebCore::InspectorFrontendHost::canSave): + (WebCore::InspectorFrontendHost::save): + * inspector/InspectorFrontendHost.h: + (InspectorFrontendHost): + * inspector/InspectorFrontendHost.idl: + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.canSave): + * inspector/front-end/JavaScriptSourceFrame.js: + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkLogView.prototype._contextMenu): + (WebInspector.NetworkLogView.prototype._exportAll): + (WebInspector.NetworkLogView.prototype._exportResource): + * inspector/front-end/ResourceView.js: + * inspector/front-end/ResourcesPanel.js: + (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction.doSave): + (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction.save): + (WebInspector.FrameResourceTreeElement.prototype._appendSaveAsAction): + (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent.doSave): + (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent.save): + (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent): + * inspector/front-end/Settings.js: + * inspector/front-end/SourceFrame.js: + (WebInspector.TextViewerDelegateForSourceFrame.prototype.populateTextAreaContextMenu): + * inspector/front-end/TextViewer.js: + (WebInspector.TextViewer.prototype._contextMenu): + (WebInspector.TextViewer.prototype._commitEditing): + (WebInspector.TextViewerDelegate.prototype.populateTextAreaContextMenu): + * inspector/front-end/TimelineModel.js: + (WebInspector.TimelineModel.prototype.saveToFile): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._registerShortcuts): + (WebInspector.TimelinePanel.prototype._contextMenu): + * inspector/front-end/inspector.js: + 2012-04-04 Andrey Kosyakov Web Inspector: time dividers are incorrectly rendered on empty timeline grid diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 438d08aeb5e53032545e7d9c449104e929b3565b..69466eab6986fdb54e18bc74350203ff3340a977 100644 GIT binary patch delta 39 vcmccchh^GdmWC;ertHBCi40{7sgoP*MJGQt)0({h2G7)5MzyW!j4y2gGxiTR delta 19 bcmbRCm*v7AmWC;erjz&I;Mv;F$ZrP#U?T`} diff --git a/Source/WebCore/inspector/InspectorFrontendClient.h b/Source/WebCore/inspector/InspectorFrontendClient.h index ead3ee8..6ef5ccd 100644 --- a/Source/WebCore/inspector/InspectorFrontendClient.h +++ b/Source/WebCore/inspector/InspectorFrontendClient.h @@ -59,8 +59,8 @@ public: virtual void requestSetDockSide(const String&) = 0; virtual void changeAttachedWindowHeight(unsigned) = 0; virtual void openInNewTab(const String& url) = 0; - virtual bool canSaveAs() = 0; - virtual void saveAs(const WTF::String& fileName, const WTF::String& content) = 0; + virtual bool canSave() = 0; + virtual void save(const WTF::String& url, const WTF::String& content, bool forceSaveAs) = 0; virtual void inspectedURLChanged(const String&) = 0; diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.h b/Source/WebCore/inspector/InspectorFrontendClientLocal.h index c49e578..f4eeff7 100644 --- a/Source/WebCore/inspector/InspectorFrontendClientLocal.h +++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.h @@ -68,8 +68,8 @@ public: virtual void requestSetDockSide(const String&) { } virtual void changeAttachedWindowHeight(unsigned); virtual void openInNewTab(const String& url); - virtual bool canSaveAs() { return false; } - virtual void saveAs(const String&, const String&) { } + virtual bool canSave() { return false; } + virtual void save(const String&, const String&, bool) { } virtual void attachWindow() = 0; virtual void detachWindow() = 0; diff --git a/Source/WebCore/inspector/InspectorFrontendHost.cpp b/Source/WebCore/inspector/InspectorFrontendHost.cpp index e18837d..052de3e 100644 --- a/Source/WebCore/inspector/InspectorFrontendHost.cpp +++ b/Source/WebCore/inspector/InspectorFrontendHost.cpp @@ -232,17 +232,17 @@ void InspectorFrontendHost::openInNewTab(const String& url) m_client->openInNewTab(url); } -bool InspectorFrontendHost::canSaveAs() +bool InspectorFrontendHost::canSave() { if (m_client) - return m_client->canSaveAs(); + return m_client->canSave(); return false; } -void InspectorFrontendHost::saveAs(const String& fileName, const String& content) +void InspectorFrontendHost::save(const String& url, const String& content, bool forceSaveAs) { if (m_client) - m_client->saveAs(fileName, content); + m_client->save(url, content, forceSaveAs); } void InspectorFrontendHost::sendMessageToBackend(const String& message) diff --git a/Source/WebCore/inspector/InspectorFrontendHost.h b/Source/WebCore/inspector/InspectorFrontendHost.h index 17d9d32..bb3f967 100644 --- a/Source/WebCore/inspector/InspectorFrontendHost.h +++ b/Source/WebCore/inspector/InspectorFrontendHost.h @@ -75,8 +75,8 @@ public: void copyText(const String& text); void openInNewTab(const String& url); - bool canSaveAs(); - void saveAs(const String& fileName, const String& content); + bool canSave(); + void save(const String& url, const String& content, bool forceSaveAs); // Called from [Custom] implementations. void showContextMenu(Event*, const Vector& items); diff --git a/Source/WebCore/inspector/InspectorFrontendHost.idl b/Source/WebCore/inspector/InspectorFrontendHost.idl index 1127c3b..73cee58 100644 --- a/Source/WebCore/inspector/InspectorFrontendHost.idl +++ b/Source/WebCore/inspector/InspectorFrontendHost.idl @@ -52,8 +52,8 @@ module core { void copyText(in DOMString text); void openInNewTab(in DOMString url); - boolean canSaveAs(); - void saveAs(in DOMString fileName, in DOMString content); + boolean canSave(); + void save(in DOMString url, in DOMString content, in boolean forceSaveAs); [Custom] DOMString platform(); [Custom] DOMString port(); diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js index ac314a4..995b6a4 100644 --- a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js +++ b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js @@ -118,12 +118,12 @@ WebInspector.InspectorFrontendHostStub.prototype = { window.open(url, "_blank"); }, - canSaveAs: function(fileName, content) + canSave: function() { return true; }, - saveAs: function(fileName, content) + save: function(url, content, forceSaveAs) { var builder = new WebKitBlobBuilder(); builder.append(content); diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index b3fde9d..b5e39f9 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -84,11 +84,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { return this._model.canEditScriptSource(this._uiSourceCode); }, - suggestedFileName: function() - { - return this._uiSourceCode.fileName || "untitled.js"; - }, - editContent: function(newContent, callback) { this._editingContent = true; diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index e0f72ee..af590d2 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -947,7 +947,7 @@ WebInspector.NetworkLogView.prototype = { } contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy all as HAR" : "Copy All as HAR"), this._copyAll.bind(this)); - if (InspectorFrontendHost.canSaveAs()) { + if (InspectorFrontendHost.canSave()) { contextMenu.appendSeparator(); if (resource) contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save entry as HAR" : "Save Entry as HAR"), this._exportResource.bind(this, resource)); @@ -999,13 +999,13 @@ WebInspector.NetworkLogView.prototype = { log: (new WebInspector.HARLog(this._resources)).build() }; - InspectorFrontendHost.saveAs(WebInspector.inspectedPageDomain + ".har", JSON.stringify(harArchive, null, 2)); + InspectorFrontendHost.save(WebInspector.inspectedPageDomain + ".har", JSON.stringify(harArchive, null, 2), true); }, _exportResource: function(resource) { var har = (new WebInspector.HAREntry(resource)).build(); - InspectorFrontendHost.saveAs(resource.displayName + ".har", JSON.stringify(har, null, 2)); + InspectorFrontendHost.save(resource.displayName + ".har", JSON.stringify(har, null, 2), true); }, _clearBrowserCache: function(event) diff --git a/Source/WebCore/inspector/front-end/ResourceView.js b/Source/WebCore/inspector/front-end/ResourceView.js index 8dcdde9..2c183a9 100644 --- a/Source/WebCore/inspector/front-end/ResourceView.js +++ b/Source/WebCore/inspector/front-end/ResourceView.js @@ -116,11 +116,6 @@ WebInspector.ResourceSourceFrame.prototype = { this.resource.requestContent(contentLoaded.bind(this)); }, - suggestedFileName: function() - { - return this.resource.displayName; - }, - _contentChanged: function(event) { this.setContent(WebInspector.ResourceSourceFrame.mimeTypeForResource[this._resource], this._resource.content); diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index d0aa168..f646a22 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -1267,7 +1267,7 @@ WebInspector.FrameResourceTreeElement.prototype = { _appendSaveAsAction: function(contextMenu, event) { - if (!InspectorFrontendHost.canSaveAs()) + if (!InspectorFrontendHost.canSave()) return; if (this._resource.type !== WebInspector.Resource.Type.Document && @@ -1275,14 +1275,19 @@ WebInspector.FrameResourceTreeElement.prototype = { this._resource.type !== WebInspector.Resource.Type.Script) return; - function save() + function doSave(forceSaveAs, content) { - var fileName = this._resource.displayName; - this._resource.requestContent(InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName)); + InspectorFrontendHost.save(this._resource.url, content, forceSaveAs); + } + + function save(forceSaveAs) + { + this._resource.requestContent(doSave.bind(this, forceSaveAs)); } contextMenu.appendSeparator(); - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), save.bind(this)); + contextMenu.appendItem(WebInspector.UIString("Save"), save.bind(this, false)); + contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), save.bind(this, true)); }, _setBubbleText: function(x) @@ -2054,14 +2059,20 @@ WebInspector.ResourceRevisionTreeElement.prototype = { var contextMenu = new WebInspector.ContextMenu(); contextMenu.appendItem(WebInspector.UIString("Revert to this revision"), this._revision.revertToThis.bind(this._revision)); - if (InspectorFrontendHost.canSaveAs()) { - function save() + if (InspectorFrontendHost.canSave()) { + function doSave(forceSaveAs, content) { - var fileName = this._revision.resource.displayName; - this._revision.requestContent(InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName)); + InspectorFrontendHost.save(this._revision.resource.url, content, forceSaveAs); } + + function save(forceSaveAs) + { + this._revision.requestContent(doSave.bind(this, forceSaveAs)); + } + contextMenu.appendSeparator(); - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), save.bind(this)); + contextMenu.appendItem(WebInspector.UIString("Save"), save.bind(this, false)); + contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), save.bind(this, true)); } contextMenu.show(event); diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index 50c423f..9342cb5 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -93,6 +93,7 @@ WebInspector.Settings = function() this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false); this.showPaintRects = this.createSetting("showPaintRects", false); this.zoomLevel = this.createSetting("zoomLevel", 0); + this.savedURLs = this.createSetting("savedURLs", {}); // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused // periodical breakpoints duplication leading to inspector slowness. diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index e642294..a6a996a 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -476,10 +476,6 @@ WebInspector.SourceFrame.prototype = { WebInspector.populateResourceContextMenu(contextMenu, this._url, lineNumber); }, - suggestedFileName: function() - { - }, - inheritScrollPositions: function(sourceFrame) { this._textViewer.inheritScrollPositions(sourceFrame._textViewer); @@ -549,11 +545,6 @@ WebInspector.TextViewerDelegateForSourceFrame.prototype = { populateTextAreaContextMenu: function(contextMenu, lineNumber) { this._sourceFrame.populateTextAreaContextMenu(contextMenu, lineNumber); - }, - - suggestedFileName: function() - { - return this._sourceFrame.suggestedFileName(); } } diff --git a/Source/WebCore/inspector/front-end/TextViewer.js b/Source/WebCore/inspector/front-end/TextViewer.js index b7cfa0b..f5ffaab 100644 --- a/Source/WebCore/inspector/front-end/TextViewer.js +++ b/Source/WebCore/inspector/front-end/TextViewer.js @@ -42,7 +42,7 @@ WebInspector.TextViewer = function(textModel, platform, url, delegate) this._textModel.addEventListener(WebInspector.TextEditorModel.Events.TextChanged, this._textChanged, this); this._textModel.resetUndoStack(); this._delegate = delegate; - + this._url = url; this.element.className = "text-editor monospace"; var enterTextChangeMode = this._enterInternalTextChangeMode.bind(this); @@ -290,9 +290,10 @@ WebInspector.TextViewer.prototype = { target = this._mainPanel._enclosingLineRowOrSelf(event.target); this._delegate.populateTextAreaContextMenu(contextMenu, target && target.lineNumber); } - var fileName = this._delegate.suggestedFileName(); - if (fileName) - contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), InspectorFrontendHost.saveAs.bind(InspectorFrontendHost, fileName, this._textModel.text)); + if (this._url) { + contextMenu.appendItem(WebInspector.UIString("Save"), InspectorFrontendHost.save.bind(InspectorFrontendHost, this._url, this._textModel.text, false)); + contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Save as..." : "Save As..."), InspectorFrontendHost.save.bind(InspectorFrontendHost, this._url, this._textModel.text, true)); + } contextMenu.show(event); }, @@ -303,6 +304,8 @@ WebInspector.TextViewer.prototype = { return false; this._delegate.commitEditing(); + if (this._url && WebInspector.isURLSaved(this._url)) + InspectorFrontendHost.save(this._url, this._textModel.text, false); return true; }, @@ -337,9 +340,7 @@ WebInspector.TextViewerDelegate.prototype = { populateLineGutterContextMenu: function(contextMenu, lineNumber) { }, - populateTextAreaContextMenu: function(contextMenu, lineNumber) { }, - - suggestedFileName: function() { } + populateTextAreaContextMenu: function(contextMenu, lineNumber) { } } /** diff --git a/Source/WebCore/inspector/front-end/TimelineModel.js b/Source/WebCore/inspector/front-end/TimelineModel.js index 383a15d..3f398ce 100644 --- a/Source/WebCore/inspector/front-end/TimelineModel.js +++ b/Source/WebCore/inspector/front-end/TimelineModel.js @@ -202,8 +202,8 @@ WebInspector.TimelineModel.prototype = { records[records.length - 1] = records[records.length - 1] + "]"; var now = new Date(); - var suggestedFileName = "TimelineRawData-" + now.toISO8601Compact() + ".json"; - InspectorFrontendHost.saveAs(suggestedFileName, records.join(",\n")); + var fileName = "TimelineRawData-" + now.toISO8601Compact() + ".json"; + InspectorFrontendHost.save(fileName, records.join(",\n"), true); }, reset: function() diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 95c500e..fadcd4e 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -269,7 +269,7 @@ WebInspector.TimelinePanel.prototype = { this._shortcuts[shortcut.makeKey("e", modifiers.CtrlOrMeta)] = this._toggleTimelineButtonClicked.bind(this); section.addKey(shortcut.shortcutToString("e", modifiers.CtrlOrMeta), WebInspector.UIString("Start/stop recording")); - if (InspectorFrontendHost.canSaveAs()) { + if (InspectorFrontendHost.canSave()) { this._shortcuts[shortcut.makeKey("s", modifiers.CtrlOrMeta)] = this._saveToFile.bind(this); section.addKey(shortcut.shortcutToString("s", modifiers.CtrlOrMeta), WebInspector.UIString("Save timeline data")); } @@ -295,7 +295,7 @@ WebInspector.TimelinePanel.prototype = { _contextMenu: function(event) { var contextMenu = new WebInspector.ContextMenu(); - if (InspectorFrontendHost.canSaveAs()) + if (InspectorFrontendHost.canSave()) contextMenu.appendItem(WebInspector.UIString("Save Timeline data\u2026"), this._saveToFile.bind(this)); contextMenu.appendItem(WebInspector.UIString("Load Timeline data\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement)); contextMenu.show(event); diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 1393f03..4fdc2e0 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -1020,3 +1020,16 @@ WebInspector._toolbarItemClicked = function(event) var toolbarItem = event.currentTarget; WebInspector.inspectorView.setCurrentPanel(toolbarItem.panel); } + +WebInspector.savedURL = function(url) +{ + var savedURLs = WebInspector.settings.savedURLs.get(); + savedURLs[url] = true; + WebInspector.settings.savedURLs.set(savedURLs); +} + +WebInspector.isURLSaved = function(url) +{ + var savedURLs = WebInspector.settings.savedURLs.get(); + return savedURLs[url]; +} diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index b81f887..75b1291 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,17 @@ +2012-04-04 Pavel Feldman + + Web Inspector: migrate from InspectorFrontendHost.saveAs to InspectorFrontendHost.save. + https://bugs.webkit.org/show_bug.cgi?id=83162 + + Reviewed by Yury Semikhatsky. + + * public/WebDevToolsFrontendClient.h: + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::canSave): + (WebKit::InspectorFrontendClientImpl::save): + * src/InspectorFrontendClientImpl.h: + (InspectorFrontendClientImpl): + 2012-04-04 Hans Wennborg WebSpeechRecognizer.h: add missing forward declaration diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index ee2e89a..d07c3d2 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -129,14 +129,14 @@ void InspectorFrontendClientImpl::openInNewTab(const String& url) m_client->openInNewTab(url); } -bool InspectorFrontendClientImpl::canSaveAs() +bool InspectorFrontendClientImpl::canSave() { return true; } -void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content) +void InspectorFrontendClientImpl::save(const String& url, const String& content, bool forceSaveAs) { - m_client->saveAs(fileName, content); + m_client->save(url, content, forceSaveAs); } void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h index 4f7a72b..6f6f93d 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -69,8 +69,8 @@ public: virtual void openInNewTab(const String& url); - virtual bool canSaveAs(); - virtual void saveAs(const WTF::String& fileName, const WTF::String& content); + virtual bool canSave(); + virtual void save(const WTF::String& urk, const WTF::String& content, bool forceSaveAs); virtual void inspectedURLChanged(const WTF::String&); -- 2.7.4