Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: content/browser/web_contents/web_drag_dest_win.cc

Issue 10310056: Implement WebContentsViewWin::GetDropData() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_drag_dest_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « content/browser/web_contents/web_drag_dest_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698