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

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

Issue 11444013: Get drag and drop working for win aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years 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 | « chrome/test/base/view_event_test_base.cc ('k') | ui/aura/ui_controls_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_aura.cc
===================================================================
--- content/browser/web_contents/web_contents_view_aura.cc (revision 171879)
+++ content/browser/web_contents/web_contents_view_aura.cc (working copy)
@@ -33,16 +33,21 @@
#include "ui/aura/window_observer.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
#include "ui/base/events/event.h"
#include "ui/base/events/event_utils.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/screen.h"
#include "webkit/glue/webdropdata.h"
+#if defined(OS_WIN)
+#include "ui/base/clipboard/clipboard_util_win.h"
+#endif
+
namespace content {
WebContentsView* CreateWebContentsView(
WebContentsImpl* web_contents,
@@ -128,9 +133,9 @@
DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura);
};
-// Utility to fill a ui::OSExchangeDataProviderAura object from WebDropData.
+// Utility to fill a ui::OSExchangeDataProvider object from WebDropData.
void PrepareDragData(const WebDropData& drop_data,
- ui::OSExchangeDataProviderAura* provider) {
+ ui::OSExchangeData::Provider* provider) {
if (!drop_data.text.string().empty())
provider->SetString(drop_data.text.string());
if (drop_data.url.is_valid())
@@ -152,8 +157,13 @@
if (!drop_data.custom_data.empty()) {
Pickle pickle;
ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle);
+#if defined(OS_WIN)
+ provider->SetPickledData(
+ ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat, pickle);
+#else
provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(),
pickle);
+#endif
}
}
@@ -193,8 +203,13 @@
}
Pickle pickle;
+#if defined(OS_WIN)
+ if (data.GetPickledData(ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat,
+ &pickle))
+#else
if (data.GetPickledData(ui::Clipboard::GetWebCustomDataFormatType(),
&pickle))
+#endif
ui::ReadCustomDataIntoMap(pickle.data(), pickle.size(),
&drop_data->custom_data);
}
@@ -672,13 +687,15 @@
if (!aura::client::GetDragDropClient(root_window))
return;
- ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura;
+ ui::OSExchangeData::Provider* provider = ui::OSExchangeData::CreateProvider();
PrepareDragData(drop_data, provider);
+
+ ui::OSExchangeData data(provider); // takes ownership of |provider|.
+
if (!image.isNull()) {
- provider->set_drag_image(image);
- provider->set_drag_image_offset(image_offset);
+ drag_utils::SetDragImageOnDataObject(image,
+ gfx::Size(image.width(), image.height()), image_offset, &data);
}
- ui::OSExchangeData data(provider); // takes ownership of |provider|.
scoped_ptr<WebDragSourceAura> drag_source(
new WebDragSourceAura(GetNativeView(), web_contents_));
« no previous file with comments | « chrome/test/base/view_event_test_base.cc ('k') | ui/aura/ui_controls_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698