summaryrefslogtreecommitdiffstats
path: root/ash/drag_drop
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 19:19:58 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 19:19:58 +0000
commitf87fa53028fd2505921909b6a8169435442228c3 (patch)
tree1bdb132c9e3c14f2d724e6baa815fd4e84984585 /ash/drag_drop
parent911864d0d3a765716e8e1d4b0c1593cb560f98d1 (diff)
downloadchromium_src-f87fa53028fd2505921909b6a8169435442228c3.zip
chromium_src-f87fa53028fd2505921909b6a8169435442228c3.tar.gz
chromium_src-f87fa53028fd2505921909b6a8169435442228c3.tar.bz2
aura: Fix a couple of drag drop issues:
1. Only DragDropController should be allowed to set the cursor while a drag-drop session is in progress. 2. For some wierd reason I was cancelling drag-drop on MOUSE_EXITED event. That is clearly wrong. BUG=138694 TEST=manual Review URL: https://chromiumcodereview.appspot.com/10825143 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r--ash/drag_drop/drag_drop_controller.cc11
-rw-r--r--ash/drag_drop/drag_drop_controller.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index dd8a097..693472d 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -64,6 +64,7 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
if (capture_window)
capture_window->ReleaseCapture();
drag_drop_in_progress_ = true;
+ drag_cursor_ = ui::kCursorPointer;
drag_data_ = &data;
drag_operation_ = operation;
@@ -128,6 +129,7 @@ void DragDropController::DragUpdate(aura::Window* target,
cursor = ui::kCursorAlias;
else if (op & ui::DragDropTypes::DRAG_MOVE)
cursor = ui::kCursorMove;
+ drag_cursor_ = cursor;
ash::Shell::GetInstance()->cursor_manager()->SetCursor(cursor);
}
}
@@ -141,6 +143,7 @@ void DragDropController::DragUpdate(aura::Window* target,
void DragDropController::Drop(aura::Window* target,
const aura::LocatedEvent& event) {
+ drag_cursor_ = ui::kCursorPointer;
ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer);
aura::client::DragDropDelegate* delegate = NULL;
@@ -170,6 +173,7 @@ void DragDropController::Drop(aura::Window* target,
}
void DragDropController::DragCancel() {
+ drag_cursor_ = ui::kCursorPointer;
ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer);
// |drag_window_| can be NULL if we have just started the drag and have not
@@ -191,6 +195,10 @@ bool DragDropController::IsDragDropInProgress() {
return drag_drop_in_progress_;
}
+gfx::NativeCursor DragDropController::GetDragCursor() {
+ return drag_cursor_;
+}
+
bool DragDropController::PreHandleKeyEvent(aura::Window* target,
aura::KeyEvent* event) {
if (drag_drop_in_progress_ && event->key_code() == ui::VKEY_ESCAPE) {
@@ -211,9 +219,6 @@ bool DragDropController::PreHandleMouseEvent(aura::Window* target,
case ui::ET_MOUSE_RELEASED:
Drop(target, *event);
break;
- case ui::ET_MOUSE_EXITED:
- DragCancel();
- break;
default:
// We could reach here if the user drops outside the root window.
// We could also reach here because RootWindow may sometimes generate a
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index 22451d7..49c1aea 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -57,6 +57,7 @@ class ASH_EXPORT DragDropController
const aura::LocatedEvent& event) OVERRIDE;
virtual void DragCancel() OVERRIDE;
virtual bool IsDragDropInProgress() OVERRIDE;
+ virtual gfx::NativeCursor GetDragCursor() OVERRIDE;
// Overridden from aura::EventFilter:
virtual bool PreHandleKeyEvent(aura::Window* target,
@@ -88,6 +89,7 @@ class ASH_EXPORT DragDropController
gfx::Point drag_image_offset_;
const ui::OSExchangeData* drag_data_;
int drag_operation_;
+ gfx::NativeCursor drag_cursor_;
// Window that is currently under the drag cursor.
aura::Window* drag_window_;