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

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: 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
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
===================================================================
--- ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (revision 171879)
+++ ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (working copy)
@@ -17,10 +17,13 @@
#include "ui/native_theme/native_theme.h"
#include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/corewm/input_method_event_filter.h"
+#include "ui/views/drag_utils.h"
#include "ui/views/ime/input_method.h"
#include "ui/views/ime/input_method_bridge.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"
@@ -133,6 +136,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);
}
@@ -394,11 +400,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) {
@@ -522,7 +530,7 @@
window_ = NULL;
native_widget_delegate_->OnNativeWidgetDestroyed();
if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
- delete this;
+ delete this;
}
void DesktopNativeWidgetAura::OnWindowTargetVisibilityChanged(bool visible) {
@@ -633,4 +641,31 @@
focus_manager->OnKeyEvent(key);
}
+////////////////////////////////////////////////////////////////////////////////
+// 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698