| Index: chrome/browser/extensions/api/file_system/file_system_api.cc
|
| diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
|
| index 3288e8a9dbfccb1b06af938be06a5452b382ff32..c3c71250251315d4ac4dcef171458bd5ac568ac0 100644
|
| --- a/chrome/browser/extensions/api/file_system/file_system_api.cc
|
| +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/bind.h"
|
| #include "base/file_path.h"
|
| #include "base/file_util.h"
|
| +#include "base/logging.h"
|
| #include "base/path_service.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/extensions/shell_window_registry.h"
|
| @@ -236,6 +237,28 @@ bool FileSystemGetWritableFileEntryFunction::RunImpl() {
|
| return true;
|
| }
|
|
|
| +bool FileSystemIsWritableFileEntryFunction::RunImpl() {
|
| + std::string filesystem_name;
|
| + std::string filesystem_path;
|
| + EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &filesystem_name));
|
| + EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filesystem_path));
|
| +
|
| + std::string filesystem_id;
|
| + if (!fileapi::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) {
|
| + error_ = kInvalidParameters;
|
| + return false;
|
| + }
|
| +
|
| + content::ChildProcessSecurityPolicy* policy =
|
| + content::ChildProcessSecurityPolicy::GetInstance();
|
| + int renderer_id = render_view_host_->GetProcess()->GetID();
|
| + bool is_writable = policy->CanReadWriteFileSystem(renderer_id,
|
| + filesystem_id);
|
| +
|
| + SetResult(base::Value::CreateBooleanValue(is_writable));
|
| + return true;
|
| +}
|
| +
|
| // Handles showing a dialog to the user to ask for the filename for a file to
|
| // save or open.
|
| class FileSystemChooseFileFunction::FilePicker
|
|
|