Web Inspector: Remove Reload and Download Web Archive buttons from FrameTreeElement
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:19:35 +0000 (01:19 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:19:35 +0000 (01:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144064

The will be global toolbar items soon.

Reviewed by Joseph Pecoraro.

* UserInterface/Views/FrameTreeElement.js:
* UserInterface/Views/ResourceTreeElement.js:
(WebInspector.ResourceTreeElement.prototype._updateStatus):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183329 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js
Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js

index d6c62bf..3f3f1b0 100644 (file)
@@ -1,5 +1,18 @@
 2015-04-22  Timothy Hatcher  <timothy@apple.com>
 
+        Web Inspector: Remove Reload and Download Web Archive buttons from FrameTreeElement
+        https://bugs.webkit.org/show_bug.cgi?id=144064
+
+        The will be global toolbar items soon.
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/FrameTreeElement.js:
+        * UserInterface/Views/ResourceTreeElement.js:
+        (WebInspector.ResourceTreeElement.prototype._updateStatus):
+
+2015-04-22  Timothy Hatcher  <timothy@apple.com>
+
         Web Inspector: Remove time and weight from the dashboard
         https://bugs.webkit.org/show_bug.cgi?id=144063
 
index ae2ba79..af3e3ae 100644 (file)
@@ -135,21 +135,6 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
     {
         // Immediate superclasses are skipped, since Frames handle their own SourceMapResources.
         WebInspector.GeneralTreeElement.prototype.onattach.call(this);
-
-        if (this._frame.isMainFrame()) {
-            WebInspector.notifications.addEventListener(WebInspector.Notification.PageArchiveStarted, this._pageArchiveStarted, this);
-            WebInspector.notifications.addEventListener(WebInspector.Notification.PageArchiveEnded, this._pageArchiveEnded, this);
-        }
-    }
-
-    ondetach()
-    {
-        WebInspector.ResourceTreeElement.prototype.ondetach.call(this);
-
-        if (this._frame.isMainFrame()) {
-            WebInspector.notifications.removeEventListener(WebInspector.Notification.PageArchiveStarted, this._pageArchiveStarted, this);
-            WebInspector.notifications.removeEventListener(WebInspector.Notification.PageArchiveEnded, this._pageArchiveEnded, this);
-        }
     }
 
     // Overrides from FolderizedTreeElement (Protected).
@@ -175,52 +160,6 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         return aIsResource ? 1 : -1;
     }
 
-    // Called from ResourceTreeElement.
-
-    updateStatusForMainFrame()
-    {
-        function loadedImages()
-        {
-            if (!this._reloadButton || !this._downloadButton)
-                return;
-
-            var fragment = document.createDocumentFragment("div");
-            fragment.appendChild(this._downloadButton.element);
-            fragment.appendChild(this._reloadButton.element);
-            this.status = fragment;
-
-            delete this._loadingMainFrameButtons;
-        }
-
-        if (this._reloadButton && this._downloadButton) {
-            loadedImages.call(this);
-            return;
-        }
-
-        if (!this._loadingMainFrameButtons) {
-            this._loadingMainFrameButtons = true;
-
-            var tooltip;
-            if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript)
-                tooltip = WebInspector.UIString("Restart (%s)").format(WebInspector._reloadPageKeyboardShortcut.displayName);
-            else
-                tooltip = WebInspector.UIString("Reload page (%s)\nReload ignoring cache (%s)").format(WebInspector._reloadPageKeyboardShortcut.displayName, WebInspector._reloadPageIgnoringCacheKeyboardShortcut.displayName);
-
-            wrappedSVGDocument(platformImagePath("Reload.svg"), null, tooltip, function(element) {
-                this._reloadButton = new WebInspector.TreeElementStatusButton(element);
-                this._reloadButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._reloadPageClicked, this);
-                loadedImages.call(this);
-            }.bind(this));
-
-            wrappedSVGDocument(platformImagePath("DownloadArrow.svg"), null, WebInspector.UIString("Download Web Archive"), function(element) {
-                this._downloadButton = new WebInspector.TreeElementStatusButton(element);
-                this._downloadButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._downloadButtonClicked, this);
-                this._updateDownloadButton();
-                loadedImages.call(this);
-            }.bind(this));
-        }
-    }
-
     // Overrides from TreeElement (Private).
 
     onpopulate()
@@ -288,9 +227,6 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         // shouldRefreshChildren will call onpopulate if expanded is true.
         this._updateExpandedSetting();
 
-        if (this._frame.isMainFrame())
-            this._updateDownloadButton();
-
         this.shouldRefreshChildren = true;
     }
 
@@ -329,46 +265,4 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         if (this.expanded)
             this._frame.domTree.requestContentFlowList();
     }
-
-    _reloadPageClicked(event)
-    {
-        // Ignore cache when the shift key is pressed.
-        PageAgent.reload(event.data.shiftKey);
-    }
-
-    _downloadButtonClicked(event)
-    {
-        WebInspector.archiveMainFrame();
-    }
-
-    _updateDownloadButton()
-    {
-        console.assert(this._frame.isMainFrame());
-        if (!this._downloadButton)
-            return;
-
-        if (!PageAgent.archive || WebInspector.debuggableType !== WebInspector.DebuggableType.Web) {
-            this._downloadButton.hidden = true;
-            return;
-        }
-
-        if (this._downloadingPage) {
-            this._downloadButton.enabled = false;
-            return;
-        }
-
-        this._downloadButton.enabled = WebInspector.canArchiveMainFrame();
-    }
-
-    _pageArchiveStarted(event)
-    {
-        this._downloadingPage = true;
-        this._updateDownloadButton();
-    }
-
-    _pageArchiveEnded(event)
-    {
-        this._downloadingPage = false;
-        this._updateDownloadButton();
-    }
 };
index e888e81..7bfd0d0 100644 (file)
@@ -160,12 +160,8 @@ WebInspector.ResourceTreeElement = class ResourceTreeElement extends WebInspecto
             this.removeClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);
 
         if (this._resource.finished || this._resource.failed) {
-            // Remove the spinner and replace with a reload button in case it's the main frame's main resource.
-            var frame = this._resource.parentFrame;
-            if (this._resource.isMainResource() && frame && frame.isMainFrame() && this instanceof WebInspector.FrameTreeElement)
-                this.updateStatusForMainFrame();
-            else
-                this.status = "";
+            // Remove the spinner.
+            this.status = "";
         } else {
             var spinner = new WebInspector.IndeterminateProgressSpinner;
             this.status = spinner.element;