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

Unified Diff: ui/aura_shell/desktop_event_filter.cc

Issue 8450018: First shot at implementing drag&drop for Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added missing test file Created 9 years, 1 month 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/aura_shell/desktop_event_filter.cc
diff --git a/ui/aura_shell/desktop_event_filter.cc b/ui/aura_shell/desktop_event_filter.cc
index 3d17865b069be2301f74e71ef5d8e3276089f845..4800d046e8f620404837abb338c38337af99898f 100644
--- a/ui/aura_shell/desktop_event_filter.cc
+++ b/ui/aura_shell/desktop_event_filter.cc
@@ -4,6 +4,7 @@
#include "ui/aura_shell/desktop_event_filter.h"
+#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/focus_manager.h"
@@ -59,6 +60,28 @@ bool DesktopEventFilter::PreHandleKeyEvent(aura::Window* target,
bool DesktopEventFilter::PreHandleMouseEvent(aura::Window* target,
aura::MouseEvent* event) {
+
+ // Give all events to the drag/drop controller is a drag/drop is in progress.
Ben Goodger (Google) 2011/11/11 17:26:53 Move this whole section to a separate function Han
varunjain 2011/11/15 19:39:33 Done.
+ aura::DragDropClient* drag_drop_client =
+ aura::Desktop::GetInstance()->drag_drop_client();
+ if (drag_drop_client && drag_drop_client->IsDragAndDropInProgress()) {
+ switch (event->type()) {
+ case ui::ET_MOUSE_DRAGGED:
+ drag_drop_client->DragUpdate(target, *event);
+ break;
+ case ui::ET_MOUSE_RELEASED:
+ drag_drop_client->Drop(target, *event);
+ break;
+ case ui::ET_MOUSE_EXITED:
+ drag_drop_client->DragCancel();
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+ return true;
+ }
+
switch (event->type()) {
case ui::ET_MOUSE_PRESSED:
ActivateIfNecessary(target, event);

Powered by Google App Engine
This is Rietveld 408576698