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..903969d6962e96d87ad1b1e60c9cbaf3ca9aaed8 100644 |
| --- a/content/browser/renderer_host/render_view_host_impl.cc |
| +++ b/content/browser/renderer_host/render_view_host_impl.cc |
| @@ -519,7 +519,8 @@ void RenderViewHostImpl::DragTargetDragEnter( |
| // The filenames vector, on the other hand, does represent a capability to |
| // access the given files. |
| std::set<FilePath> filesets; |
|
tzik
2012/06/29 02:56:35
can be removed?
kinuko
2012/06/29 08:31:22
Done.
|
| - 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 +529,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); |
| + } |
| + |
| policy->GrantRequestSpecificFileURL(renderer_id, |
| net::FilePathToFileURL(path)); |
| @@ -544,14 +553,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); |