Chromium Code Reviews| 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..6d254684d949e8856109c098dac0935f05048764 100644 |
| --- a/content/browser/web_contents/web_drag_dest_win.cc |
| +++ b/content/browser/web_contents/web_drag_dest_win.cc |
| @@ -115,17 +115,19 @@ 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 +177,8 @@ void WebDragDest::OnDragLeave(IDataObject* data_object) { |
| if (delegate_) |
| delegate_->OnDragLeave(data_object); |
| + |
| + drop_data_.reset(); |
| } |
| DWORD WebDragDest::OnDrop(IDataObject* data_object, |
| @@ -202,6 +206,8 @@ DWORD WebDragDest::OnDrop(IDataObject* data_object, |
| current_rvh_ = NULL; |
| + drop_data_.reset(); |
|
Aaron Boodman
2012/05/07 18:50:33
I'm not sure if this is needed, or if OnDragLeave
|
| + |
| // 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_); |