OLD | NEW |
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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 } | 1449 } |
1450 #endif | 1450 #endif |
1451 } | 1451 } |
1452 | 1452 |
1453 bool RenderViewHostImpl::CanAccessFilesOfPageState( | 1453 bool RenderViewHostImpl::CanAccessFilesOfPageState( |
1454 const PageState& state) const { | 1454 const PageState& state) const { |
1455 ChildProcessSecurityPolicyImpl* policy = | 1455 ChildProcessSecurityPolicyImpl* policy = |
1456 ChildProcessSecurityPolicyImpl::GetInstance(); | 1456 ChildProcessSecurityPolicyImpl::GetInstance(); |
1457 | 1457 |
1458 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); | 1458 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); |
1459 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); | 1459 for (const auto& file : file_paths) { |
1460 file != file_paths.end(); ++file) { | 1460 if (!policy->CanReadFile(GetProcess()->GetID(), file)) |
1461 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) | |
1462 return false; | 1461 return false; |
1463 } | 1462 } |
1464 return true; | 1463 return true; |
1465 } | 1464 } |
1466 | 1465 |
| 1466 void RenderViewHostImpl::GrantFileAccessFromPageState(const PageState& state) { |
| 1467 ChildProcessSecurityPolicyImpl* policy = |
| 1468 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 1469 |
| 1470 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); |
| 1471 for (const auto& file : file_paths) { |
| 1472 if (!policy->CanReadFile(GetProcess()->GetID(), file)) |
| 1473 policy->GrantReadFile(GetProcess()->GetID(), file); |
| 1474 } |
| 1475 } |
| 1476 |
1467 void RenderViewHostImpl::AttachToFrameTree() { | 1477 void RenderViewHostImpl::AttachToFrameTree() { |
1468 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1478 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1469 | 1479 |
1470 frame_tree->ResetForMainFrameSwap(); | 1480 frame_tree->ResetForMainFrameSwap(); |
1471 } | 1481 } |
1472 | 1482 |
1473 void RenderViewHostImpl::SelectWordAroundCaret() { | 1483 void RenderViewHostImpl::SelectWordAroundCaret() { |
1474 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1484 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1475 } | 1485 } |
1476 | 1486 |
1477 } // namespace content | 1487 } // namespace content |
OLD | NEW |