Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 655153002: Grant read permission for the non-native files passed as a result of file chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index e09a455166424c011bcc28c2537ad29e99240367..e8ad3e0c52c104121a597eb57a61f01b87f24031 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -734,6 +734,10 @@ void RenderViewHostImpl::SetInitialFocus(bool reverse) {
void RenderViewHostImpl::FilesSelectedInChooser(
const std::vector<content::FileChooserFileInfo>& files,
FileChooserParams::Mode permissions) {
+ storage::FileSystemContext* const file_system_context =
+ BrowserContext::GetStoragePartition(GetProcess()->GetBrowserContext(),
+ GetSiteInstance())
+ ->GetFileSystemContext();
// Grant the security access requested to the given files.
for (size_t i = 0; i < files.size(); ++i) {
const content::FileChooserFileInfo& file = files[i];
@@ -744,6 +748,12 @@ void RenderViewHostImpl::FilesSelectedInChooser(
ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
GetProcess()->GetID(), file.file_path);
}
+ if (file.file_system_url.is_valid()) {
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFileSystem(
+ GetProcess()->GetID(),
+ file_system_context->CrackURL(file.file_system_url)
+ .mount_filesystem_id());
+ }
}
Send(new ViewMsg_RunFileChooserResponse(GetRoutingID(), files));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698