diff options
author | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 02:28:11 +0000 |
---|---|---|
committer | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 02:28:11 +0000 |
commit | e38f6a4e1c4cd73dff58fc29f573f8ce36677984 (patch) | |
tree | c30bc7bb7815cd40c3c301b48a9e0661f35b3505 | |
parent | 805bab4be601e1c6fcd13d562b4b2be29fe2c142 (diff) | |
download | chromium_src-e38f6a4e1c4cd73dff58fc29f573f8ce36677984.zip chromium_src-e38f6a4e1c4cd73dff58fc29f573f8ce36677984.tar.gz chromium_src-e38f6a4e1c4cd73dff58fc29f573f8ce36677984.tar.bz2 |
Apps: Grant sufficient permissions to the filesystem opened by fileSystem API
A fileSystem opened by chrome.fileSystem API is passable to a pepper plugin[1],
but currently we cannot open any files with CREATE/TRUNCATE flag under the
filesystem in plugin-side because the filesystem doesn't have sufficient file
permissions (CREATE_OVERWRITE_FILE_PERMISSION is missing).
To fix that, this change calls GrantCreateReadWriteFileSystem() for the
filesystem instead of GrantCreateFileForFileSystem().
(NOTE) This change works fine only when choosing a directory by the API, and
the same issue still happens when choosing a file. I'll address the case in
a separate CL.
[1] http://crbug.com/177017
BUG=336160
TEST=manual (open a file with CREATE and/or TRUNCATE flag under the passed filesystem in plugin)
Review URL: https://codereview.chromium.org/146283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247596 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc index 78eb12a..9d0a5cd 100644 --- a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc +++ b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc @@ -333,10 +333,12 @@ GrantedFileEntry CreateFileEntry( content::ChildProcessSecurityPolicy::GetInstance(); policy->GrantReadFileSystem(renderer_id, result.filesystem_id); if (HasFileSystemWritePermission(extension)) { - policy->GrantWriteFileSystem(renderer_id, result.filesystem_id); - policy->GrantDeleteFromFileSystem(renderer_id, result.filesystem_id); - if (is_directory) - policy->GrantCreateFileForFileSystem(renderer_id, result.filesystem_id); + if (is_directory) { + policy->GrantCreateReadWriteFileSystem(renderer_id, result.filesystem_id); + } else { + policy->GrantWriteFileSystem(renderer_id, result.filesystem_id); + policy->GrantDeleteFromFileSystem(renderer_id, result.filesystem_id); + } } result.id = result.filesystem_id + ":" + result.registered_name; |