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(); |