Title: [119815] trunk/Source
Revision
119815
Author
[email protected]
Date
2012-06-08 02:50:26 -0700 (Fri, 08 Jun 2012)

Log Message

Add FileSystem item to storage tree.
https://bugs.webkit.org/show_bug.cgi?id=72691

Patch by Taiju Tsuiki <[email protected]> on 2012-06-08
Reviewed by Vsevolod Vlasov.

Source/WebCore:

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.py:
* inspector/front-end/FileSystemModel.js: Added.
* inspector/front-end/Images/fileSystem.png: Added.
* inspector/front-end/ResourcesPanel.js:
(WebInspector.FileSystemListTreeElement):
(WebInspector.FileSystemListTreeElement.prototype.onexpand):
(WebInspector.FileSystemListTreeElement.prototype.onattach):
(WebInspector.FileSystemListTreeElement.prototype._handleContextMenuEvent):
(WebInspector.FileSystemListTreeElement.prototype._fileSystemAdded):
(WebInspector.FileSystemListTreeElement.prototype._fileSystemRemoved):
(WebInspector.FileSystemListTreeElement.prototype._fileSystemTreeElementByName):
(WebInspector.FileSystemListTreeElement.prototype._refreshFileSystem):
(WebInspector.FileSystemTreeElement):
(WebInspector.FileSystemTreeElement.prototype.get fileSystemName):
(WebInspector.FileSystemTreeElement.prototype.get itemURL):
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:
* inspector/front-end/resourcesPanel.css:
(.file-system-storage-tree-item .icon):
* inspector/front-end/utilities.js:

Source/WebKit/chromium:

* src/js/DevTools.js:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119814 => 119815)


--- trunk/Source/WebCore/ChangeLog	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/ChangeLog	2012-06-08 09:50:26 UTC (rev 119815)
@@ -1,3 +1,35 @@
+2012-06-08  Taiju Tsuiki  <[email protected]>
+
+        Add FileSystem item to storage tree.
+        https://bugs.webkit.org/show_bug.cgi?id=72691
+
+        Reviewed by Vsevolod Vlasov.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.py:
+        * inspector/front-end/FileSystemModel.js: Added.
+        * inspector/front-end/Images/fileSystem.png: Added.
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.FileSystemListTreeElement):
+        (WebInspector.FileSystemListTreeElement.prototype.onexpand):
+        (WebInspector.FileSystemListTreeElement.prototype.onattach):
+        (WebInspector.FileSystemListTreeElement.prototype._handleContextMenuEvent):
+        (WebInspector.FileSystemListTreeElement.prototype._fileSystemAdded):
+        (WebInspector.FileSystemListTreeElement.prototype._fileSystemRemoved):
+        (WebInspector.FileSystemListTreeElement.prototype._fileSystemTreeElementByName):
+        (WebInspector.FileSystemListTreeElement.prototype._refreshFileSystem):
+        (WebInspector.FileSystemTreeElement):
+        (WebInspector.FileSystemTreeElement.prototype.get fileSystemName):
+        (WebInspector.FileSystemTreeElement.prototype.get itemURL):
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/resourcesPanel.css:
+        (.file-system-storage-tree-item .icon):
+        * inspector/front-end/utilities.js:
+
 2012-06-08  Kentaro Hara  <[email protected]>
 
         REGRESSION r119802: Remove unnecessary ASSERT(!m_deletionHasBegun) from Document.h

Modified: trunk/Source/WebCore/WebCore.gypi (119814 => 119815)


--- trunk/Source/WebCore/WebCore.gypi	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/WebCore.gypi	2012-06-08 09:50:26 UTC (rev 119815)
@@ -6403,6 +6403,7 @@
             'inspector/front-end/ExtensionRegistryStub.js',
             'inspector/front-end/ExtensionServer.js',
             'inspector/front-end/FileManager.js',
+            'inspector/front-end/FileSystemModel.js',
             'inspector/front-end/FilteredItemSelectionDialog.js',
             'inspector/front-end/FontView.js',
             'inspector/front-end/GoToLineDialog.js',
@@ -6596,6 +6597,7 @@
             'inspector/front-end/Images/errorMediumIcon.png',
             'inspector/front-end/Images/errorRedDot.png',
             'inspector/front-end/Images/forward.png',
+            'inspector/front-end/Images/fileSystem.png',
             'inspector/front-end/Images/frame.png',
             'inspector/front-end/Images/glossyHeader.png',
             'inspector/front-end/Images/glossyHeaderPressed.png',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (119814 => 119815)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-06-08 09:50:26 UTC (rev 119815)
@@ -74602,6 +74602,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\FileSystemModel.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\filteredItemSelectionDialog.css"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (119814 => 119815)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2012-06-08 09:50:26 UTC (rev 119815)
@@ -82,6 +82,7 @@
             "DebuggerResourceBinding.js",
             "DebuggerScriptMapping.js",
             "FileManager.js",
+            "FileSystemModel.js",
             "HAREntry.js",
             "IndexedDBModel.js",
             "Linkifier.js",

Added: trunk/Source/WebCore/inspector/front-end/FileSystemModel.js (0 => 119815)


--- trunk/Source/WebCore/inspector/front-end/FileSystemModel.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/FileSystemModel.js	2012-06-08 09:50:26 UTC (rev 119815)
@@ -0,0 +1,225 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ * @implements {FileSystemAgent.Dispatcher}
+ */
+WebInspector.FileSystemModel = function()
+{
+    WebInspector.Object.call(this);
+
+    this._originForFrameId = {};
+    this._frameIdsForOrigin = {};
+    this._fileSystemsForOrigin = {};
+
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
+
+    InspectorBackend.registerFileSystemDispatcher(this);
+    FileSystemAgent.enable();
+
+    if (WebInspector.resourceTreeModel.mainFrame)
+        this._attachFrameRecursively(WebInspector.resourceTreeModel.mainFrame);
+}
+
+WebInspector.FileSystemModel.prototype = {
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _frameAdded: function(event)
+    {
+        var frame = /** @type {WebInspector.ResourceTreeFrame} */ event.data;
+        this._attachFrameRecursively(frame);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _frameNavigated: function(event)
+    {
+        var frame = /** @type {WebInspector.ResourceTreeFrame} */ event.data;
+        this._attachFrameRecursively(frame);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _frameDetached: function(event)
+    {
+        var frame = /** @type {WebInspector.ResourceTreeFrame} */ event.data;
+        this._detachFrameRecursively(frame);
+    },
+
+    /**
+     * @param {WebInspector.ResourceTreeFrame} frame
+     */
+    _attachFrame: function(frame)
+    {
+        if (this._originForFrameId[frame.id])
+            this._detachFrameRecursively(frame);
+
+        if (frame.securityOrigin === "null")
+            return;
+
+        this._originForFrameId[frame.id] = frame.securityOrigin;
+
+        var newOrigin = false;
+        if (!this._frameIdsForOrigin[frame.securityOrigin]) {
+            this._frameIdsForOrigin[frame.securityOrigin] = {};
+            newOrigin = true;
+        }
+        this._frameIdsForOrigin[frame.securityOrigin][frame.id] = frame.id;
+        if (newOrigin)
+            this._originAdded(frame.securityOrigin);
+    },
+
+    /**
+     * @param {WebInspector.ResourceTreeFrame} frame
+     */
+    _attachFrameRecursively: function(frame)
+    {
+        this._attachFrame(frame);
+        for (var i = 0; i < frame.childFrames.length; ++i)
+            this._attachFrameRecursively(frame.childFrames[i]);
+    },
+
+    /**
+     * @param {WebInspector.ResourceTreeFrame} frame
+     */
+    _detachFrame: function(frame)
+    {
+        if (!this._originForFrameId[frame.id])
+            return;
+        var origin = this._originForFrameId[frame.id];
+        delete this._originForFrameId[frame.id];
+        delete this._frameIdsForOrigin[origin][frame.id];
+
+        var lastOrigin = this._frameIdsForOrigin[origin].isEmpty();
+        if (lastOrigin) {
+            delete this._frameIdsForOrigin[origin];
+            this._originRemoved(origin);
+        }
+    },
+
+    /**
+     * @param {WebInspector.ResourceTreeFrame} frame
+     */
+    _detachFrameRecursively: function(frame)
+    {
+        for (var i = 0; i < frame.childFrames.length; ++i)
+            this._detachFrameRecursively(frame.childFrames[i]);
+        this._detachFrame(frame);
+    },
+
+    /**
+     * @param {string} origin
+     */
+    _originAdded: function(origin)
+    {
+        this._fileSystemsForOrigin[origin] = {};
+
+        var types = ["persistent", "temporary"];
+        for (var i = 0; i < types.length; ++i) {
+            // FIXME(88602): Check if the filesystem is initialized, and show it only if it was.
+            var fileSystem = new WebInspector.FileSystemModel.FileSystem(this, origin, types[i]);
+            this._fileSystemsForOrigin[origin][types[i]] = fileSystem;
+            this._fileSystemAdded(fileSystem);
+        }
+    },
+
+    /**
+     * @param {string} origin
+     */
+    _originRemoved: function(origin)
+    {
+        for (var type in this._fileSystemsForOrigin[origin]) {
+            var fileSystem = this._fileSystemsForOrigin[origin][type];
+            delete this._fileSystemsForOrigin[origin][type];
+            this._fileSystemRemoved(fileSystem);
+        }
+        delete this._fileSystemsForOrigin[origin];
+    },
+
+    /**
+     * @param {WebInspector.FileSystemModel.FileSystem} fileSystem
+     */
+    _fileSystemAdded: function(fileSystem)
+    {
+        this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemAdded, fileSystem);
+    },
+
+    /**
+     * @param {WebInspector.FileSystemModel.FileSystem} fileSystem
+     */
+    _fileSystemRemoved: function(fileSystem)
+    {
+        this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemRemoved, fileSystem);
+    },
+
+    refreshFileSystemList: function()
+    {
+        for (var origin in this._fileSystemsForOrigin)
+            for (var type in this._fileSystemsForOrigin[origin])
+                this._fileSystemRemoved(this._fileSystemsForOrigin[origin][type]);
+
+        for (var origin in this._fileSystemsForOrigin)
+            for (var type in this._fileSystemsForOrigin[origin])
+                this._fileSystemAdded(this._fileSystemsForOrigin[origin][type]);
+    }
+}
+
+WebInspector.FileSystemModel.EventTypes = {
+    FileSystemAdded: "FileSystemAdded",
+    FileSystemRemoved: "FileSystemRemoved"
+}
+
+WebInspector.FileSystemModel.prototype.__proto__ = WebInspector.Object.prototype;
+
+/**
+ * @constructor
+ * @param {WebInspector.FileSystemModel} fileSystemModel
+ * @param {string} origin
+ * @param {string} type
+ */
+WebInspector.FileSystemModel.FileSystem = function(fileSystemModel, origin, type)
+{
+    this.origin = origin;
+    this.type = type;
+}
+
+WebInspector.FileSystemModel.FileSystem.prototype = {
+    get name()
+    {
+        return "filesystem:" + this.origin + "/" + this.type;
+    }
+}

Added: trunk/Source/WebCore/inspector/front-end/Images/fileSystem.png (0 => 119815)


--- trunk/Source/WebCore/inspector/front-end/Images/fileSystem.png	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/Images/fileSystem.png	2012-06-08 09:50:26 UTC (rev 119815)
@@ -0,0 +1,11 @@
+\x89PNG
+
+
+IHDR  szz\xF4sRGB\xAE\xCE\xE9bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93	pHYs\x9A\x9CtIME\xDB
+#_JIDATX\xC3\xED\x97͏E\xC6\xD5\xDD3\xBBʚ]0\xAB11M"\x89\xB3уJDOz\xF1\x90\xE3\xC6\xC4\xF1F\xE2\xC1#1ƣr#z01De
+B0\xB8 k\xF0ذ7\xBB\xEC\xE7\xF4t\xD5\xFBz\xA8\xEE\x99\xE9\x9D\xEE\xDE\xD9x\xD4J&S鮪\xE7y?\xEAy߆\xFF\xFA0\xD9\xE4݃\xAF\xBF\xBC\xF6\xBA9Nt}\x80Ƽ\xFF\xE6\xA1#\x8A\xCC\xED\xDF\xF3\xFC`\xD5*P\xF5\x80⚌\x8F\xFF\xC83\xBBv\xAF\x8B\xC0\xF1\xA7\xB0V\x86\xC6\xB9e/$\xB5DĭF\.)\x97\xFE'\xA0\xD2x\xF5u=\x8BJ\xCC\xCCY\xDB\x92\x9B\xABj!\xB8j\xA9\xFB\xBAΌ\xBA6\xE5Ii\xB2=\xDD`E\xDEJ\xC9E\xAB7g\xB4ȌkU\xA7m@ժdt\xA5k\xA2\xAAD\xEB\xD5N\xB5Хk
+Q%N\1\x81o\xBE;\xB3\xEE{|\xFA̹\xA5Q\xA7\xD5{\xF6\xBE\xDC\xD3&UA\x9C\xE5\xC4\xC7xqϾ\x9E\xC1\x82\xB0\xC6'-O\xC2\xE5;7Q\x95\xB6[s\xEEͻ\xDA\xD9Uei\xF6z\x8F\x8Ag\xEBw!UI\xE8\xB3:Km-\xBC[\xF3\\xBDr\x95\xA9k7X\np|zT\x94\xC1MC<\xB2}\x84\x8D\x9B\x860\x81\xE9@P\x94\xB0*VR\x91Qɋ\x9A\xA0\xC2o\x97&qb\xD8\xF9ԓ\x88j\xB5&i,/p{\xFA\x97/^a\xD7sO\xB7\x8E0&\x9F\xC8\xD6J1\xE7\xA4e\xA9\xA8\xB46\xB5\xB9I3a\xFA\xE6\xDBv\x8C\xB0\xEB\xD9'h\xC6	\xFD\xFD}a\xC4\xF2\xFC\xA7N\x9E\xE3\xFAר\xF7\xD5\x91N\xB5'\xA8\xCD\xE2\x9A1\x8D\xA5\xA5\xBB\x81\xBC;Q\xBE\xFD\xFE,\x89-\x97\xD5\xE5\xD996l\xBC\x8F0\x80\xBF&~\xC2:\xC5\xBF>
+\x84\xBAYa\xF3\x96\xFB\x99\xF8\xF92Ω\xB7~uM@\x98\xD8QU=j\x8C\xD1\\xBET\x90\xD1\xDA\xE1\xBE\xE6\x95\xD7\xF6\xB1u\xC76l\xDC\xF0\xB1WMS\xC4	;E\xBD坂\xA6>Q<\xC7WǾ\xE6\xC2\xC4\xD4[\xC0\xF0Y.	\x97\xE7\xA6p\xB6\x91\xBA\xAE\x9B\x80\xB3\x96z\xBD\x86\xF6׉ĶĨ\xF5\x9A4\xE8ƇP\xD2|R\x81 @g\x9B\xF3D@\xF7-@q\xCEV^'\xE7\xE3,j\x9B)\xB0\xA4\x8A(q 	\xA8\xF3su\xED\xA4fii\xC6`\x8C\xCB$5j7
+\xED\x8BT\x94WMߋEQ\x8C
+Hh1.\x86\E0\x9A\x922\x81\xDF\xAD\xDA\xD0]ԂH\xCE텵V\x88Ťs\xE3D\x9AZm\xD2.\x81d%\xB30w+\xBA|y\xFAb\xE5-h\xD5&q\x97x\xB7'+\xA0\xDE\xED\xDE\xF2v\xD3BC\xD2\xF0\xE0%E+G`\xFF\xDE*\xAB\xDBG\xEF}\xE0\xDF;\xDBHݝ\xA0꼵\xAA\xDE+&wIG\xDCL5c\x8B\xB37p͕5
+\x91\xF7\xAE	vŃҡ\x9E\xAA`\xAEJ\xB7\xF4Ғ\xA1Ս\xB4\x92f\xB8˯\xCF\xC0\\xE2\x9Fu\x82\xA7sSI@\xC4_Ƃ$4&\xF0\xDB]\x82\xDA#\x82\x8AWͬ\xA0u⧂\xA4\xABַ\x86\xB4Ki`L@\xE3\xDAylp\xEF\xAAn\xA8׮Hq\xE2r\x9Dw4::\xDAe\x9Dc\xD47P\xF2A0\xF2\xE8C\xFCp\xFEO\xC6\xCF\xFF\x8E\xC1\x94Ö\x84]lBm\xD3\xC3<\xB6\xFB񁅅\x85\x81\xCC}\xC0\xF6\xF9\xA5\xE4\xF3OON\xEC6\x94\xF2\xB7	\x83\xF7<H\xBDV\xF7֛\x8A\xBC\x88\x80\xB3>\xB0\xF5\xF6\xC0\xF0泓\x93\x93\x9731p\xE9ܯ\xDE^\xEB\x90^\xDD2<<\xBCѭ\xA5\xD9e\x9Fsa\xC5q|sll\xEC\xFE\xC0?;!Ț\xAD\xFE\xC9\xE6IEND\xAEB`\x82
\ No newline at end of file

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (119814 => 119815)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-06-08 09:50:26 UTC (rev 119815)
@@ -67,6 +67,11 @@
     this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["application-cache-storage-tree-item"]);
     this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
 
+    if (Preferences.exposeFileSystemInspection && WebInspector.experimentsSettings.fileSystemInspection.isEnabled()) {
+        this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElement(this);
+        this.sidebarTree.appendChild(this.fileSystemListTreeElement);
+    }
+
     this.storageViews = this.splitView.mainElement;
     this.storageViews.addStyleClass("diff-container");
 
@@ -1479,6 +1484,77 @@
 
 /**
  * @constructor
+ * @extends {WebInspector.StorageCategoryTreeElement}
+ * @param {WebInspector.ResourcesPanel} storagePanel
+ */
+WebInspector.FileSystemListTreeElement = function(storagePanel)
+{
+    WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspector.UIString("FileSystem"), "FileSystem", ["file-system-storage-tree-item"]);
+}
+
+WebInspector.FileSystemListTreeElement.prototype = {
+    onexpand: function()
+    {
+        WebInspector.StorageCategoryTreeElement.prototype.onexpand.call(this);
+        this._refreshFileSystem();
+    },
+
+    onattach: function()
+    {
+        WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this);
+        this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+    },
+
+    _handleContextMenuEvent: function(event)
+    {
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString("Refresh FileSystem List"), this._refreshFileSystem.bind(this));
+        contextMenu.show(event);
+    },
+
+    _fileSystemAdded: function(event)
+    {
+        var fileSystem = /** @type {WebInspector.FileSystemModel.FileSystem} */ event.data;
+        var fileSystemTreeElement = new WebInspector.FileSystemTreeElement(this._storagePanel, fileSystem);
+        this.appendChild(fileSystemTreeElement);
+    },
+
+    _fileSystemRemoved: function(event)
+    {
+        var fileSystem = /** @type {WebInspector.FileSystemModel.FileSystem} */ event.data;
+        var fileSystemTreeElement = this._fileSystemTreeElementByName(fileSystem.name);
+        if (!fileSystemTreeElement)
+            return;
+        fileSystemTreeElement.clear();
+        this.removeChild(fileSystemTreeElement);
+    },
+
+    _fileSystemTreeElementByName: function(fileSystemName)
+    {
+        for (var i = 0; i < this.children.length; ++i) {
+            var child = /** @type {WebInspector.FileSystemTreeElement} */ this.children[i];
+            if (child.fileSystemName === fileSystemName)
+                return this.children[i];
+        }
+        return null;
+    },
+
+    _refreshFileSystem: function()
+    {
+        if (!this._fileSystemModel) {
+            this._fileSystemModel = new WebInspector.FileSystemModel();
+            this._fileSystemModel.addEventListener(WebInspector.FileSystemModel.EventTypes.FileSystemAdded, this._fileSystemAdded, this);
+            this._fileSystemModel.addEventListener(WebInspector.FileSystemModel.EventTypes.FileSystemRemoved, this._fileSystemRemoved, this);
+        }
+
+        this._fileSystemModel.refreshFileSystemList();
+    }
+}
+
+WebInspector.FileSystemListTreeElement.prototype.__proto__ = WebInspector.StorageCategoryTreeElement.prototype;
+
+/**
+ * @constructor
  * @extends {WebInspector.BaseStorageTreeElement}
  * @param {WebInspector.ResourcesPanel} storagePanel
  * @param {WebInspector.IndexedDBModel} model
@@ -1880,6 +1956,33 @@
 
 /**
  * @constructor
+ * @extends {WebInspector.BaseStorageTreeElement}
+ * @param {WebInspector.ResourcesPanel} storagePanel
+ * @param {WebInspector.FileSystemModel.FileSystem} fileSystem
+ */
+WebInspector.FileSystemTreeElement = function(storagePanel, fileSystem)
+{
+    var displayName = fileSystem.type + " - " + fileSystem.origin;
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, displayName, ["file-system-storage-tree-item"]);
+    this._fileSystem = fileSystem;
+}
+
+WebInspector.FileSystemTreeElement.prototype = {
+    get fileSystemName()
+    {
+        return this._fileSystem.name;
+    },
+
+    get itemURL()
+    {
+        return "filesystem://" + this._fileSystem.name;
+    }
+}
+
+WebInspector.FileSystemTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+/**
+ * @constructor
  * @extends {WebInspector.View}
  */
 WebInspector.StorageCategoryView = function()

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (119814 => 119815)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-06-08 09:50:26 UTC (rev 119815)
@@ -44,7 +44,8 @@
     exposeWorkersInspection: false,
     applicationTitle: "Web Inspector - %s",
     showHeapSnapshotObjectsHiddenProperties: false,
-    showDockToRight: false
+    showDockToRight: false,
+    exposeFileSystemInspection: false
 }
 
 var Capabilities = {
@@ -183,6 +184,7 @@
     this.showShadowDOM = this._createExperiment("showShadowDOM", "Show shadow DOM");
     this.snippetsSupport = this._createExperiment("snippetsSupport", "Snippets support");
     this.nativeMemorySnapshots = this._createExperiment("nativeMemorySnapshots", "Native memory profiling");
+    this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection");
 
     this._cleanUpSetting();
 }

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (119814 => 119815)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-06-08 09:50:26 UTC (rev 119815)
@@ -58,6 +58,7 @@
     <file>ExtensionRegistryStub.js</file>
     <file>ExtensionServer.js</file>
     <file>FileManager.js</file>
+    <file>FileSystemModel.js</file>
     <file>FilteredItemSelectionDialog.js</file>
     <file>FontView.js</file>
     <file>GoToLineDialog.js</file>
@@ -243,6 +244,7 @@
     <file>Images/errorIcon.png</file>
     <file>Images/errorMediumIcon.png</file>
     <file>Images/errorRedDot.png</file>
+    <file>Images/fileSystem.png</file>
     <file>Images/forward.png</file>
     <file>Images/frame.png</file>
     <file>Images/glossyHeader.png</file>

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (119814 => 119815)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-06-08 09:50:26 UTC (rev 119815)
@@ -160,6 +160,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""

Modified: trunk/Source/WebCore/inspector/front-end/resourcesPanel.css (119814 => 119815)


--- trunk/Source/WebCore/inspector/front-end/resourcesPanel.css	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/front-end/resourcesPanel.css	2012-06-08 09:50:26 UTC (rev 119815)
@@ -326,7 +326,6 @@
     content: url(Images/applicationCache.png);
 }
 
-/* FIXME: Make separate png for file-system */
 .file-system-storage-tree-item .icon {
-    content: url(Images/applicationCache.png);
+    content: url(Images/fileSystem.png);
 }

Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (119814 => 119815)


--- trunk/Source/WebCore/inspector/front-end/utilities.js	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js	2012-06-08 09:50:26 UTC (rev 119815)
@@ -675,4 +675,14 @@
     {
         this._map = {};
     }
-}
+};
+
+Object.defineProperty(Object.prototype, "isEmpty",
+{
+    value: function()
+    {
+        for (var i in this)
+            return false;
+        return true;
+    }
+});

Modified: trunk/Source/WebKit/chromium/ChangeLog (119814 => 119815)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-08 09:50:26 UTC (rev 119815)
@@ -1,3 +1,12 @@
+2012-06-08  Taiju Tsuiki  <[email protected]>
+
+        Add FileSystem item to storage tree.
+        https://bugs.webkit.org/show_bug.cgi?id=72691
+
+        Reviewed by Vsevolod Vlasov.
+
+        * src/js/DevTools.js:
+
 2012-06-08  Peter Beverloo  <[email protected]>
 
         [Chromium] Re-enable SHARED_WORKERS for Android until a build fix has been resolved.

Modified: trunk/Source/WebKit/chromium/src/js/DevTools.js (119814 => 119815)


--- trunk/Source/WebKit/chromium/src/js/DevTools.js	2012-06-08 09:19:39 UTC (rev 119814)
+++ trunk/Source/WebKit/chromium/src/js/DevTools.js	2012-06-08 09:50:26 UTC (rev 119815)
@@ -41,6 +41,7 @@
     Preferences.exposeDisableCache = true;
     Preferences.exposeWorkersInspection = true;
     Preferences.showDockToRight = true;
+    Preferences.exposeFileSystemInspection = true;
 })();}
 
 function buildPlatformExtensionAPI(extensionInfo)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to