| 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 a26e5841ed080501ffdc36a023cea8a21701e0a2..26341a2460c8e2b72d93191099e3ad5491fa629b 100644
|
| --- a/content/browser/renderer_host/render_view_host_impl.cc
|
| +++ b/content/browser/renderer_host/render_view_host_impl.cc
|
| @@ -80,6 +80,7 @@
|
| #include "net/url_request/url_request_context_getter.h"
|
| #include "storage/browser/fileapi/isolated_context.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| +#include "ui/base/clipboard/clipboard.h"
|
| #include "ui/base/touch/touch_device.h"
|
| #include "ui/base/touch/touch_enabled.h"
|
| #include "ui/base/ui_base_switches.h"
|
| @@ -164,6 +165,56 @@ void GetWindowsSpecificPrefs(RendererPreferences* prefs) {
|
| }
|
| #endif
|
|
|
| +void DropDataToMetaData(const DropData& drop_data,
|
| + std::vector<MimeTypeKindPair>& meta_data) {
|
| + base::string16 string_kind = base::ASCIIToUTF16("string");
|
| + base::string16 filename_kind = base::ASCIIToUTF16("filename");
|
| + base::string16 filesystemfile_kind = base::ASCIIToUTF16("filesystemfile");
|
| + if (!drop_data.text.is_null()) {
|
| + MimeTypeKindPair pair = std::make_pair(
|
| + base::ASCIIToUTF16(ui::Clipboard::kMimeTypeText), string_kind);
|
| + meta_data.push_back(pair);
|
| + }
|
| +
|
| + if (!drop_data.url.is_empty()) {
|
| + MimeTypeKindPair pair = std::make_pair(
|
| + base::ASCIIToUTF16(ui::Clipboard::kMimeTypeURIList), string_kind);
|
| + meta_data.push_back(pair);
|
| + }
|
| +
|
| + if (!drop_data.html.is_null()) {
|
| + MimeTypeKindPair pair = std::make_pair(
|
| + base::ASCIIToUTF16(ui::Clipboard::kMimeTypeHTML), string_kind);
|
| + meta_data.push_back(pair);
|
| + }
|
| +
|
| + for (std::vector<ui::FileInfo>::const_iterator it =
|
| + drop_data.filenames.begin();
|
| + it != drop_data.filenames.end(); ++it) {
|
| + if (!it->path.empty()) {
|
| + MimeTypeKindPair pair = std::make_pair(base::string16(), filename_kind);
|
| + meta_data.push_back(pair);
|
| + }
|
| + }
|
| +
|
| + for (std::vector<DropData::FileSystemFileInfo>::const_iterator it =
|
| + drop_data.file_system_files.begin();
|
| + it != drop_data.file_system_files.end(); ++it) {
|
| + if (!it->url.is_empty()) {
|
| + MimeTypeKindPair pair =
|
| + std::make_pair(base::string16(), filesystemfile_kind);
|
| + meta_data.push_back(pair);
|
| + }
|
| + }
|
| +
|
| + for (std::map<base::string16, base::string16>::const_iterator it =
|
| + drop_data.custom_data.begin();
|
| + it != drop_data.custom_data.end(); ++it) {
|
| + MimeTypeKindPair pair = std::make_pair(it->first, string_kind);
|
| + meta_data.push_back(pair);
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -680,7 +731,9 @@ void RenderViewHostImpl::DragTargetDragEnter(
|
| .append(register_name));
|
| }
|
|
|
| - Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt,
|
| + std::vector<MimeTypeKindPair> meta_data;
|
| + DropDataToMetaData(filtered_data, meta_data);
|
| + Send(new DragMsg_TargetDragEnter(GetRoutingID(), meta_data, client_pt,
|
| screen_pt, operations_allowed,
|
| key_modifiers));
|
| }
|
| @@ -698,11 +751,13 @@ void RenderViewHostImpl::DragTargetDragLeave() {
|
| Send(new DragMsg_TargetDragLeave(GetRoutingID()));
|
| }
|
|
|
| -void RenderViewHostImpl::DragTargetDrop(
|
| - const gfx::Point& client_pt,
|
| - const gfx::Point& screen_pt,
|
| - int key_modifiers) {
|
| - Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt, screen_pt,
|
| +void RenderViewHostImpl::DragTargetDrop(const DropData& drop_data,
|
| + const gfx::Point& client_pt,
|
| + const gfx::Point& screen_pt,
|
| + int key_modifiers) {
|
| + // TODO(hush): filter the drop_data like what's done in DragTargetDragEnter if
|
| + // drop data is valid.
|
| + Send(new DragMsg_TargetDrop(GetRoutingID(), drop_data, client_pt, screen_pt,
|
| key_modifiers));
|
| }
|
|
|
|
|