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

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

Issue 745053002: Grant access to files in PageState, which have already been validated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 6 years, 1 month 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 54dc97c9334af383e26865ace77ef634aa1482b6..508264555c9c22473e69025861f07a82b8b41994 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1456,14 +1456,24 @@ bool RenderViewHostImpl::CanAccessFilesOfPageState(
ChildProcessSecurityPolicyImpl::GetInstance();
const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
- for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
- file != file_paths.end(); ++file) {
- if (!policy->CanReadFile(GetProcess()->GetID(), *file))
+ for (const auto& file : file_paths) {
+ if (!policy->CanReadFile(GetProcess()->GetID(), file))
return false;
}
return true;
}
+void RenderViewHostImpl::GrantFileAccessFromPageState(const PageState& state) {
+ ChildProcessSecurityPolicyImpl* policy =
+ ChildProcessSecurityPolicyImpl::GetInstance();
+
+ const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
+ for (const auto& file : file_paths) {
+ if (!policy->CanReadFile(GetProcess()->GetID(), file))
+ policy->GrantReadFile(GetProcess()->GetID(), file);
+ }
+}
+
void RenderViewHostImpl::AttachToFrameTree() {
FrameTree* frame_tree = delegate_->GetFrameTree();

Powered by Google App Engine
This is Rietveld 408576698