Changeset 70956 in webkit


Ignore:
Timestamp:
Oct 29, 2010 4:57:20 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-29 Kavita Kanetkar <kkanetkar@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: FileSystem integration
https://bugs.webkit.org/show_bug.cgi?id=45982

Adding filesystem support for Inspector under storage tab. This fetches root paths for
temporary and persistent filesystems and allows "reveal folder in OS" option that
launches native file browser. Currently this feature is disabled for non-chromium platforms.

  • CMakeLists.txt:
  • English.lproj/localizedStrings.js:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • inspector/CodeGeneratorInspector.pm:
  • inspector/Inspector.idl:
  • inspector/InspectorController.cpp: (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::releaseFrontendLifetimeAgents):
  • inspector/InspectorController.h: (WebCore::InspectorController::fileSystemAgent):
  • inspector/InspectorFileSystemAgent.cpp: Added.
  • inspector/InspectorFileSystemAgent.h: Added.
  • inspector/front-end/FileSystemView.js: Added.
  • inspector/front-end/Settings.js:
  • inspector/front-end/StoragePanel.js: (WebInspector.StoragePanel): (WebInspector.StoragePanel.prototype.reset): (WebInspector.StoragePanel.prototype.addFileSystem): (WebInspector.StoragePanel.prototype.showFileSystem): (WebInspector.StoragePanel.prototype.updateFileSystemPath): (WebInspector.StoragePanel.prototype.updateFileSystemError): (WebInspector.FileSystemTreeElement): (WebInspector.FileSystemTreeElement.prototype.onselect):
  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/inspector.css: (.file-system-storage-tree-item .icon):
  • inspector/front-end/inspector.html:
  • inspector/front-end/inspector.js: (WebInspector.updateResource): (WebInspector._addFileSystemOrigin): (WebInspector.didGetFileSystemPath): (WebInspector.didGetFileSystemError): (WebInspector.reset):
  • platform/AsyncFileSystem.h: (WebCore::AsyncFileSystem::root):
  • platform/FileSystem.h:
  • platform/chromium/ChromiumBridge.h:
  • platform/chromium/FileSystemChromium.cpp: (WebCore::revealFolderInOS):

2010-10-29 Kavita Kanetkar <kkanetkar@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: FileSystem integration
https://bugs.webkit.org/show_bug.cgi?id=45982

  • public/WebFileUtilities.h: (WebKit::WebFileUtilities::revealFolderInOS):
  • src/ChromiumBridge.cpp: (WebCore::ChromiumBridge::revealFolderInOS):
Location:
trunk
Files:
3 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/CMakeLists.txt

    r70904 r70956  
    11201120    inspector/InspectorDatabaseResource.cpp
    11211121    inspector/InspectorDebuggerAgent.cpp
     1122    inspector/InspectorFileSystemAgent.cpp
    11221123    inspector/InspectorFrontendClientLocal.cpp
    11231124    inspector/InspectorFrontendHost.cpp
  • trunk/WebCore/ChangeLog

    r70945 r70956  
     12010-10-29  Kavita Kanetkar  <kkanetkar@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: FileSystem integration
     6        https://bugs.webkit.org/show_bug.cgi?id=45982
     7
     8        Adding filesystem support for Inspector under storage tab. This fetches root paths for
     9        temporary and persistent filesystems and allows "reveal folder in OS" option that
     10        launches native file browser. Currently this feature is disabled for non-chromium platforms.
     11
     12        * CMakeLists.txt:
     13        * English.lproj/localizedStrings.js:
     14        * GNUmakefile.am:
     15        * WebCore.gypi:
     16        * WebCore.pro:
     17        * WebCore.vcproj/WebCore.vcproj:
     18        * inspector/CodeGeneratorInspector.pm:
     19        * inspector/Inspector.idl:
     20        * inspector/InspectorController.cpp:
     21        (WebCore::InspectorController::connectFrontend):
     22        (WebCore::InspectorController::releaseFrontendLifetimeAgents):
     23        * inspector/InspectorController.h:
     24        (WebCore::InspectorController::fileSystemAgent):
     25        * inspector/InspectorFileSystemAgent.cpp: Added.
     26        * inspector/InspectorFileSystemAgent.h: Added.
     27        * inspector/front-end/FileSystemView.js: Added.
     28        * inspector/front-end/Settings.js:
     29        * inspector/front-end/StoragePanel.js:
     30        (WebInspector.StoragePanel):
     31        (WebInspector.StoragePanel.prototype.reset):
     32        (WebInspector.StoragePanel.prototype.addFileSystem):
     33        (WebInspector.StoragePanel.prototype.showFileSystem):
     34        (WebInspector.StoragePanel.prototype.updateFileSystemPath):
     35        (WebInspector.StoragePanel.prototype.updateFileSystemError):
     36        (WebInspector.FileSystemTreeElement):
     37        (WebInspector.FileSystemTreeElement.prototype.onselect):
     38        * inspector/front-end/WebKit.qrc:
     39        * inspector/front-end/inspector.css:
     40        (.file-system-storage-tree-item .icon):
     41        * inspector/front-end/inspector.html:
     42        * inspector/front-end/inspector.js:
     43        (WebInspector.updateResource):
     44        (WebInspector._addFileSystemOrigin):
     45        (WebInspector.didGetFileSystemPath):
     46        (WebInspector.didGetFileSystemError):
     47        (WebInspector.reset):
     48        * platform/AsyncFileSystem.h:
     49        (WebCore::AsyncFileSystem::root):
     50        * platform/FileSystem.h:
     51        * platform/chromium/ChromiumBridge.h:
     52        * platform/chromium/FileSystemChromium.cpp:
     53        (WebCore::revealFolderInOS):
     54
    1552010-10-29  Ryosuke Niwa  <rniwa@webkit.org>
    256
  • trunk/WebCore/GNUmakefile.am

    r70904 r70956  
    18451845        WebCore/inspector/InspectorDOMStorageResource.cpp \
    18461846        WebCore/inspector/InspectorDOMStorageResource.h \
     1847    WebCore/inspector/InspectorFileSystemAgent.cpp \
     1848    WebCore/inspector/InspectorFileSystemAgent.h \
    18471849        WebCore/inspector/InspectorFrontendClient.h \
    18481850        WebCore/inspector/InspectorFrontendClientLocal.cpp \
  • trunk/WebCore/WebCore.gypi

    r70904 r70956  
    19471947            'inspector/InspectorDOMStorageResource.cpp',
    19481948            'inspector/InspectorDOMStorageResource.h',
     1949            'inspector/InspectorFileSystemAgent.cpp',
     1950            'inspector/InspectorFileSystemAgent.h',
    19491951            'inspector/InspectorFrontendClient.h',
    19501952            'inspector/InspectorFrontendHost.cpp',
     
    44204422            'inspector/front-end/ExtensionRegistryStub.js',
    44214423            'inspector/front-end/ExtensionServer.js',
     4424            'inspector/front-end/FileSystemView.js',
    44224425            'inspector/front-end/FontView.js',
    44234426            'inspector/front-end/GoToLineDialog.js',
  • trunk/WebCore/WebCore.pro

    r70904 r70956  
    10111011    inspector/InspectorDOMAgent.cpp \
    10121012    inspector/InspectorDOMStorageResource.cpp \
     1013    inspector/InspectorFileSystemAgent.cpp \
    10131014    inspector/InspectorFrontendClientLocal.cpp \
    10141015    inspector/InspectorFrontendHost.cpp \
     
    18931894    inspector/InspectorDebuggerAgent.h \
    18941895    inspector/InspectorDOMStorageResource.h \
     1896    inspector/InspectorFileSystemAgent.h \
    18951897    inspector/InspectorFrontendClient.h \
    18961898    inspector/InspectorFrontendClientLocal.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r70904 r70956  
    6376963769                        </File>
    6377063770                        <File
     63771                                RelativePath="..\inspector\InspectorFileSystemAgent.h"
     63772                                >
     63773                        </File>
     63774                        <File
     63775                                RelativePath="..\inspector\InspectorFileSystemAgent.cpp"
     63776                                >
     63777                        </File>
     63778                        <File
    6377163779                                RelativePath="..\inspector\InspectorFrontendClient.h"
    6377263780                                >
     
    6404564053                                <File
    6404664054                                        RelativePath="..\inspector\front-end\ExtensionServer.js"
     64055                                        >
     64056                                </File>
     64057                                <File
     64058                                        RelativePath="..\inspector\front-end\FileSystemView.js"
    6404764059                                        >
    6404864060                                </File>
  • trunk/WebCore/inspector/CodeGeneratorInspector.pm

    r69948 r70956  
    4343    "header" => "InspectorApplicationCacheAgent.h",
    4444    "domainAccessor" => "m_inspectorController->applicationCacheAgent()",
     45};
     46$typeTransform{"FileSystem"} = {
     47    "forward" => "InspectorFileSystemAgent",
     48    "header" => "InspectorFileSystemAgent.h",
     49    "domainAccessor" => "m_inspectorController->fileSystemAgent()",
    4550};
    4651$typeTransform{"Profiler"} = {
  • trunk/WebCore/inspector/Inspector.idl

    r70929 r70956  
    218218#endif
    219219
     220#if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM
     221        [handler=FileSystem] void getFileSystemPathAsync(in unsigned int type, in String origin);
     222        [handler=FileSystem] void revealFolderInOS(in String path);
     223        [notify] void didGetFileSystemPath(out String root, out int type, out String origin);
     224        [notify] void didGetFileSystemError(out int type, out String origin);
     225#endif
     226
    220227        [handler=Backend] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
    221228        [handler=Controller] void didEvaluateForTestInFrontend(in long testCallId, in String jsonResult);
  • trunk/WebCore/inspector/InspectorController.cpp

    r70929 r70956  
    115115#endif
    116116
     117#if ENABLE(FILE_SYSTEM)
     118#include "InspectorFileSystemAgent.h"
     119#endif
     120
    117121#if ENABLE(DOM_STORAGE)
    118122#include "Storage.h"
     
    501505#endif
    502506
     507#if ENABLE(FILE_SYSTEM)
     508    m_fileSystemAgent = InspectorFileSystemAgent::create(this, m_frontend.get());
     509#endif
     510   
    503511    if (!InspectorInstrumentation::hasFrontends())
    504512        ScriptController::setCaptureCallStackForUncaughtExceptions(true);
     
    605613#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    606614    m_applicationCacheAgent.clear();
     615#endif
     616
     617#if ENABLE(FILE_SYSTEM)
     618    if (m_fileSystemAgent)
     619        m_fileSystemAgent->stop();
     620        m_fileSystemAgent.clear();
    607621#endif
    608622}
  • trunk/WebCore/inspector/InspectorController.h

    r70929 r70956  
    9797#endif
    9898
     99#if ENABLE(FILE_SYSTEM)
     100class InspectorFileSystemAgent;
     101#endif
     102
    99103#if ENABLE(WEB_SOCKETS)
    100104class WebSocketHandshakeRequest;
     
    194198    InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
    195199#endif
     200
     201#if ENABLE(FILE_SYSTEM)
     202    InspectorFileSystemAgent* fileSystemAgent() { return m_fileSystemAgent.get(); }
     203#endif
    196204
    197205    void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&);
     
    359367    OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
    360368#endif
     369   
     370#if ENABLE(FILE_SYSTEM)
     371    RefPtr<InspectorFileSystemAgent> m_fileSystemAgent;
     372#endif
     373
    361374    RefPtr<Node> m_nodeToFocus;
    362375#if LEGACY_RESOURCE_TRACKING_ENABLED
  • trunk/WebCore/inspector/front-end/Settings.js

    r70929 r70956  
    4747    resourceExportEnabled: false,
    4848    networkPanelEnabled: false,
     49    fileSystemEnabled: false,
    4950    useDataURLForResourceImageIcons: true
    5051}
  • trunk/WebCore/inspector/front-end/StoragePanel.js

    r70879 r70956  
    6363    this.applicationCacheListTreeElement.expand();
    6464
     65    if (Preferences.fileSystemEnabled) {
     66        this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("File System"), "file-system-storage-tree-item");
     67        this.sidebarTree.appendChild(this.fileSystemListTreeElement);
     68        this.fileSystemListTreeElement.expand();
     69    }
     70       
    6571    this.storageViews = document.createElement("div");
    6672    this.storageViews.id = "storage-views";
     
    103109
    104110        this._cookieViews = {};
    105 
     111       
     112        this._fileSystemView = null;
     113       
    106114        this._applicationCacheView = null;
    107115        delete this._cachedApplicationCacheViewStatus;
     
    112120        this.cookieListTreeElement.removeChildren();
    113121        this.applicationCacheListTreeElement.removeChildren();
    114 
     122        if (Preferences.fileSystemEnabled)
     123            this.fileSystemListTreeElement.removeChildren();
    115124        this.storageViews.removeChildren();
    116125
     
    230239    },
    231240
     241    addFileSystem: function(origin)
     242    {
     243        var fileSystemTreeElement = new WebInspector.FileSystemTreeElement(this, origin);
     244        this.fileSystemListTreeElement.appendChild(fileSystemTreeElement);
     245    },
     246   
    232247    selectDatabase: function(databaseId)
    233248    {
     
    353368    },
    354369
     370    showFileSystem: function(treeElement, fileSystemDomain)
     371    {
     372        this._fileSystemView =  new WebInspector.FileSystemView(treeElement, fileSystemDomain);
     373        this._innerShowView(this._fileSystemView);
     374    },
     375   
    355376    showCategoryView: function(categoryName)
    356377    {
     
    501522    },
    502523
     524    updateFileSystemPath: function(root, type, origin)
     525    {
     526        if (this._fileSystemView && this._fileSystemView === this.visibleView)
     527            this._fileSystemView.updateFileSystemPath(root, type, origin); 
     528    },
     529 
     530    updateFileSystemError: function(type, origin)
     531    {
     532        if (this._fileSystemView && this._fileSystemView === this.visibleView)
     533            this._fileSystemView.updateFileSystemError(type, origin); 
     534    },
     535
    503536    updateNetworkState: function(isNowOnline)
    504537    {
     
    922955WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
    923956
     957WebInspector.FileSystemTreeElement = function(storagePanel, fileSystemDomain)
     958{
     959    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, fileSystemDomain ? fileSystemDomain : WebInspector.UIString("Local Files"), "file-system-storage-tree-item");
     960    this._fileSystemDomain = fileSystemDomain;
     961}
     962
     963WebInspector.FileSystemTreeElement.prototype = {
     964    onselect: function()
     965    {
     966        this._storagePanel.showFileSystem(this, this._fileSystemDomain);
     967    }
     968}
     969 
     970WebInspector.FileSystemTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
     971 
    924972WebInspector.StorageCategoryView = function()
    925973{
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r70240 r70956  
    4242    <file>ExtensionRegistryStub.js</file>
    4343    <file>ExtensionServer.js</file>
     44    <file>FileSystemView.js</file>
    4445    <file>FontView.js</file>
    4546    <file>GoToLineDialog.js</file>
  • trunk/WebCore/inspector/front-end/inspector.css

    r70529 r70956  
    19331933}
    19341934
     1935/* FIXME: Make separate png for file-system */
     1936.file-system-storage-tree-item .icon {
     1937    content: url(Images/applicationCache.png);
     1938}
     1939
    19351940#storage-views {
    19361941    position: absolute;
  • trunk/WebCore/inspector/front-end/inspector.html

    r70137 r70956  
    7070    <script type="text/javascript" src="CookieItemsView.js"></script>
    7171    <script type="text/javascript" src="ApplicationCacheItemsView.js"></script>
     72    <script type="text/javascript" src="FileSystemView.js"></script>
    7273    <script type="text/javascript" src="Script.js"></script>
    7374    <script type="text/javascript" src="BreakpointManager.js"></script>
  • trunk/WebCore/inspector/front-end/inspector.js

    r70929 r70956  
    5353    cookieDomains: {},
    5454    applicationCacheDomains: {},
     55    fileSystemOrigins: {},
    5556    missingLocalizedStrings: {},
    5657    pendingDispatches: 0,
     
    12981299            this._addCookieDomain(parsedURL.host);
    12991300            this._addAppCacheDomain(parsedURL.host);
     1301            if (Preferences.fileSystemEnabled)
     1302                // This should match the SecurityOrigin::toString(). FIXME: Add a test for this.
     1303                this._addFileSystemOrigin(parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : ""));
    13001304        }
    13011305    }
     
    14141418}
    14151419
     1420WebInspector._addFileSystemOrigin = function(origin)
     1421{
     1422    if (!this.panels.storage)
     1423        return;
     1424    // Eliminate duplicate origins.
     1425    // FIXME: Move appcache/cookies/filesystem domain dup checks in StoragePanel.js
     1426    if (origin in this.fileSystemOrigins)
     1427        return;
     1428    this.fileSystemOrigins[origin] = true;
     1429    this.panels.storage.addFileSystem(origin);
     1430}
     1431
    14161432WebInspector.addDOMStorage = function(payload)
    14171433{
     
    14351451}
    14361452
     1453WebInspector.didGetFileSystemPath = function(root, type, origin)
     1454{
     1455    this.panels.storage.updateFileSystemPath(root, type, origin);
     1456}
     1457
     1458WebInspector.didGetFileSystemError = function(type, origin)
     1459{
     1460    this.panels.storage.updateFileSystemError(type, origin);
     1461}
     1462
    14371463WebInspector.updateNetworkState = function(isNowOnline)
    14381464{
     
    15161542    this.cookieDomains = {};
    15171543    this.applicationCacheDomains = {};
     1544    this.fileSystemOrigins = {};
    15181545    this.highlightDOMNode(0);
    15191546
  • trunk/WebCore/platform/AsyncFileSystem.h

    r69485 r70956  
    129129    virtual String virtualToPlatformPath(const String& path) const;
    130130
     131    // Getter for this file system's root path.
     132    String root() const { return m_platformRootPath; }
     133
    131134protected:
    132135    AsyncFileSystem(const String& platformRootPath)
  • trunk/WebCore/platform/FileSystem.h

    r66255 r70956  
    145145#endif
    146146
     147void revealFolderInOS(const String&);
    147148bool fileExists(const String&);
    148149bool deleteFile(const String&);
  • trunk/WebCore/platform/chromium/ChromiumBridge.h

    r69673 r70956  
    122122
    123123        // File ---------------------------------------------------------------
     124        static void revealFolderInOS(const String&);
    124125        static bool fileExists(const String&);
    125126        static bool deleteFile(const String&);
  • trunk/WebCore/platform/chromium/FileSystemChromium.cpp

    r58599 r70956  
    5858}
    5959
     60void revealFolderInOS(const String& path)
     61{
     62    ChromiumBridge::revealFolderInOS(path);
     63}
     64
    6065String directoryName(const String& path)
    6166{
  • trunk/WebKit/chromium/ChangeLog

    r70931 r70956  
     12010-10-29  Kavita Kanetkar  <kkanetkar@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: FileSystem integration
     6        https://bugs.webkit.org/show_bug.cgi?id=45982
     7
     8        * public/WebFileUtilities.h:
     9        (WebKit::WebFileUtilities::revealFolderInOS):
     10        * src/ChromiumBridge.cpp:
     11        (WebCore::ChromiumBridge::revealFolderInOS):
     12
     13
    1142010-10-29  Darin Adler  <darin@apple.com>
    215
  • trunk/WebKit/chromium/public/WebFileUtilities.h

    r65485 r70956  
    4949    typedef int FileHandle;
    5050#endif
    51 
     51    virtual void revealFolderInOS(const WebString& path) { }
    5252    virtual bool fileExists(const WebString& path) { return false; }
    5353    virtual bool deleteFile(const WebString& path) { return false; }
  • trunk/WebKit/chromium/src/ChromiumBridge.cpp

    r70153 r70956  
    346346}
    347347
     348void ChromiumBridge::revealFolderInOS(const String& path)
     349{
     350    webKitClient()->fileUtilities()->revealFolderInOS(path);
     351}
     352
    348353bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result)
    349354{
  • trunk/WebKit/chromium/src/js/DevTools.js

    r69098 r70956  
    4747    Preferences.onlineDetectionEnabled = false;
    4848    Preferences.nativeInstrumentationEnabled = true;
     49    // FIXME: Turn this to whatever the value of --enable-file-system for chrome.
     50    Preferences.fileSystemEnabled = false;
    4951})();
    5052
Note: See TracChangeset for help on using the changeset viewer.