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 fd4ee683016471bfd86533d4bedc4192abdd02fe..f0ffc4c33b458e519d943844cb3fe6a844ac04a2 100644 |
| --- a/content/browser/renderer_host/render_view_host_impl.cc |
| +++ b/content/browser/renderer_host/render_view_host_impl.cc |
| @@ -63,6 +63,7 @@ |
| #include "content/public/browser/notification_types.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/render_widget_host_iterator.h" |
| +#include "content/public/browser/storage_partition.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/common/bindings_policy.h" |
| #include "content/public/common/content_constants.h" |
| @@ -783,6 +784,26 @@ void RenderViewHostImpl::DragTargetDragEnter( |
| } |
| filtered_data.filesystem_id = base::UTF8ToUTF16(filesystem_id); |
| + fileapi::FileSystemContext* file_system_context = |
| + BrowserContext::GetStoragePartition( |
| + GetProcess()->GetBrowserContext(), |
| + GetSiteInstance())->GetFileSystemContext(); |
| + for (size_t i = 0; i < filtered_data.file_system_files.size(); ++i) { |
| + fileapi::FileSystemURL file_system_url = |
|
kinuko
2014/04/21 06:08:27
Could we have a brief comment to note that this UR
hashimoto
2014/04/21 08:12:46
Done.
|
| + file_system_context->CrackURL(filtered_data.file_system_files[i].url); |
| + |
| + std::string register_name; |
| + std::string filesystem_id = isolated_context->RegisterFileSystemForPath( |
| + file_system_url.type(), file_system_url.path(), ®ister_name); |
| + policy->GrantReadFileSystem(renderer_id, filesystem_id); |
| + |
| + filtered_data.file_system_files[i].url = GURL( |
| + fileapi::GetIsolatedFileSystemRootURIString( |
| + file_system_url.origin(), |
| + filesystem_id, |
| + std::string()).append(register_name)); |
| + } |
| + |
| Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt, |
| screen_pt, operations_allowed, |
| key_modifiers)); |
| @@ -1366,6 +1387,19 @@ void RenderViewHostImpl::OnStartDragging( |
| if (policy->CanReadFile(GetProcess()->GetID(), it->path)) |
| filtered_data.filenames.push_back(*it); |
| } |
| + |
| + fileapi::FileSystemContext* file_system_context = |
| + BrowserContext::GetStoragePartition( |
| + GetProcess()->GetBrowserContext(), |
| + GetSiteInstance())->GetFileSystemContext(); |
| + filtered_data.file_system_files.clear(); |
| + for (size_t i = 0; i < drop_data.file_system_files.size(); ++i) { |
| + fileapi::FileSystemURL file_system_url = |
| + file_system_context->CrackURL(drop_data.file_system_files[i].url); |
| + if (policy->CanReadFileSystemFile(GetProcess()->GetID(), file_system_url)) |
| + filtered_data.file_system_files.push_back(drop_data.file_system_files[i]); |
|
kinuko
2014/04/21 03:31:39
This is where we start drag operation, is it right
|
| + } |
| + |
| float scale = ui::GetImageScale(GetScaleFactorForView(GetView())); |
| gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, scale)); |
| view->StartDragging(filtered_data, drag_operations_mask, image, |