Web Inspector: Remove Reload and Download Web Archive buttons from FrameTreeElement
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / FrameTreeElement.js
index 35af996..af3e3ae 100644 (file)
@@ -63,12 +63,6 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
             WebInspector.ContentFlowTreeElement
         );
 
-        this.registerFolderizeSettings("canvases", WebInspector.UIString("Canvases"),
-            function(representedObject) { return representedObject instanceof WebInspector.Canvas; },
-            function() { return WebInspector.canvasManager.canvasesForFrame(this._frame).length; }.bind(this),
-            WebInspector.CanvasTreeElement
-        );
-
         function makeValidateCallback(resourceType) {
             return function(representedObject) {
                 return representedObject instanceof WebInspector.Resource && representedObject.type === resourceType;
@@ -141,29 +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);
-
-        WebInspector.canvasManager.addEventListener(WebInspector.CanvasManager.Event.CanvasesAvailable, this._canvasesAvailable, this);
-        WebInspector.canvasManager.addEventListener(WebInspector.CanvasManager.Event.CanvasWasAdded, this._canvasWasAdded, this);
-        WebInspector.canvasManager.addEventListener(WebInspector.CanvasManager.Event.CanvasWasRemoved, this._canvasWasRemoved, 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);
-
-        WebInspector.canvasManager.removeEventListener(WebInspector.CanvasManager.Event.CanvasesAvailable, this._canvasesAvailable, this);
-        WebInspector.canvasManager.removeEventListener(WebInspector.CanvasManager.Event.CanvasWasAdded, this._canvasWasAdded, this);
-        WebInspector.canvasManager.removeEventListener(WebInspector.CanvasManager.Event.CanvasWasRemoved, this._canvasWasRemoved, 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).
@@ -189,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()
@@ -264,11 +189,8 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         for (var flowKey in flowMap)
             this.addChildForRepresentedObject(flowMap[flowKey]);
 
-        var canvases = WebInspector.canvasManager.canvasesForFrame(this._frame);
-        for (var canvas of canvases)
-            this.addChildForRepresentedObject(canvas);
     }
-        
+
     onexpand()
     {
         this._expandedSetting.value = true;
@@ -305,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;
     }
 
@@ -341,73 +260,9 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         this.removeChildForRepresentedObject(event.data.flow);
     }
 
-    _canvasesAvailable(event)
-    {
-        this.updateParentStatus();
-        this.removeChildren();
-
-        this.shouldRefreshChildren = true;
-    }
-
-    _canvasWasAdded(event)
-    {
-        var canvas = event.data.canvas;
-        if (canvas.parentFrame == this._frame)
-            this.addRepresentedObjectToNewChildQueue(canvas);
-    }
-
-    _canvasWasRemoved(event)
-    {
-        var canvas = event.data.canvas;
-        if (canvas.parentFrame == this._frame)
-            this.removeChildForRepresentedObject(canvas);
-    }
-
     _rootDOMNodeInvalidated()
     {
         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();
-    }
 };