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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 11444013: Get drag and drop working for win aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix bookmarks interactive tests since now that DRWHW::GetLocationOnNativeScreen is fixed ui_control… 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
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
===================================================================
--- ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (revision 171535)
+++ ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (working copy)
@@ -15,9 +15,12 @@
#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme.h"
+#include "ui/views/drag_utils.h"
#include "ui/views/ime/input_method.h"
#include "ui/views/widget/desktop_aura/desktop_root_window_host.h"
+#include "ui/views/widget/drop_helper.h"
#include "ui/views/widget/native_widget_aura_window_observer.h"
+#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_aura_utils.h"
@@ -111,6 +114,9 @@
desktop_root_window_host_->Init(window_, params));
stacking_client_.reset(
new DesktopNativeWidgetAuraStackingClient(root_window_.get()));
+ drop_helper_.reset(new DropHelper(
+ static_cast<internal::RootView*>(GetWidget()->GetRootView())));
+ aura::client::SetDragDropDelegate(window_, this);
aura::client::SetActivationDelegate(window_, this);
}
@@ -371,11 +377,13 @@
return false;
}
-void DesktopNativeWidgetAura::RunShellDrag(View* view,
+void DesktopNativeWidgetAura::RunShellDrag(
+ View* view,
const ui::OSExchangeData& data,
const gfx::Point& location,
int operation,
ui::DragDropTypes::DragEventSource source) {
+ views::RunShellDrag(window_, data, location, operation, source);
}
void DesktopNativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) {
@@ -597,4 +605,31 @@
GetWidget()->non_client_view()->SchedulePaint();
}
+////////////////////////////////////////////////////////////////////////////////
+// DesktopNativeWidgetAura, aura::WindowDragDropDelegate implementation:
+
+void DesktopNativeWidgetAura::OnDragEntered(const ui::DropTargetEvent& event) {
+ DCHECK(drop_helper_.get() != NULL);
+ last_drop_operation_ = drop_helper_->OnDragOver(event.data(),
+ event.location(), event.source_operations());
+}
+
+int DesktopNativeWidgetAura::OnDragUpdated(const ui::DropTargetEvent& event) {
+ DCHECK(drop_helper_.get() != NULL);
+ last_drop_operation_ = drop_helper_->OnDragOver(event.data(),
+ event.location(), event.source_operations());
+ return last_drop_operation_;
+}
+
+void DesktopNativeWidgetAura::OnDragExited() {
+ DCHECK(drop_helper_.get() != NULL);
+ drop_helper_->OnDragExit();
+}
+
+int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) {
+ DCHECK(drop_helper_.get() != NULL);
+ return drop_helper_->OnDrop(event.data(), event.location(),
+ last_drop_operation_);
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698