summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/android/FileSystemAndroid.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-28 11:08:34 +0100
committerBen Murdoch <benm@google.com>2010-06-02 11:22:40 +0100
commit10bcdb2eab81b5b9c893faf90f5bd9f396edeb4a (patch)
tree6a2fd233d940d82cbb96bc1be23b09860af5811d /WebCore/platform/android/FileSystemAndroid.cpp
parentc05b3a990126a5a1de357c025e25e6acd4e4e185 (diff)
downloadexternal_webkit-10bcdb2eab81b5b9c893faf90f5bd9f396edeb4a.zip
external_webkit-10bcdb2eab81b5b9c893faf90f5bd9f396edeb4a.tar.gz
external_webkit-10bcdb2eab81b5b9c893faf90f5bd9f396edeb4a.tar.bz2
Enable File Reader and blob.slice APIs.
Notes: - the change to WebCore/html/FileStream.cpp is a cherry pick of http://trac.webkit.org/changeset/60325 - the change to WebCore/platform/posix/FileSystemPOSIX.cpp is a cherry pick of http://trac.webkit.org/changeset/60374 - this needs a corresponding frameworks/base change Change-Id: I05d1496e1e95adf1c6a61c6f07bbf62e9bc92820
Diffstat (limited to 'WebCore/platform/android/FileSystemAndroid.cpp')
-rw-r--r--WebCore/platform/android/FileSystemAndroid.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/WebCore/platform/android/FileSystemAndroid.cpp b/WebCore/platform/android/FileSystemAndroid.cpp
index cf9830e..3513958 100644
--- a/WebCore/platform/android/FileSystemAndroid.cpp
+++ b/WebCore/platform/android/FileSystemAndroid.cpp
@@ -46,6 +46,12 @@ String sPluginPath;
CString fileSystemRepresentation(const String& path)
{
+ // If the path is a content:// URI then ask Java to resolve it for us.
+ if (path.startsWith("content://"))
+ return PlatformBridge::resolveFilePathForContentUri(path).utf8();
+ else if (path.startsWith("file://"))
+ return path.substring(strlen("file://")).utf8();
+
return path.utf8();
}
@@ -107,13 +113,15 @@ Vector<String> listDirectory(const String& path, const String& filter)
return entries;
}
+// We define our own pathGetFileName rather than use the POSIX versions as we
+// may get passed a content URI representing the path to the file. We pass
+// the input through fileSystemRepresentation before using it to resolve it if
+// it is a content URI.
String pathGetFileName(const String& path)
{
- // If the path is a content:// URI then ask Java to resolve it for us.
- if (path.startsWith("content://"))
- return PlatformBridge::resolveFileNameForContentUri(path);
- else
- return path.substring(path.reverseFind('/') + 1);
+ CString fsRep = fileSystemRepresentation(path);
+ String fsPath = String(fsRep.data());
+ return fsPath.substring(fsPath.reverseFind('/') + 1);
}