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

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

Issue 18129002: Update the child process security policy to use explicit permission grants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change RVH to use FileChooserParam mode Created 7 years, 5 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
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 c2b058414bca4b3b6057ddfb37cef3ec8558145d..5ef6ab259980b99a3abc20da558e1cff2c5075cf 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -834,12 +834,17 @@ void RenderViewHostImpl::SetInitialFocus(bool reverse) {
void RenderViewHostImpl::FilesSelectedInChooser(
const std::vector<ui::SelectedFileInfo>& files,
- int permissions) {
+ FileChooserParams::Mode permissions) {
// Grant the security access requested to the given files.
for (size_t i = 0; i < files.size(); ++i) {
const ui::SelectedFileInfo& file = files[i];
- ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile(
- GetProcess()->GetID(), file.local_path, permissions);
+ if (permissions == FileChooserParams::Save) {
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateWriteFile(
+ GetProcess()->GetID(), file.local_path);
+ } else {
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
+ GetProcess()->GetID(), file.local_path);
+ }
}
Send(new ViewMsg_RunFileChooserResponse(GetRoutingID(), files));
}
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698