Web Inspector: Support inspector file system access with isolated file system through...
authorvsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 09:06:01 +0000 (09:06 +0000)
committervsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 09:06:01 +0000 (09:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105727

Reviewed by Pavel Feldman.

Source/WebCore:

File system access through isolated file system is implemented in inspector.
File system access requests are sent through InspectorFrontendHost.
Introduced IsolatedFileSystemModel encapsulating file system access logic.
Introduced FileSystemMapping that provides mapping between workspace uris and file system pathes.
DOMFileSystem.createIsolatedFileSystem modified to accept optional registeredName parameter.

* Modules/filesystem/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::createIsolatedFileSystem):
* Modules/filesystem/DOMFileSystem.h:
(DOMFileSystem):
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/InspectorFrontendClient.h:
(InspectorFrontendClient):
* inspector/InspectorFrontendClientLocal.h:
(WebCore::InspectorFrontendClientLocal::supportsFileSystems):
(WebCore::InspectorFrontendClientLocal::requestFileSystems):
(WebCore::InspectorFrontendClientLocal::addFileSystem):
(WebCore::InspectorFrontendClientLocal::removeFileSystem):
(InspectorFrontendClientLocal):
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::supportsFileSystems):
(WebCore):
(WebCore::InspectorFrontendHost::requestFileSystems):
(WebCore::InspectorFrontendHost::addFileSystem):
(WebCore::InspectorFrontendHost::removeFileSystem):
(WebCore::InspectorFrontendHost::isolatedFileSystem):
* inspector/InspectorFrontendHost.h:
(WebCore):
(InspectorFrontendHost):
* inspector/InspectorFrontendHost.idl:
* inspector/compile-front-end.py:
* inspector/front-end/FileSystemMapping.js: Added.
* inspector/front-end/InspectorFrontendAPI.js:
(InspectorFrontendAPI.fileSystemsLoaded):
(InspectorFrontendAPI.fileSystemRemoved):
(InspectorFrontendAPI.fileSystemAdded):
* inspector/front-end/InspectorFrontendHostStub.js:
(.WebInspector.InspectorFrontendHostStub.prototype.supportsFileSystems):
(.WebInspector.InspectorFrontendHostStub.prototype.requestFileSystems):
(.WebInspector.InspectorFrontendHostStub.prototype.addFileSystem):
(.WebInspector.InspectorFrontendHostStub.prototype.removeFileSystem):
(.WebInspector.InspectorFrontendHostStub.prototype.isolatedFileSystem):
* inspector/front-end/IsolatedFileSystemModel.js: Added.
* inspector/front-end/WebKit.qrc:
* inspector/front-end/externs.js:
(DOMFileSystem):
(InspectorFrontendHostAPI.prototype.supportsFileSystems):
(InspectorFrontendHostAPI.prototype.requestFileSystems):
(InspectorFrontendHostAPI.prototype.addFileSystem):
(InspectorFrontendHostAPI.prototype.removeFileSystem):
(InspectorFrontendHostAPI.prototype.isolatedFileSystem):
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:

Source/WebKit/chromium:

File system access methods plumbing made for Chromium.

* public/WebDevToolsFrontendClient.h:
(WebKit::WebDevToolsFrontendClient::requestFileSystems):
(WebKit::WebDevToolsFrontendClient::addFileSystem):
(WebKit::WebDevToolsFrontendClient::removeFileSystem):
(WebDevToolsFrontendClient):
* src/InspectorFrontendClientImpl.cpp:
(WebKit::InspectorFrontendClientImpl::supportsFileSystems):
(WebKit):
(WebKit::InspectorFrontendClientImpl::requestFileSystems):
(WebKit::InspectorFrontendClientImpl::addFileSystem):
(WebKit::InspectorFrontendClientImpl::removeFileSystem):
* src/InspectorFrontendClientImpl.h:
(InspectorFrontendClientImpl):

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

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/inspector/InspectorFrontendClient.h
Source/WebCore/inspector/InspectorFrontendClientLocal.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/inspector/compile-front-end.py
Source/WebCore/inspector/front-end/FileSystemMapping.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/FileSystemWorkspaceProvider.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
Source/WebCore/inspector/front-end/IsolatedFileSystemModel.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/WebKit.qrc
Source/WebCore/inspector/front-end/externs.js
Source/WebCore/inspector/front-end/inspector.html
Source/WebCore/inspector/front-end/inspector.js
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebDevToolsFrontendClient.h
Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
Source/WebKit/chromium/src/InspectorFrontendClientImpl.h

index fb6d850..c808618 100644 (file)
@@ -1,3 +1,65 @@
+2012-12-28  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: Support inspector file system access with isolated file system through InspectorFrontendHost.
+        https://bugs.webkit.org/show_bug.cgi?id=105727
+
+        Reviewed by Pavel Feldman.
+
+        File system access through isolated file system is implemented in inspector.
+        File system access requests are sent through InspectorFrontendHost.
+        Introduced IsolatedFileSystemModel encapsulating file system access logic. 
+        Introduced FileSystemMapping that provides mapping between workspace uris and file system pathes.
+        DOMFileSystem.createIsolatedFileSystem modified to accept optional registeredName parameter.
+
+        * Modules/filesystem/DOMFileSystem.cpp:
+        (WebCore::DOMFileSystem::createIsolatedFileSystem):
+        * Modules/filesystem/DOMFileSystem.h:
+        (DOMFileSystem):
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/InspectorFrontendClient.h:
+        (InspectorFrontendClient):
+        * inspector/InspectorFrontendClientLocal.h:
+        (WebCore::InspectorFrontendClientLocal::supportsFileSystems):
+        (WebCore::InspectorFrontendClientLocal::requestFileSystems):
+        (WebCore::InspectorFrontendClientLocal::addFileSystem):
+        (WebCore::InspectorFrontendClientLocal::removeFileSystem):
+        (InspectorFrontendClientLocal):
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::supportsFileSystems):
+        (WebCore):
+        (WebCore::InspectorFrontendHost::requestFileSystems):
+        (WebCore::InspectorFrontendHost::addFileSystem):
+        (WebCore::InspectorFrontendHost::removeFileSystem):
+        (WebCore::InspectorFrontendHost::isolatedFileSystem):
+        * inspector/InspectorFrontendHost.h:
+        (WebCore):
+        (InspectorFrontendHost):
+        * inspector/InspectorFrontendHost.idl:
+        * inspector/compile-front-end.py:
+        * inspector/front-end/FileSystemMapping.js: Added.
+        * inspector/front-end/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.fileSystemsLoaded):
+        (InspectorFrontendAPI.fileSystemRemoved):
+        (InspectorFrontendAPI.fileSystemAdded):
+        * inspector/front-end/InspectorFrontendHostStub.js:
+        (.WebInspector.InspectorFrontendHostStub.prototype.supportsFileSystems):
+        (.WebInspector.InspectorFrontendHostStub.prototype.requestFileSystems):
+        (.WebInspector.InspectorFrontendHostStub.prototype.addFileSystem):
+        (.WebInspector.InspectorFrontendHostStub.prototype.removeFileSystem):
+        (.WebInspector.InspectorFrontendHostStub.prototype.isolatedFileSystem):
+        * inspector/front-end/IsolatedFileSystemModel.js: Added.
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/externs.js:
+        (DOMFileSystem):
+        (InspectorFrontendHostAPI.prototype.supportsFileSystems):
+        (InspectorFrontendHostAPI.prototype.requestFileSystems):
+        (InspectorFrontendHostAPI.prototype.addFileSystem):
+        (InspectorFrontendHostAPI.prototype.removeFileSystem):
+        (InspectorFrontendHostAPI.prototype.isolatedFileSystem):
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/inspector.js:
+
 2013-01-15  Kondapally Kalyan  <kalyan.kondapally@intel.com>
 
         [EFL][WebGL] Add error handling to carefully manage Window backing pixmaps.
index 9f4cfa7..69075b2 100644 (file)
             'inspector/front-end/ExtensionServer.js',
             'inspector/front-end/ExtensionView.js',
             'inspector/front-end/FileManager.js',
+            'inspector/front-end/FileSystemMapping.js',
             'inspector/front-end/FileSystemModel.js',
             'inspector/front-end/FileUtils.js',
             'inspector/front-end/FontView.js',
             'inspector/front-end/InspectorFrontendHostStub.js',
             'inspector/front-end/InspectorView.js',
             'inspector/front-end/inspector.js',
+            'inspector/front-end/IsolatedFileSystemModel.js',
             'inspector/front-end/JavaScriptFormatter.js',
             'inspector/front-end/jsdifflib.js',
             'inspector/front-end/KeyboardShortcut.js',
index a0169ae..9d503f2 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\inspector\front-end\FileSystemMapping.js"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\inspector\front-end\FileSystemModel.js"
                                        >
                                </File>
                                        >
                                </File>
                                <File
+                                       RelativePath="..\inspector\front-end\IsolatedFileSystemModel.js"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\inspector\front-end\cm\javascript.js"
                                        >
                                </File>
index f7fd85c..be3bf06 100644 (file)
@@ -71,6 +71,11 @@ public:
     virtual void inspectedURLChanged(const String&) = 0;
 
     virtual void sendMessageToBackend(const String&) = 0;
+
+    virtual bool supportsFileSystems() = 0;
+    virtual void requestFileSystems() = 0;
+    virtual void addFileSystem() = 0;
+    virtual void removeFileSystem(const String& fileSystemPath) = 0;
 };
 
 } // namespace WebCore
index 7f9f023..0d6cfc9 100644 (file)
@@ -76,6 +76,11 @@ public:
 
     virtual void sendMessageToBackend(const String& message);
 
+    virtual bool supportsFileSystems() { return false; }
+    virtual void requestFileSystems() { }
+    virtual void addFileSystem() { }
+    virtual void removeFileSystem(const String&) { }
+
     bool canAttachWindow();
     void setDockingUnavailable(bool);
 
index 19b712d..03fd645 100644 (file)
@@ -37,6 +37,7 @@
 #include "ContextMenuItem.h"
 #include "ContextMenuController.h"
 #include "ContextMenuProvider.h"
+#include "DOMFileSystem.h"
 #include "Element.h"
 #include "Frame.h"
 #include "FrameLoader.h"
@@ -294,6 +295,39 @@ String InspectorFrontendHost::loadResourceSynchronously(const String& url)
     return String(data.data(), data.size());
 }
 
+bool InspectorFrontendHost::supportsFileSystems()
+{
+    if (m_client)
+        return m_client->supportsFileSystems();
+    return false;
+}
+
+void InspectorFrontendHost::requestFileSystems()
+{
+    if (m_client)
+        m_client->requestFileSystems();
+}
+
+void InspectorFrontendHost::addFileSystem()
+{
+    if (m_client)
+        m_client->addFileSystem();
+}
+
+void InspectorFrontendHost::removeFileSystem(const String& fileSystemPath)
+{
+    if (m_client)
+        m_client->removeFileSystem(fileSystemPath);
+}
+
+#if ENABLE(FILE_SYSTEM)
+PassRefPtr<DOMFileSystem> InspectorFrontendHost::isolatedFileSystem(const String& fileSystemName, const String& rootURL)
+{
+    ScriptExecutionContext* context = m_frontendPage->mainFrame()->document();
+    return DOMFileSystem::create(context, fileSystemName, FileSystemTypeIsolated, KURL(ParsedURLString, rootURL), AsyncFileSystem::create());
+}
+#endif
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index ea6d101..c8b8d35 100644 (file)
@@ -39,6 +39,7 @@
 namespace WebCore {
 
 class ContextMenuItem;
+class DOMFileSystem;
 class Event;
 class FrontendMenuProvider;
 class InspectorClient;
@@ -85,6 +86,14 @@ public:
 
     String loadResourceSynchronously(const String& url);
 
+    bool supportsFileSystems();
+    void requestFileSystems();
+    void addFileSystem();
+    void removeFileSystem(const String& fileSystemPath);
+#if ENABLE(FILE_SYSTEM)
+    PassRefPtr<DOMFileSystem> isolatedFileSystem(const String& fileSystemName, const String& rootURL);
+#endif
+
 private:
 #if ENABLE(CONTEXT_MENUS)
     friend class FrontendMenuProvider;
index 728aa0c..ef50859 100644 (file)
     [Custom] void recordSettingChanged(in unsigned long settingChanged);
     
     DOMString loadResourceSynchronously(in DOMString url);
+
+    boolean supportsFileSystems();
+    void requestFileSystems();
+    void addFileSystem();
+    void removeFileSystem(in DOMString fileSystemPath);
+    [Conditional=FILE_SYSTEM] DOMFileSystem isolatedFileSystem(in DOMString fileSystemId, in DOMString registeredName);
 };
index 074d34a..3a4ad97 100755 (executable)
@@ -76,11 +76,13 @@ modules = [
             "DebuggerModel.js",
             "DebuggerScriptMapping.js",
             "FileManager.js",
+            "FileSystemMapping.js",
             "FileSystemModel.js",
             "FileUtils.js",
             "HAREntry.js",
             "IndexedDBModel.js",
             "InspectorBackend.js",
+            "IsolatedFileSystemModel.js",
             "Linkifier.js",
             "NetworkLog.js",
             "NetworkUISourceCodeProvider.js",
diff --git a/Source/WebCore/inspector/front-end/FileSystemMapping.js b/Source/WebCore/inspector/front-end/FileSystemMapping.js
new file mode 100644 (file)
index 0000000..f8efbf9
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ */
+
+/**
+ * @interface
+ */
+WebInspector.FileSystemMapping = function() { }
+
+/**
+ * @constructor
+ */
+WebInspector.FileSystemMapping.FileDescriptor = function(fileSystemPath, filePath)
+{
+    this.fileSystemPath = fileSystemPath;
+    this.filePath = filePath;
+}
+
+WebInspector.FileSystemMapping.prototype = {
+    /**
+     * @return {Array.<string>}
+     */
+    fileSystemPaths: function() { },
+
+    /**
+     * @param {string} uri
+     * @return {?WebInspector.FileSystemMapping.FileDescriptor}
+     */
+    fileForURI: function(uri) { },
+
+    /**
+     * @param {WebInspector.FileSystemMapping.FileDescriptor} fileDescriptor
+     * @return {string}
+     */
+    uriForFile: function(fileDescriptor) { },
+
+    /**
+     * @param {string} path
+     * @return {?string}
+     */
+    uriForPath: function(path) { }
+}
+
+/**
+ * @constructor
+ * @implements {WebInspector.FileSystemMapping}
+ * @extends {WebInspector.Object}
+ */
+WebInspector.FileSystemMappingImpl = function()
+{
+    this._fileSystemMappingSetting = WebInspector.settings.createSetting("fileSystemMapping", {});
+    /** @type {!Object.<string, string>} */
+    this._mappedNames = this._fileSystemMappingSetting.get();
+}
+
+WebInspector.FileSystemMappingImpl.prototype = {
+    /**
+     * @param {string} fileSystemPath
+     */
+    addFileSystemMapping: function(fileSystemPath)
+    {
+        if (this._mappedNames[fileSystemPath])
+            return;
+        var pathSegments = fileSystemPath.split("/");
+        var mappedName = pathSegments[pathSegments.length - 1];
+        var uniqueMappedName = this._uniqueMappedName(mappedName);
+        this._mappedNames[fileSystemPath] = mappedName;
+        this._fileSystemMappingSetting.set(this._mappedNames);
+    },
+
+    /**
+     * @param {string} mappedName
+     */
+    _uniqueMappedName: function(mappedName)
+    {
+        var uniqueMappedName = mappedName;
+        var i = 1;
+        while (Object.values(this._mappedNames).indexOf(uniqueMappedName) !== -1) {
+            uniqueMappedName = mappedName + " (" + i + ")";
+            ++i;
+        }
+        return uniqueMappedName;
+    },
+
+    /**
+     * @param {string} fileSystemPath
+     */
+    removeFileSystemMapping: function(fileSystemPath)
+    {
+        delete this._mappedNames[fileSystemPath];
+        this._fileSystemMappingSetting.set(this._mappedNames);
+    },
+
+    /**
+     * @return {Array.<string>}
+     */
+    fileSystemPaths: function()
+    {
+        return Object.keys(this._mappedNames);
+    },
+
+    /**
+     * @return {string}
+     */
+    _uriPrefixForMappedName: function(mappedName)
+    {
+        return "file:///" + mappedName + "/";
+    },
+
+    /**
+     * @param {string} uri
+     * @return {?WebInspector.FileSystemMapping.FileDescriptor}
+     */
+    fileForURI: function(uri)
+    {
+        for (var fileSystemPath in this._mappedNames) {
+            var uriPrefix = this._uriPrefixForMappedName(this._mappedNames[fileSystemPath]);
+            if (uri.indexOf(uriPrefix) === 0)
+                return new WebInspector.FileSystemMapping.FileDescriptor(fileSystemPath, "/" + uri.substring(uriPrefix.length));
+        }
+        return null;
+    },
+
+    /**
+     * @param {WebInspector.FileSystemMapping.FileDescriptor} fileDescriptor
+     * @return {string}
+     */
+    uriForFile: function(fileDescriptor)
+    {
+        var uriPrefix = this._uriPrefixForMappedName(this._mappedNames[fileDescriptor.fileSystemPath]);
+        return uriPrefix + fileDescriptor.filePath.substring("/".length);
+    },
+    
+    /**
+     * @param {string} path
+     * @return {?string}
+     */
+    uriForPath: function(path)
+    {
+        for (var fileSystemPath in this._mappedNames) {
+            if (path.indexOf(fileSystemPath) === 0) {
+                var uriPrefix = this._uriPrefixForMappedName(this._mappedNames[fileSystemPath]);
+                var subPath = path.substring(fileSystemPath.length);
+                if (subPath.length === 0)
+                    return uriPrefix;
+                else if (subPath[0] === "/")
+                    return uriPrefix + subPath.substring("/".length);
+            }
+        }
+        return null;
+    }
+}
diff --git a/Source/WebCore/inspector/front-end/FileSystemWorkspaceProvider.js b/Source/WebCore/inspector/front-end/FileSystemWorkspaceProvider.js
new file mode 100644 (file)
index 0000000..df608da
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+ * 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
+ * @implements {WebInspector.WorkspaceProvider}
+ * @extends {WebInspector.Object}
+ * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel
+ */
+WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemModel)
+{
+    this._isolatedFileSystemModel = isolatedFileSystemModel;
+    //this._populate();
+}
+
+WebInspector.FileSystemWorkspaceProvider.prototype = {
+    /**
+     * @param {string} uri
+     * @param {function(?string,boolean,string)} callback
+     */
+    requestFileContent: function(uri, callback)
+    {
+        var fileDescriptor = this._isolatedFileSystemModel.mapping().fileForURI(uri);
+        if (!fileDescriptor) {
+            console.error("No matching file for uri: " + uri);
+            callback(null, false, WebInspector.resourceTypes.Other.canonicalMimeType());
+            return;
+        }
+        WebInspector.FileSystemUtils.requestFileContent(this._isolatedFileSystemModel, fileDescriptor.fileSystemPath, fileDescriptor.filePath, innerCallback.bind(this));
+        
+        function innerCallback(content)
+        {
+            var contentType = this._contentTypeForPath(fileDescriptor.filePath);
+            callback(content, false, contentType.canonicalMimeType());
+        }
+    },
+
+    /**
+     * @param {string} uri
+     * @param {string} newContent
+     * @param {function(?string)} callback
+     */
+    setFileContent: function(uri, newContent, callback)
+    {
+        var fileDescriptor = this._isolatedFileSystemModel.mapping().fileForURI(uri);
+        if (!fileDescriptor) {
+            console.error("No matching file for uri: " + uri);
+            callback("");
+            return;
+        }
+        WebInspector.FileSystemUtils.setFileContent(this._isolatedFileSystemModel, fileDescriptor.fileSystemPath, fileDescriptor.filePath, newContent, callback.bind(this, ""));
+    },
+
+    /**
+     * @param {string} uri
+     * @param {string} query
+     * @param {boolean} caseSensitive
+     * @param {boolean} isRegex
+     * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback
+     */
+    searchInFileContent: function(uri, query, caseSensitive, isRegex, callback)
+    {
+        callback([]);
+    },
+
+    /**
+     * @param {string} path
+     * @return {WebInspector.ResourceType}
+     */
+    _contentTypeForPath: function(path)
+    {
+        var splittedPath = path.split("/");
+        var fileName = splittedPath[splittedPath.length - 1];
+        var extensionIndex = fileName.lastIndexOf(".");
+        var extension = "";
+        if (extensionIndex !== -1)
+            extension = fileName.substring(extensionIndex + 1);
+        var contentType = WebInspector.resourceTypes.Other;
+        if (extension === "js")
+            return WebInspector.resourceTypes.Script;
+        if (extension === "css")
+            return WebInspector.resourceTypes.Stylesheet;
+        if (extension === "html")
+            return WebInspector.resourceTypes.Document;
+        return WebInspector.resourceTypes.Other;
+    },
+
+    _populate: function()
+    {
+        var fileSystemPaths = this._isolatedFileSystemModel.mapping().fileSystemPaths();
+        for (var i = 0; i < fileSystemPaths.length; ++i) {
+            var fileSystemPath = fileSystemPaths[i];
+            WebInspector.FileSystemUtils.requestFilesRecursive(this._isolatedFileSystemModel, fileSystemPath, "", callback.bind(this, fileSystemPath));
+        }
+
+        function callback(fileSystemPath, files)
+        {
+            for (var i = 0; i < files.length; ++i) {
+                var uri = this._isolatedFileSystemModel.mapping().uriForFile(new WebInspector.FileSystemMapping.FileDescriptor(fileSystemPath, files[i]));
+                var contentType = this._contentTypeForPath(files[i]);
+                var fileDescriptor = new WebInspector.FileDescriptor(uri, "file://" + fileSystemPath + files[i], contentType, true);
+                this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.FileAdded, fileDescriptor);
+            } 
+        }
+    },
+
+    reset: function()
+    {
+        this.dispatchEventToListeners(WebInspector.WorkspaceProvider.Events.Reset, null);
+        this._populate();
+    },
+    
+    __proto__: WebInspector.Object.prototype
+}
+
+/**
+ * @type {?WebInspector.FileSystemWorkspaceProvider}
+ */
+WebInspector.fileSystemWorkspaceProvider = null;
+
+/**
+ * @constructor
+ */
+WebInspector.FileSystemUtils = function()
+{
+}
+
+WebInspector.FileSystemUtils.errorHandler = function(error) {
+    var msg;
+    switch (error.code) {
+    case FileError.QUOTA_EXCEEDED_ERR:
+        msg = "QUOTA_EXCEEDED_ERR";
+        break;
+    case FileError.NOT_FOUND_ERR:
+        msg = "NOT_FOUND_ERR";
+        break;
+    case FileError.SECURITY_ERR:
+        msg = "SECURITY_ERR";
+        break;
+    case FileError.INVALID_MODIFICATION_ERR:
+        msg = "INVALID_MODIFICATION_ERR";
+        break;
+    case FileError.INVALID_STATE_ERR:
+        msg = "INVALID_STATE_ERR";
+        break;
+    default:
+        msg = "Unknown Error";
+        break;
+    };
+
+    console.error("File system error: " + msg);
+}
+
+/**
+ * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel
+ * @param {string} fileSystemPath
+ * @param {function(DOMFileSystem)} callback
+ */
+WebInspector.FileSystemUtils.requestFileSystem = function(isolatedFileSystemModel, fileSystemPath, callback)
+{
+    isolatedFileSystemModel.requestDOMFileSystem(fileSystemPath, callback);
+}
+
+/**
+ * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel
+ * @param {string} fileSystemPath
+ * @param {string} path
+ * @param {function(Array.<string>)} callback
+ */
+WebInspector.FileSystemUtils.requestFilesRecursive = function(isolatedFileSystemModel, fileSystemPath, path, callback)
+{
+    WebInspector.FileSystemUtils.requestFileSystem(isolatedFileSystemModel, fileSystemPath, fileSystemLoaded);
+
+    var fileSystem;
+    /**
+     * @param {DOMFileSystem} fs
+     */
+    function fileSystemLoaded(fs)
+    {
+        fileSystem = fs;
+        WebInspector.FileSystemUtils._requestEntries(fileSystem, path, innerCallback);
+    }
+
+    var result = [];
+    var callbacksLeft = 1;
+    /**
+     * @param {Array.<FileEntry>} entries
+     */
+    function innerCallback(entries)
+    {
+        for (var i = 0; i < entries.length; ++i) {
+            var entry = entries[i];
+            if (!entry.isDirectory)
+                result.push(entry.fullPath);
+            else {
+                callbacksLeft++;
+                WebInspector.FileSystemUtils._requestEntries(fileSystem, entry.fullPath, innerCallback);
+            }
+        }
+        if (!--callbacksLeft)
+            callback(result);
+    }
+}
+
+/**
+ * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel
+ * @param {string} fileSystemPath
+ * @param {string} path
+ * @param {function(string)} callback
+ */
+WebInspector.FileSystemUtils.requestFileContent = function(isolatedFileSystemModel, fileSystemPath, path, callback)
+{
+    WebInspector.FileSystemUtils.requestFileSystem(isolatedFileSystemModel, fileSystemPath, fileSystemLoaded);
+
+    var fileSystem;
+    /**
+     * @param {DOMFileSystem} fs
+     */
+    function fileSystemLoaded(fs)
+    {
+        fs.root.getFile(path, null, fileEntryLoaded, WebInspector.FileSystemUtils.errorHandler);
+    }
+
+    /**
+     * @param {FileEntry} entry
+     */
+    function fileEntryLoaded(entry)
+    {
+        entry.file(fileLoaded, WebInspector.FileSystemUtils.errorHandler);
+    }
+
+    /**
+     * @param {!Blob} file
+     */
+    function fileLoaded(file)
+    {
+        var reader = new FileReader();
+        reader.onloadend = readerLoadEnd;
+        reader.readAsText(file);
+    }
+
+    /**
+     * @this {FileReader}
+     */
+    function readerLoadEnd()
+    {
+        callback(/** @type {string} */ (this.result));
+    }
+}
+
+/**
+ * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel
+ * @param {string} fileSystemPath
+ * @param {string} path
+ * @param {string} content
+ * @param {function()} callback
+ */
+WebInspector.FileSystemUtils.setFileContent = function(isolatedFileSystemModel, fileSystemPath, path, content, callback)
+{
+    WebInspector.FileSystemUtils.requestFileSystem(isolatedFileSystemModel, fileSystemPath, fileSystemLoaded);
+
+    var fileSystem;
+    /**
+     * @param {DOMFileSystem} fs
+     */
+    function fileSystemLoaded(fs)
+    {
+        fs.root.getFile(path, null, fileEntryLoaded, WebInspector.FileSystemUtils.errorHandler);
+    }
+
+    /**
+     * @param {FileEntry} entry
+     */
+    function fileEntryLoaded(entry)
+    {
+        entry.createWriter(fileWriterCreated, WebInspector.FileSystemUtils.errorHandler);
+    }
+
+    /**
+     * @param {FileWriter} fileWriter
+     */
+    function fileWriterCreated(fileWriter)
+    {
+        fileWriter.onwriteend = writerEnd;
+        fileWriter.onerror = WebInspector.FileSystemUtils.errorHandler;
+        var blob = new Blob([content], { type: "text/plain" });
+        fileWriter.write(blob);
+    }
+
+    function writerEnd()
+    {
+        callback();
+    }
+}
+
+/**
+ * @param {DirectoryEntry} root
+ * @param {Array.<string>} folders
+ * @param {Object} flags
+ * @param {function(DirectoryEntry)} callback
+ */
+WebInspector.FileSystemUtils._getDirectory = function(root, folders, flags, callback)
+{
+    while (folders[0] == "." || folders[0] == "")
+        folders = folders.slice(1);
+    if (!folders.length)
+        callback(root);
+    else
+        root.getDirectory(folders[0], flags, innerCallback, WebInspector.FileSystemUtils.errorHandler);
+
+    /**
+     * @param {DirectoryEntry} dirEntry
+     */
+    function innerCallback(dirEntry)
+    {
+        WebInspector.FileSystemUtils._getDirectory(dirEntry, folders.slice(1), flags, callback);
+    }
+}
+
+/**
+ * @param {DirectoryEntry} dirEntry
+ * @param {function(Array.<FileEntry>)} callback
+ */
+WebInspector.FileSystemUtils._readDirectory = function(dirEntry, callback)
+{
+    var dirReader = dirEntry.createReader();
+    var entries = [];
+
+    function innerCallback(results)
+    {
+        if (!results.length)
+            callback(entries.sort());
+        else {
+            entries = entries.concat(toArray(results));
+            dirReader.readEntries(innerCallback, WebInspector.FileSystemUtils.errorHandler);
+        }
+    }
+
+    function toArray(list) {
+        return Array.prototype.slice.call(list || [], 0);
+    }    
+
+    dirReader.readEntries(innerCallback, WebInspector.FileSystemUtils.errorHandler);
+}
+
+/**
+ * @param {DOMFileSystem} fileSystem
+ * @param {string} path
+ * @param {function(Array.<FileEntry>)} callback
+ */
+WebInspector.FileSystemUtils._requestEntries = function(fileSystem, path, callback)
+{
+    var folders = path.split("/");
+    WebInspector.FileSystemUtils._getDirectory(fileSystem.root, folders, null, innerCallback);
+
+    function innerCallback(dirEntry)
+    {
+        WebInspector.FileSystemUtils._readDirectory(dirEntry, callback)
+    }
+}
+
+WebInspector.FileSystemUtils.prototype = {
+}
index 900a17b..884f2dc 100644 (file)
@@ -110,6 +110,21 @@ var InspectorFrontendAPI = {
         WebInspector.toggleSearchingForNode();
     },
 
+    fileSystemsLoaded: function(fileSystems)
+    {
+        WebInspector.isolatedFileSystemDispatcher.fileSystemsLoaded(fileSystems);
+    },
+
+    fileSystemRemoved: function(fileSystemPath)
+    {
+        WebInspector.isolatedFileSystemDispatcher.fileSystemRemoved(fileSystemPath);
+    },
+
+    fileSystemAdded: function(errorMessage, fileSystem)
+    {
+        WebInspector.isolatedFileSystemDispatcher.fileSystemAdded(errorMessage, fileSystem);
+    },
+
     savedURL: function(url)
     {
         WebInspector.fileManager.savedURL(url);
index c616c1d..13e1851 100644 (file)
@@ -195,6 +195,28 @@ WebInspector.InspectorFrontendHostStub.prototype = {
         return loadXHR(url);
     },
 
+    supportsFileSystems: function()
+    {
+        return false;
+    },
+
+    requestFileSystems: function()
+    {
+    },
+
+    addFileSystem: function()
+    {
+    },
+
+    removeFileSystem: function(fileSystemPath)
+    {
+    },
+
+    isolatedFileSystem: function(fileSystemId, registeredName)
+    {
+        return null;
+    },
+
     setZoomFactor: function(zoom)
     {
     },
diff --git a/Source/WebCore/inspector/front-end/IsolatedFileSystemModel.js b/Source/WebCore/inspector/front-end/IsolatedFileSystemModel.js
new file mode 100644 (file)
index 0000000..ae75e95
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * 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
+ */
+WebInspector.IsolatedFileSystemModel = function()
+{
+    /** @type {!Object.<string, WebInspector.IsolatedFileSystemModel.FileSystem>} */
+    this._fileSystems = {};
+    /** @type {Object.<string, Array.<function(DOMFileSystem)>>} */
+    this._pendingFileSystemRequests = {};
+    this._fileSystemMapping = new WebInspector.FileSystemMappingImpl();
+
+    if (this.supportsFileSystems())
+        this._requestFileSystems();
+}
+
+/** @typedef {{fileSystemName: string, rootURL: string, fileSystemPath: string}} */
+WebInspector.IsolatedFileSystemModel.FileSystem;
+
+WebInspector.IsolatedFileSystemModel.prototype = {
+    /**
+     * @return {WebInspector.FileSystemMapping}
+     */
+    mapping: function()
+    {
+        return this._fileSystemMapping;
+    },
+
+    /**
+     * @return {boolean}
+     */
+    supportsFileSystems: function()
+    {
+        return InspectorFrontendHost.supportsFileSystems();
+    },
+
+    _requestFileSystems: function()
+    {
+        console.assert(!this._loaded);
+        InspectorFrontendHost.requestFileSystems();
+    },
+
+    /**
+     * @param {function(string)} callback
+     */
+    addFileSystem: function(callback)
+    {
+        this._selectFileSystemPathCallback = callback;
+        InspectorFrontendHost.addFileSystem();
+    },
+
+    /**
+     * @param {function()} callback
+     */
+    removeFileSystem: function(fileSystemPath, callback)
+    {
+        this._removeFileSystemCallback = callback;
+        InspectorFrontendHost.removeFileSystem(fileSystemPath);
+    },
+
+    /**
+     * @param {Array.<WebInspector.IsolatedFileSystemModel.FileSystem>} fileSystems
+     */
+    _fileSystemsLoaded: function(fileSystems)
+    {
+        for (var i = 0; i < fileSystems.length; ++i)
+            this._innerAddFileSystem(fileSystems[i]);
+        this._loaded = true;
+        this._processPendingFileSystemRequests();
+    },
+
+    /**
+     * @param {WebInspector.IsolatedFileSystemModel.FileSystem} fileSystem
+     */
+    _innerAddFileSystem: function(fileSystem)
+    {
+        this._fileSystemMapping.addFileSystemMapping(fileSystem.fileSystemPath);
+        this._fileSystems[fileSystem.fileSystemPath] = fileSystem;
+    },
+
+    /**
+     * @return {Array.<string>}
+     */
+    _fileSystemPaths: function()
+    {
+        return Object.keys(this._fileSystems);
+    },
+
+    _processPendingFileSystemRequests: function()
+    {
+        for (var fileSystemPath in this._pendingFileSystemRequests) {
+            var callbacks = this._pendingFileSystemRequests[fileSystemPath];
+            for (var i = 0; i < callbacks.length; ++i)
+                callbacks[i](this._isolatedFileSystem(fileSystemPath));
+        }
+    },
+
+    /**
+     * @param {string} errorMessage
+     * @param {WebInspector.IsolatedFileSystemModel.FileSystem} fileSystem
+     */
+    _fileSystemAdded: function(errorMessage, fileSystem)
+    {
+        if (errorMessage) {
+            console.error("Error: " + errorMessage);
+            return;
+        }
+        if (!fileSystem)
+            return;
+        var fileSystemPath;
+        if (fileSystem) {
+            this._innerAddFileSystem(fileSystem);
+            fileSystemPath = fileSystem.fileSystemPath;
+        }
+        if (this._selectFileSystemPathCallback) {
+            this._selectFileSystemPathCallback(fileSystemPath);
+            delete this._selectFileSystemPathCallback;
+        }
+    },
+
+    /**
+     * @param {string} fileSystemPath
+     */
+    _fileSystemRemoved: function(fileSystemPath)
+    {
+        delete this._fileSystems[fileSystemPath];
+        this._fileSystemMapping.removeFileSystemMapping(fileSystemPath);
+
+        if (this._removeFileSystemCallback) {
+            this._removeFileSystemCallback(fileSystemPath);
+            delete this._removeFileSystemCallback;
+        }
+    },
+
+    /**
+     * @param {string} fileSystemPath
+     * @return {DOMFileSystem}
+     */
+    _isolatedFileSystem: function(fileSystemPath)
+    {
+        var fileSystem = this._fileSystems[fileSystemPath];
+        if (!fileSystem)
+            return null;
+        if (!InspectorFrontendHost.isolatedFileSystem)
+            return null;
+        return InspectorFrontendHost.isolatedFileSystem(fileSystem.fileSystemName, fileSystem.rootURL);
+    },
+
+    /**
+     * @param {string} fileSystemPath
+     * @param {function(DOMFileSystem)} callback
+     */
+    requestDOMFileSystem: function(fileSystemPath, callback)
+    {
+        if (!this._loaded) {
+            if (!this._pendingFileSystemRequests[fileSystemPath])
+                this._pendingFileSystemRequests[fileSystemPath] = this._pendingFileSystemRequests[fileSystemPath] || [];
+            this._pendingFileSystemRequests[fileSystemPath].push(callback);
+            return;
+        }
+        callback(this._isolatedFileSystem(fileSystemPath));
+    }
+}
+
+/**
+ * @type {?WebInspector.IsolatedFileSystemModel}
+ */
+WebInspector.isolatedFileSystemModel = null;
+
+/**
+ * @constructor
+ * @param {WebInspector.IsolatedFileSystemModel} isolatedFileSystemModel
+ */
+WebInspector.IsolatedFileSystemDispatcher = function(isolatedFileSystemModel)
+{
+    this._isolatedFileSystemModel = isolatedFileSystemModel;
+}
+
+WebInspector.IsolatedFileSystemDispatcher.prototype = {
+    /**
+     * @param {Array.<WebInspector.IsolatedFileSystemModel.FileSystem>} fileSystems
+     */
+    fileSystemsLoaded: function(fileSystems)
+    {
+        this._isolatedFileSystemModel._fileSystemsLoaded(fileSystems);
+    },
+
+    /**
+     * @param {string} fileSystemPath
+     */
+    fileSystemRemoved: function(fileSystemPath)
+    {
+        this._isolatedFileSystemModel._fileSystemRemoved(fileSystemPath);
+    },
+
+    /**
+     * @param {string} errorMessage
+     * @param {WebInspector.IsolatedFileSystemModel.FileSystem} fileSystem
+     */
+    fileSystemAdded: function(errorMessage, fileSystem)
+    {
+        this._isolatedFileSystemModel._fileSystemAdded(errorMessage, fileSystem);
+    }
+}
+
+/**
+ * @type {?WebInspector.IsolatedFileSystemDispatcher}
+ */
+WebInspector.isolatedFileSystemDispatcher = null;
index 9e10780..b75b79b 100644 (file)
@@ -74,6 +74,7 @@
     <file>ExtensionView.js</file>
     <file>FileContentView.js</file>
     <file>FileManager.js</file>
+    <file>FileSystemMapping.js</file>
     <file>FileSystemModel.js</file>
     <file>FileSystemView.js</file>
     <file>FileUtils.js</file>
     <file>InspectorFrontendHostStub.js</file>
     <file>InspectorView.js</file>
     <file>JSHeapSnapshot.js</file>
+    <file>IsolatedFileSystemModel.js</file>
     <file>JavaScriptFormatter.js</file>
     <file>JavaScriptSourceFrame.js</file>
     <file>jsdifflib.js</file>
index 13b83fe..1991a62 100644 (file)
@@ -138,6 +138,12 @@ DOMApplicationCache.prototype.DOWNLOADING = 3;
 DOMApplicationCache.prototype.UPDATEREADY = 4;
 DOMApplicationCache.prototype.OBSOLETE = 5;
 
+// File System API
+/**
+ * @constructor
+ */
+function DOMFileSystem() {}
+
 /** @type {Node} */
 Range.prototype.startContainer;
 
@@ -171,6 +177,11 @@ InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {}
 InspectorFrontendHostAPI.prototype.recordPanelShown = function(panelCode) {}
 InspectorFrontendHostAPI.prototype.recordSettingChanged = function(settingCode) {}
 InspectorFrontendHostAPI.prototype.loadResourceSynchronously = function(url) {}
+InspectorFrontendHostAPI.prototype.supportsFileSystems = function() {}
+InspectorFrontendHostAPI.prototype.requestFileSystems = function() {}
+InspectorFrontendHostAPI.prototype.addFileSystem = function() {}
+InspectorFrontendHostAPI.prototype.removeFileSystem = function(fileSystemPath) {}
+InspectorFrontendHostAPI.prototype.isolatedFileSystem = function(fileSystemId, registeredName) {}
 InspectorFrontendHostAPI.prototype.setZoomFactor = function(zoom) {}
 InspectorFrontendHostAPI.prototype.canInspectWorkers = function() {}
 /** @type {InspectorFrontendHostAPI} */
index 7f8d9df..019a61a 100644 (file)
@@ -137,6 +137,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="Linkifier.js"></script>
     <script type="text/javascript" src="DebuggerScriptMapping.js"></script>
     <script type="text/javascript" src="PresentationConsoleMessageHelper.js"></script>
+    <script type="text/javascript" src="IsolatedFileSystemModel.js"></script>
+    <script type="text/javascript" src="FileSystemMapping.js"></script>
     <script type="text/javascript" src="Workspace.js"></script>
     <script type="text/javascript" src="SimpleWorkspaceProvider.js"></script>
     <script type="text/javascript" src="BreakpointManager.js"></script>
index 880d196..dc3ef08 100644 (file)
@@ -430,6 +430,8 @@ WebInspector._doLoadedDoneWithCapabilities = function()
     this.openAnchorLocationRegistry = new WebInspector.HandlerRegistry(openAnchorLocationSetting);
     this.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; });
 
+    this.isolatedFileSystemModel = new WebInspector.IsolatedFileSystemModel();
+    this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispatcher(this.isolatedFileSystemModel);
     this.workspace = new WebInspector.Workspace();
     this.networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(this.workspace);
     this.workspace.addProject(WebInspector.projectNames.Network, this.networkWorkspaceProvider);
index c30d6ea..0b3c270 100644 (file)
@@ -1,3 +1,26 @@
+2012-12-28  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: Support inspector file system access with isolated file system through InspectorFrontendHost.
+        https://bugs.webkit.org/show_bug.cgi?id=105727
+
+        Reviewed by Pavel Feldman.
+
+        File system access methods plumbing made for Chromium.
+
+        * public/WebDevToolsFrontendClient.h:
+        (WebKit::WebDevToolsFrontendClient::requestFileSystems):
+        (WebKit::WebDevToolsFrontendClient::addFileSystem):
+        (WebKit::WebDevToolsFrontendClient::removeFileSystem):
+        (WebDevToolsFrontendClient):
+        * src/InspectorFrontendClientImpl.cpp:
+        (WebKit::InspectorFrontendClientImpl::supportsFileSystems):
+        (WebKit):
+        (WebKit::InspectorFrontendClientImpl::requestFileSystems):
+        (WebKit::InspectorFrontendClientImpl::addFileSystem):
+        (WebKit::InspectorFrontendClientImpl::removeFileSystem):
+        * src/InspectorFrontendClientImpl.h:
+        (InspectorFrontendClientImpl):
+
 2013-01-14  Dominic Cooney  <dominicc@chromium.org>
 
         [Chromium] Unreviewed gardening.
index 0438cd3..be756b9 100644 (file)
@@ -53,6 +53,10 @@ public:
     virtual void save(const WebString& url, const WebString& content, bool saveAs) { }
     virtual void append(const WebString& url, const WebString& content) { }
 
+    virtual void requestFileSystems() { }
+    virtual void addFileSystem() { }
+    virtual void removeFileSystem(const WebString& fileSystemPath) { }
+
 protected:
     virtual ~WebDevToolsFrontendClient() {}
 };
index fcfa25f..b2be136 100644 (file)
@@ -154,4 +154,25 @@ void InspectorFrontendClientImpl::sendMessageToBackend(const String& message)
     m_client->sendMessageToBackend(message);
 }
 
+bool InspectorFrontendClientImpl::supportsFileSystems()
+{
+    return true;
+}
+
+void InspectorFrontendClientImpl::requestFileSystems()
+{
+    m_client->requestFileSystems();
+}
+
+void InspectorFrontendClientImpl::addFileSystem()
+{
+    m_client->addFileSystem();
+}
+
+void InspectorFrontendClientImpl::removeFileSystem(const String& fileSystemPath)
+{
+    m_client->removeFileSystem(fileSystemPath);
+}
+
+
 } // namespace WebKit
index 72f8d68..f2f61ad 100644 (file)
@@ -75,6 +75,11 @@ public:
     virtual void inspectedURLChanged(const WTF::String&);
 
     virtual void sendMessageToBackend(const WTF::String&);
+
+    virtual bool supportsFileSystems();
+    virtual void requestFileSystems();
+    virtual void addFileSystem();
+    virtual void removeFileSystem(const String& fileSystemPath);
 private:
     WebCore::Page* m_frontendPage;
     WebDevToolsFrontendClient* m_client;