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

Unified Diff: ui/aura_shell/drag_drop_controller.cc

Issue 8682029: Make drag and drop work on webpage. Also slightly modify drag drop workflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: modified according to comments 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
« no previous file with comments | « ui/aura_shell/drag_drop_controller.h ('k') | ui/aura_shell/drag_drop_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/drag_drop_controller.cc
diff --git a/ui/aura_shell/drag_drop_controller.cc b/ui/aura_shell/drag_drop_controller.cc
index 1de646a62d69a68cb00540ce0417a5258088e562..7d08eb370c7486ae14800e693df6d614891abdfc 100644
--- a/ui/aura_shell/drag_drop_controller.cc
+++ b/ui/aura_shell/drag_drop_controller.cc
@@ -55,7 +55,7 @@ DragDropController::~DragDropController() {
Cleanup();
}
-void DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
+int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
int operation) {
DCHECK(!drag_drop_in_progress_);
aura::Window* capture_window = Desktop::GetInstance()->capture_window();
@@ -75,12 +75,13 @@ void DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
drag_image_->GetPreferredSize()));
drag_image_->SetWidgetVisible(true);
- dragged_window_ = Desktop::GetInstance()->GetEventHandlerForPoint(location);
+ dragged_window_ = NULL;
if (should_block_during_drag_drop_) {
MessageLoopForUI::current()->RunWithDispatcher(
Desktop::GetInstance()->GetDispatcher());
}
+ return drag_operation_;
}
void DragDropController::DragUpdate(aura::Window* target,
@@ -92,18 +93,15 @@ void DragDropController::DragUpdate(aura::Window* target,
dragged_window_ = target;
if ((delegate = GetDragDropDelegate(dragged_window_))) {
aura::DropTargetEvent e(*drag_data_, event.location(), drag_operation_);
- if (delegate->CanDrop(e))
- delegate->OnDragEntered(e);
+ delegate->OnDragEntered(e);
}
} else {
if ((delegate = GetDragDropDelegate(dragged_window_))) {
aura::DropTargetEvent e(*drag_data_, event.location(), drag_operation_);
- delegate->OnDragUpdated(e);
- // TODO(varunjain): uncomment the following lines when cursor issue with
- // X for tests is fixed.
- // gfx::NativeCursor cursor = (op == ui::DragDropTypes::DRAG_NONE)?
- // aura::kCursorMove : aura::kCursorHand;
- // Desktop::GetInstance()->SetCursor(cursor);
+ int op = delegate->OnDragUpdated(e);
+ gfx::NativeCursor cursor = (op == ui::DragDropTypes::DRAG_NONE)?
+ aura::kCursorMove : aura::kCursorHand;
+ Desktop::GetInstance()->SetCursor(cursor);
}
}
@@ -120,9 +118,8 @@ void DragDropController::Drop(aura::Window* target,
DCHECK(target == dragged_window_);
if ((delegate = GetDragDropDelegate(dragged_window_))) {
aura::DropTargetEvent e(*drag_data_, event.location(), drag_operation_);
- if (delegate->CanDrop(e))
- delegate->OnPerformDrop(e);
- // TODO(varunjain): else Do drag widget flying back animation
+ drag_operation_ = delegate->OnPerformDrop(e);
+ // TODO(varunjain): if drag_op is 0, do drag widget flying back animation
}
Cleanup();
@@ -133,10 +130,15 @@ void DragDropController::Drop(aura::Window* target,
void DragDropController::DragCancel() {
// TODO(varunjain): Do drag widget flying back animation
Cleanup();
+ drag_operation_ = 0;
if (should_block_during_drag_drop_)
MessageLoop::current()->Quit();
}
+bool DragDropController::IsDragDropInProgress() {
+ return drag_drop_in_progress_;
+}
+
bool DragDropController::PreHandleKeyEvent(aura::Window* target,
aura::KeyEvent* event) {
return false;
@@ -175,7 +177,6 @@ ui::TouchStatus DragDropController::PreHandleTouchEvent(
void DragDropController::Cleanup() {
drag_image_.reset();
drag_data_ = NULL;
- drag_operation_ = 0;
drag_drop_in_progress_ = false;
}
« no previous file with comments | « ui/aura_shell/drag_drop_controller.h ('k') | ui/aura_shell/drag_drop_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698