parent
e96f9c06f0
commit
5b507cc562
1 changed files with 8 additions and 7 deletions
|
@ -84,22 +84,23 @@ std::string RegisterFileSystem(content::WebContents* web_contents,
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
auto* isolated_context = storage::IsolatedContext::GetInstance();
|
auto* isolated_context = storage::IsolatedContext::GetInstance();
|
||||||
std::string root_name(kRootName);
|
std::string root_name(kRootName);
|
||||||
std::string file_system_id = isolated_context->RegisterFileSystemForPath(
|
storage::IsolatedContext::ScopedFSHandle file_system =
|
||||||
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
|
isolated_context->RegisterFileSystemForPath(
|
||||||
|
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
|
||||||
|
|
||||||
content::ChildProcessSecurityPolicy* policy =
|
content::ChildProcessSecurityPolicy* policy =
|
||||||
content::ChildProcessSecurityPolicy::GetInstance();
|
content::ChildProcessSecurityPolicy::GetInstance();
|
||||||
content::RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
|
content::RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
|
||||||
int renderer_id = render_view_host->GetProcess()->GetID();
|
int renderer_id = render_view_host->GetProcess()->GetID();
|
||||||
policy->GrantReadFileSystem(renderer_id, file_system_id);
|
policy->GrantReadFileSystem(renderer_id, file_system.id());
|
||||||
policy->GrantWriteFileSystem(renderer_id, file_system_id);
|
policy->GrantWriteFileSystem(renderer_id, file_system.id());
|
||||||
policy->GrantCreateFileForFileSystem(renderer_id, file_system_id);
|
policy->GrantCreateFileForFileSystem(renderer_id, file_system.id());
|
||||||
policy->GrantDeleteFromFileSystem(renderer_id, file_system_id);
|
policy->GrantDeleteFromFileSystem(renderer_id, file_system.id());
|
||||||
|
|
||||||
if (!policy->CanReadFile(renderer_id, path))
|
if (!policy->CanReadFile(renderer_id, path))
|
||||||
policy->GrantReadFile(renderer_id, path);
|
policy->GrantReadFile(renderer_id, path);
|
||||||
|
|
||||||
return file_system_id;
|
return file_system.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystem CreateFileSystemStruct(content::WebContents* web_contents,
|
FileSystem CreateFileSystemStruct(content::WebContents* web_contents,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue