| Index: content/renderer/render_view_impl.cc
|
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
|
| index e66153301e131007be323524a5fb471c5d6fb51e..392e90b96329869f25f29dee1e12bdc99998a55a 100644
|
| --- a/content/renderer/render_view_impl.cc
|
| +++ b/content/renderer/render_view_impl.cc
|
| @@ -428,7 +428,8 @@ class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget {
|
| blink::WebWidget* webwidget_;
|
| };
|
|
|
| -WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| +WebDragData DropDataToWebDragData(const DropData& drop_data,
|
| + bool is_meta_data) {
|
| std::vector<WebDragData::Item> item_list;
|
|
|
| // These fields are currently unused when dragging into WebKit.
|
| @@ -440,18 +441,21 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeString;
|
| item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeText);
|
| - item.stringData = drop_data.text.string();
|
| + item.stringData = is_meta_data ? WebString::fromUTF8("")
|
| + : WebString(drop_data.text.string());
|
| item_list.push_back(item);
|
| }
|
|
|
| // TODO(dcheng): Do we need to distinguish between null and empty URLs? Is it
|
| // meaningful to write an empty URL to the clipboard?
|
| - if (!drop_data.url.is_empty()) {
|
| + if (drop_data.has_url) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeString;
|
| item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeURIList);
|
| - item.stringData = WebString::fromUTF8(drop_data.url.spec());
|
| - item.title = drop_data.url_title;
|
| + item.stringData = is_meta_data ? WebString::fromUTF8("")
|
| + : WebString::fromUTF8(drop_data.url.spec());
|
| + item.title =
|
| + is_meta_data ? WebString::fromUTF8("") : WebString(drop_data.url_title);
|
| item_list.push_back(item);
|
| }
|
|
|
| @@ -459,8 +463,9 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeString;
|
| item.stringType = WebString::fromUTF8(ui::Clipboard::kMimeTypeHTML);
|
| - item.stringData = drop_data.html.string();
|
| - item.baseURL = drop_data.html_base_url;
|
| + item.stringData = is_meta_data ? WebString::fromUTF8("")
|
| + : WebString(drop_data.html.string());
|
| + item.baseURL = is_meta_data ? GURL() : drop_data.html_base_url;
|
| item_list.push_back(item);
|
| }
|
|
|
| @@ -470,8 +475,11 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| ++it) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeFilename;
|
| - item.filenameData = it->path.AsUTF16Unsafe();
|
| - item.displayNameData = it->display_name.AsUTF16Unsafe();
|
| + item.filenameData = is_meta_data ? WebString::fromUTF8("")
|
| + : WebString(it->path.AsUTF16Unsafe());
|
| + item.displayNameData = is_meta_data
|
| + ? WebString::fromUTF8("")
|
| + : WebString(it->display_name.AsUTF16Unsafe());
|
| item_list.push_back(item);
|
| }
|
|
|
| @@ -481,8 +489,8 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| ++it) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeFileSystemFile;
|
| - item.fileSystemURL = it->url;
|
| - item.fileSystemFileSize = it->size;
|
| + item.fileSystemURL = is_meta_data ? GURL() : it->url;
|
| + item.fileSystemFileSize = is_meta_data ? 0 : it->size;
|
| item_list.push_back(item);
|
| }
|
|
|
| @@ -493,7 +501,8 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| WebDragData::Item item;
|
| item.storageType = WebDragData::Item::StorageTypeString;
|
| item.stringType = it->first;
|
| - item.stringData = it->second;
|
| + item.stringData =
|
| + is_meta_data ? WebString::fromUTF8("") : WebString(it->second);
|
| item_list.push_back(item);
|
| }
|
|
|
| @@ -501,6 +510,7 @@ WebDragData DropDataToWebDragData(const DropData& drop_data) {
|
| result.initialize();
|
| result.setItems(item_list);
|
| result.setFilesystemId(drop_data.filesystem_id);
|
| + result.setCanReadContent(!is_meta_data);
|
| return result;
|
| }
|
|
|
| @@ -2382,10 +2392,7 @@ void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data,
|
| WebDragOperationsMask ops,
|
| int key_modifiers) {
|
| WebDragOperation operation = webview()->dragTargetDragEnter(
|
| - DropDataToWebDragData(drop_data),
|
| - ConvertWindowPointToViewport(client_point),
|
| - screen_point,
|
| - ops,
|
| + DropDataToWebDragData(drop_data, true), client_point, screen_point, ops,
|
| key_modifiers);
|
|
|
| Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation));
|
| @@ -2408,11 +2415,12 @@ void RenderViewImpl::OnDragTargetDragLeave() {
|
| webview()->dragTargetDragLeave();
|
| }
|
|
|
| -void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point,
|
| +void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data,
|
| + const gfx::Point& client_point,
|
| const gfx::Point& screen_point,
|
| int key_modifiers) {
|
| - webview()->dragTargetDrop(
|
| - ConvertWindowPointToViewport(client_point), screen_point, key_modifiers);
|
| + webview()->dragTargetDrop(DropDataToWebDragData(drop_data, false),
|
| + client_point, screen_point, key_modifiers);
|
| }
|
|
|
| void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point,
|
|
|