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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 delegate_->LostMouseLock(); 727 delegate_->LostMouseLock();
728 } 728 }
729 729
730 void RenderViewHostImpl::SetInitialFocus(bool reverse) { 730 void RenderViewHostImpl::SetInitialFocus(bool reverse) {
731 Send(new ViewMsg_SetInitialFocus(GetRoutingID(), reverse)); 731 Send(new ViewMsg_SetInitialFocus(GetRoutingID(), reverse));
732 } 732 }
733 733
734 void RenderViewHostImpl::FilesSelectedInChooser( 734 void RenderViewHostImpl::FilesSelectedInChooser(
735 const std::vector<content::FileChooserFileInfo>& files, 735 const std::vector<content::FileChooserFileInfo>& files,
736 FileChooserParams::Mode permissions) { 736 FileChooserParams::Mode permissions) {
737 storage::FileSystemContext* const file_system_context =
738 BrowserContext::GetStoragePartition(GetProcess()->GetBrowserContext(),
739 GetSiteInstance())
740 ->GetFileSystemContext();
737 // Grant the security access requested to the given files. 741 // Grant the security access requested to the given files.
738 for (size_t i = 0; i < files.size(); ++i) { 742 for (size_t i = 0; i < files.size(); ++i) {
739 const content::FileChooserFileInfo& file = files[i]; 743 const content::FileChooserFileInfo& file = files[i];
740 if (permissions == FileChooserParams::Save) { 744 if (permissions == FileChooserParams::Save) {
741 ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile( 745 ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile(
742 GetProcess()->GetID(), file.file_path); 746 GetProcess()->GetID(), file.file_path);
743 } else { 747 } else {
744 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( 748 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
745 GetProcess()->GetID(), file.file_path); 749 GetProcess()->GetID(), file.file_path);
746 } 750 }
751 if (file.file_system_url.is_valid()) {
752 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFileSystem(
753 GetProcess()->GetID(),
754 file_system_context->CrackURL(file.file_system_url)
755 .mount_filesystem_id());
756 }
747 } 757 }
748 Send(new ViewMsg_RunFileChooserResponse(GetRoutingID(), files)); 758 Send(new ViewMsg_RunFileChooserResponse(GetRoutingID(), files));
749 } 759 }
750 760
751 void RenderViewHostImpl::DirectoryEnumerationFinished( 761 void RenderViewHostImpl::DirectoryEnumerationFinished(
752 int request_id, 762 int request_id,
753 const std::vector<base::FilePath>& files) { 763 const std::vector<base::FilePath>& files) {
754 // Grant the security access requested to the given files. 764 // Grant the security access requested to the given files.
755 for (std::vector<base::FilePath>::const_iterator file = files.begin(); 765 for (std::vector<base::FilePath>::const_iterator file = files.begin();
756 file != files.end(); ++file) { 766 file != files.end(); ++file) {
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 FrameTree* frame_tree = delegate_->GetFrameTree(); 1415 FrameTree* frame_tree = delegate_->GetFrameTree();
1406 1416
1407 frame_tree->ResetForMainFrameSwap(); 1417 frame_tree->ResetForMainFrameSwap();
1408 } 1418 }
1409 1419
1410 void RenderViewHostImpl::SelectWordAroundCaret() { 1420 void RenderViewHostImpl::SelectWordAroundCaret() {
1411 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1421 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1412 } 1422 }
1413 1423
1414 } // namespace content 1424 } // namespace content
OLDNEW
« 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