Index: Source/modules/filesystem/DOMFileSystemBase.cpp |
diff --git a/Source/modules/filesystem/DOMFileSystemBase.cpp b/Source/modules/filesystem/DOMFileSystemBase.cpp |
index f63b5079e253f4b426f1f783e461923fa5088e05..702405139f474d81a655ccae8f9d3aba54b747f6 100644 |
--- a/Source/modules/filesystem/DOMFileSystemBase.cpp |
+++ b/Source/modules/filesystem/DOMFileSystemBase.cpp |
@@ -96,19 +96,34 @@ bool DOMFileSystemBase::crackFileSystemURL(const KURL& url, FileSystemType& type |
return false; |
String typeString = url.innerURL()->path().substring(1); |
- if (typeString == temporaryPathPrefix) |
- type = FileSystemTypeTemporary; |
- else if (typeString == persistentPathPrefix) |
- type = FileSystemTypePersistent; |
- else if (typeString == externalPathPrefix) |
- type = FileSystemTypeExternal; |
- else |
+ if (!pathPrefixToFileSystemType(typeString, type)) |
return false; |
filePath = decodeURLEscapeSequences(url.path()); |
return true; |
} |
+KURL DOMFileSystemBase::createFileSystemRootURL(const String& origin, FileSystemType type) |
+{ |
+ String typeString; |
+ if (type == FileSystemTypeTemporary) |
+ typeString = temporaryPathPrefix; |
+ else if (type == FileSystemTypePersistent) |
+ typeString = persistentPathPrefix; |
+ else if (type == FileSystemTypeExternal) |
+ typeString = externalPathPrefix; |
+ else |
+ return KURL(); |
+ |
+ StringBuilder result; |
+ result.append("filesystem:"); |
+ result.append(origin); |
+ result.append("/"); |
+ result.append(typeString); |
+ result.append("/"); |
abarth-chromium
2013/09/13 17:33:01
You should use use operator+ as follows:
String r
nhiroki
2013/09/16 16:36:07
Done.
|
+ return KURL(ParsedURLString, result.toString()); |
+} |
+ |
bool DOMFileSystemBase::supportsToURL() const |
{ |
ASSERT(isValidType(m_type)); |
@@ -145,6 +160,39 @@ KURL DOMFileSystemBase::createFileSystemURL(const String& fullPath) const |
return url; |
} |
+bool DOMFileSystemBase::pathToAbsolutePath(FileSystemType type, const EntryBase* base, String path, String& absolutePath) |
+{ |
+ ASSERT(base); |
+ |
+ if (!DOMFilePath::isAbsolute(path)) |
+ path = DOMFilePath::append(base->fullPath(), path); |
+ absolutePath = DOMFilePath::removeExtraParentReferences(path); |
+ |
+ if ((type == FileSystemTypeTemporary || type == FileSystemTypePersistent) && !DOMFilePath::isValidPath(absolutePath)) |
+ return false; |
+ return true; |
abarth-chromium
2013/09/13 17:33:01
There's no need to write "return false" or "return
nhiroki
2013/09/16 16:36:07
Done.
|
+} |
+ |
+bool DOMFileSystemBase::pathPrefixToFileSystemType(const String& pathPrefix, FileSystemType& type) |
+{ |
+ if (pathPrefix == temporaryPathPrefix) { |
+ type = FileSystemTypeTemporary; |
+ return true; |
+ } |
+ |
+ if (pathPrefix == persistentPathPrefix) { |
+ type = FileSystemTypePersistent; |
+ return true; |
+ } |
+ |
+ if (pathPrefix == externalPathPrefix) { |
+ type = FileSystemTypeExternal; |
+ return true; |
+ } |
+ |
+ return false; |
+} |
+ |
bool DOMFileSystemBase::getMetadata(const EntryBase* entry, PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, SynchronousType synchronousType) |
{ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(successCallback, errorCallback, this)); |
@@ -182,19 +230,6 @@ static bool verifyAndGetDestinationPathForCopyOrMove(const EntryBase* source, En |
return true; |
} |
-static bool pathToAbsolutePath(FileSystemType type, const EntryBase* base, String path, String& absolutePath) |
-{ |
- ASSERT(base); |
- |
- if (!DOMFilePath::isAbsolute(path)) |
- path = DOMFilePath::append(base->fullPath(), path); |
- absolutePath = DOMFilePath::removeExtraParentReferences(path); |
- |
- if ((type == FileSystemTypeTemporary || type == FileSystemTypePersistent) && !DOMFilePath::isValidPath(absolutePath)) |
- return false; |
- return true; |
-} |
- |
bool DOMFileSystemBase::move(const EntryBase* source, EntryBase* parent, const String& newName, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, SynchronousType synchronousType) |
{ |
String destinationPath; |