diff options
author | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-07 07:30:30 +0000 |
---|---|---|
committer | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-07 07:30:30 +0000 |
commit | aebb622ac1a99e346b9b3b0a7cdbec38aafb28c5 (patch) | |
tree | c65e25a750464ddc1901d6af7c38dbdce62c5a59 /webkit/browser | |
parent | dcff6a9e09c76b79a3dfa661bcf5f217bd63c76a (diff) | |
download | chromium_src-aebb622ac1a99e346b9b3b0a7cdbec38aafb28c5.zip chromium_src-aebb622ac1a99e346b9b3b0a7cdbec38aafb28c5.tar.gz chromium_src-aebb622ac1a99e346b9b3b0a7cdbec38aafb28c5.tar.bz2 |
FileAPI: Prepare to depregate OpenFileSystem for non-sandboxed filesystems
OpenFileSystem makes sense only for sandboxed-filesystem (temporaryfs,
persistentfs and syncfs). This change prepares to deprecate it for
non-sandboxed filesystem.
This...
- removes callsites of OpenFileSystem from chromeos code, and instead calls
GetFileSystemInfoForChromeOS for now.
- Ensures non-sandboxed filesystem never calls OpenFileSystem.
BUG=297412
TEST=browser_tests
TEST=unit_tests
Review URL: https://codereview.chromium.org/25216003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
-rw-r--r-- | webkit/browser/fileapi/file_system_context.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc index fd992d0..cf21f24 100644 --- a/webkit/browser/fileapi/file_system_context.cc +++ b/webkit/browser/fileapi/file_system_context.cc @@ -279,6 +279,12 @@ void FileSystemContext::OpenFileSystem( const OpenFileSystemCallback& callback) { DCHECK(!callback.is_null()); + if (!FileSystemContext::IsSandboxFileSystem(type)) { + // Disallow opening a non-sandboxed filesystem. + callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL()); + return; + } + FileSystemBackend* backend = GetFileSystemBackend(type); if (!backend) { callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL()); @@ -295,6 +301,22 @@ void FileSystemContext::ResolveURL( DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); DCHECK(!callback.is_null()); + if (!FileSystemContext::IsSandboxFileSystem(url.type())) { +#ifdef OS_CHROMEOS + // Do not have to open a non-sandboxed filesystem. + // TODO(nhiroki): For now we assume this path is called only on ChromeOS, + // but this assumption may be broken in the future and we should handle + // more generally. http://crbug.com/304062. + FileSystemInfo info = GetFileSystemInfoForChromeOS(url.origin()); + DidOpenFileSystemForResolveURL( + url, callback, info.root_url, info.name, base::PLATFORM_FILE_OK); + return; +#endif + callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, + FileSystemInfo(), base::FilePath(), false); + return; + } + FileSystemBackend* backend = GetFileSystemBackend(url.type()); if (!backend) { callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, |