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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 const int renderer_id = GetProcess()->GetID(); | 570 const int renderer_id = GetProcess()->GetID(); |
571 ChildProcessSecurityPolicyImpl* policy = | 571 ChildProcessSecurityPolicyImpl* policy = |
572 ChildProcessSecurityPolicyImpl::GetInstance(); | 572 ChildProcessSecurityPolicyImpl::GetInstance(); |
573 | 573 |
574 // The URL could have been cobbled together from any highlighted text string, | 574 // The URL could have been cobbled together from any highlighted text string, |
575 // and can't be interpreted as a capability. | 575 // and can't be interpreted as a capability. |
576 WebDropData filtered_data(drop_data); | 576 WebDropData filtered_data(drop_data); |
577 FilterURL(policy, renderer_id, true, &filtered_data.url); | 577 FilterURL(policy, renderer_id, true, &filtered_data.url); |
578 | 578 |
579 // The filenames vector, on the other hand, does represent a capability to | 579 // The filenames vector, on the other hand, does represent a capability to |
580 // access the given files. | 580 // read the given files (but not to navigate to any file:// scheme URL), |
581 std::set<FilePath> filesets; | 581 std::set<FilePath> filesets; |
582 for (std::vector<WebDropData::FileInfo>::const_iterator iter( | 582 for (std::vector<WebDropData::FileInfo>::const_iterator iter( |
583 filtered_data.filenames.begin()); | 583 filtered_data.filenames.begin()); |
584 iter != filtered_data.filenames.end(); ++iter) { | 584 iter != filtered_data.filenames.end(); ++iter) { |
585 FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(iter->path)); | 585 FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(iter->path)); |
586 policy->GrantRequestURL(renderer_id, net::FilePathToFileURL(path)); | |
587 | 586 |
588 // If the renderer already has permission to read these paths, we don't need | 587 // If the renderer already has permission to read these paths, we don't need |
589 // to re-grant them. This prevents problems with DnD for files in the CrOS | 588 // to re-grant them. This prevents problems with DnD for files in the CrOS |
590 // file manager--the file manager already had read/write access to those | 589 // file manager--the file manager already had read/write access to those |
591 // directories, but dragging a file would cause the read/write access to be | 590 // directories, but dragging a file would cause the read/write access to be |
592 // overwritten with read-only access, making them impossible to delete or | 591 // overwritten with read-only access, making them impossible to delete or |
593 // rename until the renderer was killed. | 592 // rename until the renderer was killed. |
594 if (!policy->CanReadFile(renderer_id, path)) { | 593 if (!policy->CanReadFile(renderer_id, path)) { |
595 policy->GrantReadFile(renderer_id, path); | 594 policy->GrantReadFile(renderer_id, path); |
596 // Allow dragged directories to be enumerated by the child process. | 595 // Allow dragged directories to be enumerated by the child process. |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 is_waiting_for_beforeunload_ack_ = false; | 1875 is_waiting_for_beforeunload_ack_ = false; |
1877 is_waiting_for_unload_ack_ = false; | 1876 is_waiting_for_unload_ack_ = false; |
1878 has_timed_out_on_unload_ = false; | 1877 has_timed_out_on_unload_ = false; |
1879 } | 1878 } |
1880 | 1879 |
1881 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1880 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
1882 STLDeleteValues(&power_save_blockers_); | 1881 STLDeleteValues(&power_save_blockers_); |
1883 } | 1882 } |
1884 | 1883 |
1885 } // namespace content | 1884 } // namespace content |
OLD | NEW |