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 d69ead118f5b8531c642c99d7b192ad33f9c0c13..a9ab7e36ade8ccdf9451637cf68ed2685f11a296 100644 |
--- a/ui/aura_shell/desktop_event_filter.cc |
+++ b/ui/aura_shell/desktop_event_filter.cc |
@@ -4,6 +4,8 @@ |
#include "ui/aura_shell/desktop_event_filter.h" |
+#include "ui/aura/client/aura_constants.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" |
@@ -15,6 +17,30 @@ |
namespace aura_shell { |
namespace internal { |
+bool HandleDragDrop(aura::Window* target, aura::MouseEvent* event) { |
+ aura::DragDropClient* drag_drop_client = static_cast<aura::DragDropClient*>( |
+ aura::Desktop::GetInstance()->GetProperty( |
+ aura::kDesktopDragDropClientKey)); |
+ 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; |
+ } |
+ return false; |
+} |
+ |
// Returns the default cursor for a window component. |
gfx::NativeCursor CursorForWindowComponent(int window_component) { |
switch (window_component) { |
@@ -70,6 +96,11 @@ 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. |
+ if (HandleDragDrop(target, event)) |
Ben Goodger (Google)
2011/11/16 00:13:20
Now that we support addtl event filters... just mo
varunjain
2011/11/16 20:30:15
Done.
|
+ return true; |
+ |
if (FilterMouseEvent(target, event)) |
return true; |