Title: [112510] trunk/Source
Revision
112510
Author
[email protected]
Date
2012-03-29 02:40:41 -0700 (Thu, 29 Mar 2012)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112509 => 112510)


--- trunk/Source/WebCore/ChangeLog	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebCore/ChangeLog	2012-03-29 09:40:41 UTC (rev 112510)
@@ -1,3 +1,18 @@
+2012-03-28  Kinuko Yasuda  <[email protected]>
+
+        [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
+
+        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):
+
 2012-03-29  Vineet Chaudhary  <[email protected]>
 
         Remove custom bindings form Internals.idl of attribute type Array.

Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (112509 => 112510)


--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-03-29 09:40:41 UTC (rev 112510)
@@ -66,6 +66,7 @@
 
 namespace WebCore {
 
+class AsyncFileSystem;
 class Clipboard;
 class Color;
 class Cursor;
@@ -147,6 +148,11 @@
     static int readFromFile(PlatformFileHandle, char* data, int length);
     static int writeToFile(PlatformFileHandle, const char* data, int length);
 
+#if ENABLE(FILE_SYSTEM)
+    static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId);
+    static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId);
+#endif
+
     // Font ---------------------------------------------------------------
 #if OS(WINDOWS)
     static bool ensureFontLoaded(HFONT);

Modified: trunk/Source/WebKit/chromium/ChangeLog (112509 => 112510)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-29 09:40:41 UTC (rev 112510)
@@ -1,3 +1,37 @@
+2012-03-28  Kinuko Yasuda  <[email protected]>
+
+        [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
+
+        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.
+
 2012-03-29  Kinuko Yasuda  <[email protected]>
 
         Unreviewed; rolling chromium deps to 129583.

Modified: trunk/Source/WebKit/chromium/public/platform/WebDragData.h (112509 => 112510)


--- trunk/Source/WebKit/chromium/public/platform/WebDragData.h	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/public/platform/WebDragData.h	2012-03-29 09:40:41 UTC (rev 112510)
@@ -102,6 +102,9 @@
     WEBKIT_EXPORT void setItems(const WebVector<Item>&);
     WEBKIT_EXPORT void addItem(const Item&);
 
+    WEBKIT_EXPORT WebString filesystemId() const;
+    WEBKIT_EXPORT void setFilesystemId(const WebString&);
+
 #if WEBKIT_IMPLEMENTATION
     WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
     WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);

Modified: trunk/Source/WebKit/chromium/public/platform/WebFileSystem.h (112509 => 112510)


--- trunk/Source/WebKit/chromium/public/platform/WebFileSystem.h	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/public/platform/WebFileSystem.h	2012-03-29 09:40:41 UTC (rev 112510)
@@ -46,6 +46,11 @@
     enum Type {
         TypeTemporary,
         TypePersistent,
+
+        // Indicates an isolated filesystem which only exposes a set of files.
+        TypeIsolated,
+
+        // Indicates a non-sandboxed filesystem.
         TypeExternal,
     };
 

Modified: trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp (112509 => 112510)


--- trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp	2012-03-29 09:40:41 UTC (rev 112510)
@@ -51,7 +51,11 @@
 
 namespace {
 
-// ChromeOS-specific filesystem type.
+// For isolated filesystem.
+const AsyncFileSystem::Type isolatedType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeIsolated);
+const char isolatedPathPrefix[] = "isolated";
+
+// For external filesystem.
 const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);
 const char externalPathPrefix[] = "external";
 const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1;
@@ -161,6 +165,35 @@
     ASSERT(m_webFileSystem);
 }
 
+// static
+String AsyncFileSystemChromium::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId)
+{
+    StringBuilder filesystemName;
+    filesystemName.append(storageIdentifier);
+    filesystemName.append(":");
+    filesystemName.append(isolatedPathPrefix);
+    filesystemName.append("_");
+    filesystemName.append(filesystemId);
+    return filesystemName.toString();
+}
+
+// static
+PassOwnPtr<AsyncFileSystem> AsyncFileSystemChromium::createIsolatedFileSystem(const String& originString, const String& filesystemId)
+{
+    // The rootURL is used in succeeding filesystem requests sent to the
+    // chromium and is validated each time in the browser process.
+    StringBuilder rootURL;
+    rootURL.append("filesystem:");
+    rootURL.append(originString);
+    rootURL.append("/");
+    rootURL.append(isolatedPathPrefix);
+    rootURL.append("/");
+    rootURL.append(filesystemId);
+    rootURL.append("/");
+
+    return AsyncFileSystemChromium::create(isolatedType, KURL(ParsedURLString, rootURL.toString()));
+}
+
 AsyncFileSystemChromium::~AsyncFileSystemChromium()
 {
 }
@@ -171,6 +204,10 @@
     if (originString == "null")
         return String();
 
+    // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue).
+    if (type() == isolatedType)
+        return String();
+
     if (type() == externalType) {
         // For external filesystem originString could be different from what we have in m_filesystemRootURL.
         StringBuilder result;

Modified: trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h (112509 => 112510)


--- trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h	2012-03-29 09:40:41 UTC (rev 112510)
@@ -52,6 +52,9 @@
         return adoptPtr(new AsyncFileSystemChromium(type, rootURL));
     }
 
+    static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId);
+    static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId);
+
     virtual ~AsyncFileSystemChromium();
 
     virtual String toURL(const String& originString, const String& fullPath);

Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (112509 => 112510)


--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-03-29 09:40:41 UTC (rev 112510)
@@ -86,6 +86,7 @@
 #include "NativeImageSkia.h"
 #endif
 
+#include "AsyncFileSystemChromium.h"
 #include "BitmapImage.h"
 #include "ClipboardChromium.h"
 #include "Cookie.h"
@@ -417,6 +418,18 @@
     return webKitPlatformSupport()->fileUtilities()->writeToFile(handle, data, length);
 }
 
+#if ENABLE(FILE_SYSTEM)
+String PlatformSupport::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId)
+{
+    return AsyncFileSystemChromium::createIsolatedFileSystemName(storageIdentifier, filesystemId);
+}
+
+PassOwnPtr<AsyncFileSystem> PlatformSupport::createIsolatedFileSystem(const String& originString, const String& filesystemId)
+{
+    return AsyncFileSystemChromium::createIsolatedFileSystem(originString, filesystemId);
+}
+#endif
+
 // Font -----------------------------------------------------------------------
 
 #if OS(WINDOWS)

Modified: trunk/Source/WebKit/chromium/src/WebDragData.cpp (112509 => 112510)


--- trunk/Source/WebKit/chromium/src/WebDragData.cpp	2012-03-29 09:11:31 UTC (rev 112509)
+++ trunk/Source/WebKit/chromium/src/WebDragData.cpp	2012-03-29 09:40:41 UTC (rev 112510)
@@ -128,6 +128,20 @@
     }
 }
 
+WebString WebDragData::filesystemId() const
+{
+    // FIXME: Should return the ID set by setFileSystemId().
+    return WebString();
+}
+
+void WebDragData::setFilesystemId(const WebString& filesystemId)
+{
+    // FIXME: The given value should be stored internally and is to be used
+    // to instantiate an isolated filesystem for providing FileSystem Entry
+    // access to the dragged files/directories.
+    // The ID is an opaque string, given by and validated by chromium port.
+}
+
 WebDragData::WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>& data)
     : m_private(static_cast<WebDragDataPrivate*>(data.leakRef()))
 {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to