Chromium Code Reviews| Index: webkit/fileapi/file_system_context.cc |
| diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc |
| index bf285ea29fd0873cdb4dad42e08148abf0ac12db..cf324d49705d3ac0ff1a9de079686b80d206c21d 100644 |
| --- a/webkit/fileapi/file_system_context.cc |
| +++ b/webkit/fileapi/file_system_context.cc |
| @@ -18,6 +18,7 @@ |
| #include "webkit/fileapi/file_system_util.h" |
| #include "webkit/fileapi/isolated_context.h" |
| #include "webkit/fileapi/isolated_mount_point_provider.h" |
| +#include "webkit/fileapi/mount_points.h" |
| #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| #include "webkit/fileapi/syncable/local_file_change_tracker.h" |
| #include "webkit/fileapi/syncable/local_file_sync_context.h" |
| @@ -75,13 +76,21 @@ FileSystemContext::FileSystemContext( |
| this, options.is_incognito())); |
| } |
| #if defined(OS_CHROMEOS) |
| + // TODO(tbarzic): Pass this through ctor. |
| + scoped_refptr<ExternalMountPoints> external_mount_points = |
| + ExternalMountPoints::CreateRefCounted(); |
| + // |external_provider_| will take an ownership of reference or |
|
kinuko
2013/01/18 07:33:32
will take a reference of ?
tbarzic
2013/01/18 21:33:15
Done.
|
| + // external_mount_points so this doesn't have to retain one for itself. |
| external_provider_.reset( |
| new chromeos::CrosMountPointProvider( |
| special_storage_policy, |
| - // TODO(tbarzic): Switch this to |external_mount_points_|. |
| - fileapi::ExternalMountPoints::GetSystemInstance(), |
| - fileapi::ExternalMountPoints::GetSystemInstance())); |
| + external_mount_points, |
| + ExternalMountPoints::GetSystemInstance())); |
| + url_crackers_.push_back(external_mount_points.get()); |
| #endif |
| + |
| + url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); |
| + url_crackers_.push_back(IsolatedContext::GetInstance()); |
| } |
| bool FileSystemContext::DeleteDataForOriginOnFileThread( |
| @@ -306,6 +315,18 @@ void FileSystemContext::set_sync_context( |
| sync_context_ = sync_context; |
| } |
| +FileSystemURL FileSystemContext::CrackURL(const GURL& url) const { |
| + return CrackFileSystemURL(FileSystemURL(url)); |
| +} |
| + |
| +FileSystemURL FileSystemContext::CreateCrackedFileSystemURL( |
| + const GURL& origin, |
| + FileSystemType type, |
| + const FilePath& path) const { |
| + return CrackFileSystemURL(FileSystemURL(origin, type, path)); |
| +} |
| + |
| + |
|
kinuko
2013/01/18 07:33:32
nit: extra empty line
tbarzic
2013/01/18 21:33:15
Done.
|
| FileSystemContext::~FileSystemContext() { |
| task_runners_->file_task_runner()->DeleteSoon( |
| FROM_HERE, change_tracker_.release()); |
| @@ -321,4 +342,25 @@ void FileSystemContext::DeleteOnCorrectThread() const { |
| delete this; |
| } |
| +FileSystemURL FileSystemContext::CrackFileSystemURL( |
| + const FileSystemURL& url) const { |
| + if (url.is_cracked()) |
| + return url; |
| + |
| + // The returned value in case there is no crackers which can crack the url. |
| + // This is valid situation for non isolated/external file systems. |
| + FileSystemURL result = url; |
| + |
| + for (size_t i = 0; i < url_crackers_.size(); ++i) { |
| + if (!url_crackers_[i]->CanHandleURL(url)) |
| + continue; |
| + |
| + result = url_crackers_[i]->CrackFileSystemURL(url); |
| + if (result.is_valid()) |
| + return result; |
| + } |
| + |
| + return result; |
| +} |
| + |
| } // namespace fileapi |