Chromium Code Reviews| Index: content/browser/renderer_host/render_view_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc |
| index f2910cedff5063a1c9d90746329e716726840547..b3e2d17bc6167e1eb761544d5ae983fb05c944ef 100644 |
| --- a/content/browser/renderer_host/render_view_host_impl.cc |
| +++ b/content/browser/renderer_host/render_view_host_impl.cc |
| @@ -518,8 +518,8 @@ void RenderViewHostImpl::DragTargetDragEnter( |
| // The filenames vector, on the other hand, does represent a capability to |
| // access the given files. |
| - std::set<FilePath> filesets; |
| - for (std::vector<WebDropData::FileInfo>::const_iterator iter( |
| + std::vector<fileapi::IsolatedContext::FileInfo> files; |
| + for (std::vector<WebDropData::FileInfo>::iterator iter( |
| filtered_data.filenames.begin()); |
| iter != filtered_data.filenames.end(); ++iter) { |
| // A dragged file may wind up as the value of an input element, or it |
| @@ -528,6 +528,14 @@ void RenderViewHostImpl::DragTargetDragEnter( |
| // and request permissions to the specific file to cover both cases. |
| // We do not give it the permission to request all file:// URLs. |
| FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(iter->path)); |
| + |
| + // Make sure we have non-empty display name. |
| + std::string name = UTF16ToUTF8(iter->display_name); |
| + if (name.empty()) { |
| + name = fileapi::IsolatedContext::GetNameForPath(path); |
| + iter->display_name = UTF8ToUTF16(name); |
| + } |
| + |
|
benwells
2012/06/29 17:41:09
Nit - should the TODO about making sure names are
kinuko
2012/07/02 13:51:54
Done in a way that adding a new helper class, File
|
| policy->GrantRequestSpecificFileURL(renderer_id, |
| net::FilePathToFileURL(path)); |
| @@ -544,14 +552,13 @@ void RenderViewHostImpl::DragTargetDragEnter( |
| policy->GrantReadDirectory(renderer_id, path); |
| } |
| - filesets.insert(path); |
| + files.push_back(fileapi::IsolatedContext::FileInfo(name, path)); |
| } |
| fileapi::IsolatedContext* isolated_context = |
| fileapi::IsolatedContext::GetInstance(); |
| DCHECK(isolated_context); |
| - std::string filesystem_id = isolated_context->RegisterIsolatedFileSystem( |
| - filesets); |
| + std::string filesystem_id = isolated_context->RegisterFileSystem(files); |
| if (!filesystem_id.empty()) { |
| // Grant the permission iff the ID is valid. |
| policy->GrantReadFileSystem(renderer_id, filesystem_id); |