Index: content/browser/web_contents/web_drag_dest_win.cc |
diff --git a/content/browser/web_contents/web_drag_dest_win.cc b/content/browser/web_contents/web_drag_dest_win.cc |
index 9e5aed3e0e3fa80e11b8d82b953df4a674524f47..8a3142d388caf1865150217fde715e6cbfd0c4dd 100644 |
--- a/content/browser/web_contents/web_drag_dest_win.cc |
+++ b/content/browser/web_contents/web_drag_dest_win.cc |
@@ -115,17 +115,18 @@ DWORD WebDragDest::OnDragEnter(IDataObject* data_object, |
// TODO(tc): PopulateWebDropData can be slow depending on what is in the |
// IDataObject. Maybe we can do this in a background thread. |
- WebDropData drop_data; |
- WebDropData::PopulateWebDropData(data_object, &drop_data); |
+ drop_data_.reset(new WebDropData()); |
+ WebDropData::PopulateWebDropData(data_object, drop_data_.get()); |
- if (drop_data.url.is_empty()) |
- ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object, &drop_data.url); |
+ if (drop_data_->url.is_empty()) |
+ ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object, |
+ &drop_data_->url); |
drag_cursor_ = WebDragOperationNone; |
POINT client_pt = cursor_position; |
ScreenToClient(GetHWND(), &client_pt); |
- web_contents_->GetRenderViewHost()->DragTargetDragEnter(drop_data, |
+ web_contents_->GetRenderViewHost()->DragTargetDragEnter(*drop_data_, |
gfx::Point(client_pt.x, client_pt.y), |
gfx::Point(cursor_position.x, cursor_position.y), |
web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects)); |
@@ -175,6 +176,8 @@ void WebDragDest::OnDragLeave(IDataObject* data_object) { |
if (delegate_) |
delegate_->OnDragLeave(data_object); |
+ |
+ drop_data_.reset(); |
} |
DWORD WebDragDest::OnDrop(IDataObject* data_object, |
@@ -205,5 +208,9 @@ DWORD WebDragDest::OnDrop(IDataObject* data_object, |
// This isn't always correct, but at least it's a close approximation. |
// For now, we always map a move to a copy to prevent potential data loss. |
DWORD drop_effect = web_drag_utils_win::WebDragOpToWinDragOp(drag_cursor_); |
- return drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY; |
+ DWORD result = drop_effect != DROPEFFECT_MOVE ? |
+ drop_effect : DROPEFFECT_COPY; |
+ |
+ drop_data_.reset(); |
+ return result; |
} |