Changeset 112510 in webkit


Ignore:
Timestamp:
Mar 29, 2012 2:40:41 AM (12 years ago)
Author:
kinuko@chromium.org
Message:

[chromium] Add isolated filesystem type and WebDragData::filesystem_id for drag-and-drop using File/DirectoryEntry.
https://bugs.webkit.org/show_bug.cgi?id=76826

Source/WebCore:

Add two helper methods for creating isolated filesystem to the
PlatformSupport interface.

Reviewed by David Levin.

No new tests: tests will be added when app-facing code is added.

  • platform/chromium/PlatformSupport.h:

(PlatformSupport):

Source/WebKit/chromium:

As proposed on whatwg (http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-November/033814.html)
we are implementing better drag-and-drop support using File/Directory
Entry objects in FileSystem API, and for the purpose this patch adds
a new filesystem type: Isolated filesystem.

Each filesystem can be distinguished by a filesystem ID that is given
by chromium platform code via WebDragData when set of
files/directories are dropped.

This is all platform-specific implementation detail and all the changes
are in chromium directory.

Reviewed by David Levin.

  • public/platform/WebDragData.h:

(WebDragData):

  • public/platform/WebFileSystem.h: Added Isolated type.
  • src/AsyncFileSystemChromium.cpp:

(WebCore::AsyncFileSystemChromium::createIsolatedFileSystemName): Added.
(WebCore::AsyncFileSystemChromium::createIsolatedFileSystem): Added.
(WebCore::AsyncFileSystemChromium::toURL): Made it not to return URL
for isolated filesystem (as we do not support it for now).

  • src/AsyncFileSystemChromium.h:
  • src/PlatformSupport.cpp:

(WebCore::PlatformSupport::createIsolatedFileSystem): Added.

  • src/WebDragData.cpp:

(WebKit::WebDragData::filesystemId): Added.
(WebKit::WebDragData::setFilesystemId): Added.

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112506 r112510  
     12012-03-28  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        [chromium] Add isolated filesystem type and WebDragData::filesystem_id for drag-and-drop using File/DirectoryEntry.
     4        https://bugs.webkit.org/show_bug.cgi?id=76826
     5
     6        Add two helper methods for creating isolated filesystem to the
     7        PlatformSupport interface.
     8
     9        Reviewed by David Levin.
     10
     11        No new tests: tests will be added when app-facing code is added.
     12
     13        * platform/chromium/PlatformSupport.h:
     14        (PlatformSupport):
     15
    1162012-03-29  Vineet Chaudhary  <rgf748@motorola.com>
    217
  • trunk/Source/WebCore/platform/chromium/PlatformSupport.h

    r111258 r112510  
    6767namespace WebCore {
    6868
     69class AsyncFileSystem;
    6970class Clipboard;
    7071class Color;
     
    147148    static int readFromFile(PlatformFileHandle, char* data, int length);
    148149    static int writeToFile(PlatformFileHandle, const char* data, int length);
     150
     151#if ENABLE(FILE_SYSTEM)
     152    static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId);
     153    static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId);
     154#endif
    149155
    150156    // Font ---------------------------------------------------------------
  • trunk/Source/WebKit/chromium/ChangeLog

    r112507 r112510  
     12012-03-28  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        [chromium] Add isolated filesystem type and WebDragData::filesystem_id for drag-and-drop using File/DirectoryEntry.
     4        https://bugs.webkit.org/show_bug.cgi?id=76826
     5
     6        As proposed on whatwg (http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-November/033814.html)
     7        we are implementing better drag-and-drop support using File/Directory
     8        Entry objects in FileSystem API, and for the purpose this patch adds
     9        a new filesystem type: Isolated filesystem.
     10
     11        Each filesystem can be distinguished by a filesystem ID that is given
     12        by chromium platform code via WebDragData when set of
     13        files/directories are dropped.
     14
     15        This is all platform-specific implementation detail and all the changes
     16        are in chromium directory.
     17
     18        Reviewed by David Levin.
     19
     20        * public/platform/WebDragData.h:
     21        (WebDragData):
     22        * public/platform/WebFileSystem.h: Added Isolated type.
     23        * src/AsyncFileSystemChromium.cpp:
     24        (WebCore::AsyncFileSystemChromium::createIsolatedFileSystemName): Added.
     25        (WebCore::AsyncFileSystemChromium::createIsolatedFileSystem): Added.
     26        (WebCore::AsyncFileSystemChromium::toURL): Made it not to return URL
     27        for isolated filesystem (as we do not support it for now).
     28        * src/AsyncFileSystemChromium.h:
     29        * src/PlatformSupport.cpp:
     30        (WebCore::PlatformSupport::createIsolatedFileSystem): Added.
     31        * src/WebDragData.cpp:
     32        (WebKit::WebDragData::filesystemId): Added.
     33        (WebKit::WebDragData::setFilesystemId): Added.
     34
    1352012-03-29  Kinuko Yasuda  <kinuko@chromium.org>
    236
  • trunk/Source/WebKit/chromium/public/platform/WebDragData.h

    r108554 r112510  
    103103    WEBKIT_EXPORT void addItem(const Item&);
    104104
     105    WEBKIT_EXPORT WebString filesystemId() const;
     106    WEBKIT_EXPORT void setFilesystemId(const WebString&);
     107
    105108#if WEBKIT_IMPLEMENTATION
    106109    WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
  • trunk/Source/WebKit/chromium/public/platform/WebFileSystem.h

    r109070 r112510  
    4747        TypeTemporary,
    4848        TypePersistent,
     49
     50        // Indicates an isolated filesystem which only exposes a set of files.
     51        TypeIsolated,
     52
     53        // Indicates a non-sandboxed filesystem.
    4954        TypeExternal,
    5055    };
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp

    r109324 r112510  
    5252namespace {
    5353
    54 // ChromeOS-specific filesystem type.
     54// For isolated filesystem.
     55const AsyncFileSystem::Type isolatedType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeIsolated);
     56const char isolatedPathPrefix[] = "isolated";
     57
     58// For external filesystem.
    5559const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);
    5660const char externalPathPrefix[] = "external";
     
    162166}
    163167
     168// static
     169String AsyncFileSystemChromium::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId)
     170{
     171    StringBuilder filesystemName;
     172    filesystemName.append(storageIdentifier);
     173    filesystemName.append(":");
     174    filesystemName.append(isolatedPathPrefix);
     175    filesystemName.append("_");
     176    filesystemName.append(filesystemId);
     177    return filesystemName.toString();
     178}
     179
     180// static
     181PassOwnPtr<AsyncFileSystem> AsyncFileSystemChromium::createIsolatedFileSystem(const String& originString, const String& filesystemId)
     182{
     183    // The rootURL is used in succeeding filesystem requests sent to the
     184    // chromium and is validated each time in the browser process.
     185    StringBuilder rootURL;
     186    rootURL.append("filesystem:");
     187    rootURL.append(originString);
     188    rootURL.append("/");
     189    rootURL.append(isolatedPathPrefix);
     190    rootURL.append("/");
     191    rootURL.append(filesystemId);
     192    rootURL.append("/");
     193
     194    return AsyncFileSystemChromium::create(isolatedType, KURL(ParsedURLString, rootURL.toString()));
     195}
     196
    164197AsyncFileSystemChromium::~AsyncFileSystemChromium()
    165198{
     
    170203    ASSERT(!originString.isEmpty());
    171204    if (originString == "null")
     205        return String();
     206
     207    // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue).
     208    if (type() == isolatedType)
    172209        return String();
    173210
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h

    r109324 r112510  
    5353    }
    5454
     55    static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId);
     56    static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId);
     57
    5558    virtual ~AsyncFileSystemChromium();
    5659
  • trunk/Source/WebKit/chromium/src/PlatformSupport.cpp

    r110716 r112510  
    8787#endif
    8888
     89#include "AsyncFileSystemChromium.h"
    8990#include "BitmapImage.h"
    9091#include "ClipboardChromium.h"
     
    417418    return webKitPlatformSupport()->fileUtilities()->writeToFile(handle, data, length);
    418419}
     420
     421#if ENABLE(FILE_SYSTEM)
     422String PlatformSupport::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId)
     423{
     424    return AsyncFileSystemChromium::createIsolatedFileSystemName(storageIdentifier, filesystemId);
     425}
     426
     427PassOwnPtr<AsyncFileSystem> PlatformSupport::createIsolatedFileSystem(const String& originString, const String& filesystemId)
     428{
     429    return AsyncFileSystemChromium::createIsolatedFileSystem(originString, filesystemId);
     430}
     431#endif
    419432
    420433// Font -----------------------------------------------------------------------
  • trunk/Source/WebKit/chromium/src/WebDragData.cpp

    r112448 r112510  
    129129}
    130130
     131WebString WebDragData::filesystemId() const
     132{
     133    // FIXME: Should return the ID set by setFileSystemId().
     134    return WebString();
     135}
     136
     137void WebDragData::setFilesystemId(const WebString& filesystemId)
     138{
     139    // FIXME: The given value should be stored internally and is to be used
     140    // to instantiate an isolated filesystem for providing FileSystem Entry
     141    // access to the dragged files/directories.
     142    // The ID is an opaque string, given by and validated by chromium port.
     143}
     144
    131145WebDragData::WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>& data)
    132146    : m_private(static_cast<WebDragDataPrivate*>(data.leakRef()))
Note: See TracChangeset for help on using the changeset viewer.