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

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

Issue 6623015: Add a path for a web page to request the enumeration of a directory. This, t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | « content/browser/renderer_host/render_view_host.h ('k') | content/common/view_messages.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // Grant the renderer the ability to load the drop_data. 456 // Grant the renderer the ability to load the drop_data.
457 ChildProcessSecurityPolicy* policy = 457 ChildProcessSecurityPolicy* policy =
458 ChildProcessSecurityPolicy::GetInstance(); 458 ChildProcessSecurityPolicy::GetInstance();
459 policy->GrantRequestURL(process()->id(), drop_data.url); 459 policy->GrantRequestURL(process()->id(), drop_data.url);
460 for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin()); 460 for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin());
461 iter != drop_data.filenames.end(); ++iter) { 461 iter != drop_data.filenames.end(); ++iter) {
462 FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); 462 FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter));
463 policy->GrantRequestURL(process()->id(), 463 policy->GrantRequestURL(process()->id(),
464 net::FilePathToFileURL(path)); 464 net::FilePathToFileURL(path));
465 policy->GrantReadFile(process()->id(), path); 465 policy->GrantReadFile(process()->id(), path);
466
467 // Allow dragged directories to be enumerated by the child process.
468 // Note that we can't tell a file from a directory at this point.
469 policy->GrantReadDirectory(process()->id(), path);
466 } 470 }
467 Send(new DragMsg_TargetDragEnter(routing_id(), drop_data, client_pt, 471 Send(new DragMsg_TargetDragEnter(routing_id(), drop_data, client_pt,
468 screen_pt, operations_allowed)); 472 screen_pt, operations_allowed));
469 } 473 }
470 474
471 void RenderViewHost::DragTargetDragOver( 475 void RenderViewHost::DragTargetDragOver(
472 const gfx::Point& client_pt, const gfx::Point& screen_pt, 476 const gfx::Point& client_pt, const gfx::Point& screen_pt,
473 WebDragOperationsMask operations_allowed) { 477 WebDragOperationsMask operations_allowed) {
474 Send(new DragMsg_TargetDragOver(routing_id(), client_pt, screen_pt, 478 Send(new DragMsg_TargetDragOver(routing_id(), client_pt, screen_pt,
475 operations_allowed)); 479 operations_allowed));
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 const std::vector<FilePath>& files) { 682 const std::vector<FilePath>& files) {
679 // Grant the security access requested to the given files. 683 // Grant the security access requested to the given files.
680 for (std::vector<FilePath>::const_iterator file = files.begin(); 684 for (std::vector<FilePath>::const_iterator file = files.begin();
681 file != files.end(); ++file) { 685 file != files.end(); ++file) {
682 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( 686 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
683 process()->id(), *file); 687 process()->id(), *file);
684 } 688 }
685 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); 689 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files));
686 } 690 }
687 691
692 void RenderViewHost::DirectoryEnumerationFinished(
693 int request_id,
694 const std::vector<FilePath>& files) {
695 // Grant the security access requested to the given files.
696 for (std::vector<FilePath>::const_iterator file = files.begin();
697 file != files.end(); ++file) {
698 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
699 process()->id(), *file);
700 }
701 Send(new ViewMsg_EnumerateDirectoryResponse(routing_id(),
702 request_id,
703 files));
704 }
705
688 void RenderViewHost::LoadStateChanged(const GURL& url, 706 void RenderViewHost::LoadStateChanged(const GURL& url,
689 net::LoadState load_state, 707 net::LoadState load_state,
690 uint64 upload_position, 708 uint64 upload_position,
691 uint64 upload_size) { 709 uint64 upload_size) {
692 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); 710 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size);
693 } 711 }
694 712
695 bool RenderViewHost::SuddenTerminationAllowed() const { 713 bool RenderViewHost::SuddenTerminationAllowed() const {
696 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); 714 return sudden_termination_allowed_ || process()->sudden_termination_allowed();
697 } 715 }
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 LOG(DFATAL) << "Invalid checked state " << checked_state; 1646 LOG(DFATAL) << "Invalid checked state " << checked_state;
1629 return; 1647 return;
1630 } 1648 }
1631 1649
1632 CommandState state; 1650 CommandState state;
1633 state.is_enabled = is_enabled; 1651 state.is_enabled = is_enabled;
1634 state.checked_state = 1652 state.checked_state =
1635 static_cast<RenderViewCommandCheckedState>(checked_state); 1653 static_cast<RenderViewCommandCheckedState>(checked_state);
1636 command_states_[static_cast<RenderViewCommand>(command)] = state; 1654 command_states_[static_cast<RenderViewCommand>(command)] = state;
1637 } 1655 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698