Index: webkit/fileapi/file_system_url.cc |
diff --git a/webkit/fileapi/file_system_url.cc b/webkit/fileapi/file_system_url.cc |
index b69eda1d44f34eebd25e8038660f4edb1e952bab..90706bf5d87b9cbb3efd73eed26509ec7b8f00e7 100644 |
--- a/webkit/fileapi/file_system_url.cc |
+++ b/webkit/fileapi/file_system_url.cc |
@@ -42,6 +42,7 @@ bool CrackFileSystemURL( |
{ kFileSystemTypeExternal, kExternalDir }, |
{ kFileSystemTypeTest, kTestDir }, |
}; |
+ |
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kValidTypes); ++i) { |
if (StartsWithASCII(inner_path, kValidTypes[i].dir, true)) { |
file_system_type = kValidTypes[i].type; |
@@ -80,25 +81,63 @@ bool CrackFileSystemURL( |
} // namespace |
FileSystemURL::FileSystemURL() |
- : type_(kFileSystemTypeUnknown), |
- mount_type_(kFileSystemTypeUnknown), |
- is_valid_(false) {} |
+ : is_valid_(false), |
+ is_cracked_(false), |
+ type_(kFileSystemTypeUnknown), |
+ mount_type_(kFileSystemTypeUnknown) { |
+} |
FileSystemURL::FileSystemURL(const GURL& url) |
- : type_(kFileSystemTypeUnknown) { |
- is_valid_ = CrackFileSystemURL(url, &origin_, &type_, &virtual_path_); |
- MayCrackIsolatedPath(); |
+ : is_cracked_(false), |
+ type_(kFileSystemTypeUnknown), |
+ mount_type_(kFileSystemTypeUnknown) { |
+ is_valid_ = CrackFileSystemURL(url, &origin_, &type_, &path_); |
+ mount_type_ = type_; |
+ virtual_path_ = path_; |
} |
-FileSystemURL::FileSystemURL( |
- const GURL& origin, |
- FileSystemType type, |
- const FilePath& path) |
- : origin_(origin), |
+FileSystemURL::FileSystemURL(const GURL& origin, |
+ FileSystemType type, |
+ const FilePath& path) |
+ : is_valid_(true), |
+ is_cracked_(false), |
+ origin_(origin), |
type_(type), |
- virtual_path_(path.NormalizePathSeparators()), |
- is_valid_(true) { |
- MayCrackIsolatedPath(); |
+ path_(path.NormalizePathSeparators()), |
+ mount_type_(type), |
+ virtual_path_(path) { |
+} |
+ |
+// static |
+FileSystemURL FileSystemURL::CreateForCrackedURL( |
+ const FileSystemURL& original, |
+ const std::string& filesystem_id, |
+ FileSystemType cracked_type, |
+ const FilePath& cracked_path) { |
+ if (!original.is_valid()) |
+ return FileSystemURL(); |
+ return FileSystemURL(original.origin(), |
+ original.type(), |
+ original.path(), |
+ filesystem_id, |
+ cracked_type, |
+ cracked_path); |
+} |
+ |
+FileSystemURL::FileSystemURL(const GURL& origin, |
+ FileSystemType original_type, |
+ const FilePath& original_path, |
+ const std::string& filesystem_id, |
+ FileSystemType cracked_type, |
+ const FilePath& cracked_path) |
+ : is_valid_(true), |
+ is_cracked_(true), |
+ origin_(origin), |
+ type_(cracked_type), |
+ path_(cracked_path.NormalizePathSeparators()), |
+ filesystem_id_(filesystem_id), |
+ mount_type_(original_type), |
+ virtual_path_(original_path) { |
} |
FileSystemURL::~FileSystemURL() {} |
@@ -153,19 +192,4 @@ bool FileSystemURL::Comparator::operator()(const FileSystemURL& lhs, |
return lhs.path_ < rhs.path_; |
} |
-void FileSystemURL::MayCrackIsolatedPath() { |
- path_ = virtual_path_; |
- mount_type_ = type_; |
- if (is_valid_ && IsolatedContext::IsIsolatedType(type_)) { |
- // If the type is isolated, crack the path further to get the 'real' |
- // filesystem type and path. |
- is_valid_ = ExternalMountPoints::GetSystemInstance()->CrackVirtualPath( |
- virtual_path_, &filesystem_id_, &type_, &path_); |
- if (is_valid_) |
- return; |
- is_valid_ = IsolatedContext::GetInstance()->CrackVirtualPath( |
- virtual_path_, &filesystem_id_, &type_, &path_); |
- } |
-} |
- |
} // namespace fileapi |