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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 10476003: Revert 137184 - DragEnter grants both read and navigate permissions to files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 const int renderer_id = GetProcess()->GetID(); 505 const int renderer_id = GetProcess()->GetID();
506 ChildProcessSecurityPolicyImpl* policy = 506 ChildProcessSecurityPolicyImpl* policy =
507 ChildProcessSecurityPolicyImpl::GetInstance(); 507 ChildProcessSecurityPolicyImpl::GetInstance();
508 508
509 // The URL could have been cobbled together from any highlighted text string, 509 // The URL could have been cobbled together from any highlighted text string,
510 // and can't be interpreted as a capability. 510 // and can't be interpreted as a capability.
511 WebDropData filtered_data(drop_data); 511 WebDropData filtered_data(drop_data);
512 FilterURL(policy, renderer_id, true, &filtered_data.url); 512 FilterURL(policy, renderer_id, true, &filtered_data.url);
513 513
514 // The filenames vector, on the other hand, does represent a capability to 514 // The filenames vector, on the other hand, does represent a capability to
515 // read the given files (but not to navigate to any file:// scheme URL), 515 // access the given files.
516 std::set<FilePath> filesets; 516 std::set<FilePath> filesets;
517 for (std::vector<WebDropData::FileInfo>::const_iterator iter( 517 for (std::vector<WebDropData::FileInfo>::const_iterator iter(
518 filtered_data.filenames.begin()); 518 filtered_data.filenames.begin());
519 iter != filtered_data.filenames.end(); ++iter) { 519 iter != filtered_data.filenames.end(); ++iter) {
520 FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(iter->path)); 520 FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(iter->path));
521 policy->GrantRequestURL(renderer_id, net::FilePathToFileURL(path));
521 522
522 // If the renderer already has permission to read these paths, we don't need 523 // If the renderer already has permission to read these paths, we don't need
523 // to re-grant them. This prevents problems with DnD for files in the CrOS 524 // to re-grant them. This prevents problems with DnD for files in the CrOS
524 // file manager--the file manager already had read/write access to those 525 // file manager--the file manager already had read/write access to those
525 // directories, but dragging a file would cause the read/write access to be 526 // directories, but dragging a file would cause the read/write access to be
526 // overwritten with read-only access, making them impossible to delete or 527 // overwritten with read-only access, making them impossible to delete or
527 // rename until the renderer was killed. 528 // rename until the renderer was killed.
528 if (!policy->CanReadFile(renderer_id, path)) { 529 if (!policy->CanReadFile(renderer_id, path)) {
529 policy->GrantReadFile(renderer_id, path); 530 policy->GrantReadFile(renderer_id, path);
530 // Allow dragged directories to be enumerated by the child process. 531 // Allow dragged directories to be enumerated by the child process.
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 // can cause navigations to be ignored in OnMsgNavigate. 1830 // can cause navigations to be ignored in OnMsgNavigate.
1830 is_waiting_for_beforeunload_ack_ = false; 1831 is_waiting_for_beforeunload_ack_ = false;
1831 is_waiting_for_unload_ack_ = false; 1832 is_waiting_for_unload_ack_ = false;
1832 } 1833 }
1833 1834
1834 void RenderViewHostImpl::ClearPowerSaveBlockers() { 1835 void RenderViewHostImpl::ClearPowerSaveBlockers() {
1835 STLDeleteValues(&power_save_blockers_); 1836 STLDeleteValues(&power_save_blockers_);
1836 } 1837 }
1837 1838
1838 } // namespace content 1839 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698