| Index: ui/aura/desktop.cc
|
| diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
|
| index 07edd119e56a49ef6959963163ca607618673427..d5e3c8c0af33906888c328cf43cec49c0de809ff 100644
|
| --- a/ui/aura/desktop.cc
|
| +++ b/ui/aura/desktop.cc
|
| @@ -17,6 +17,7 @@
|
| #include "ui/aura/desktop_delegate.h"
|
| #include "ui/aura/desktop_host.h"
|
| #include "ui/aura/desktop_observer.h"
|
| +#include "ui/aura/drag_drop_controller.h"
|
| #include "ui/aura/event.h"
|
| #include "ui/aura/event_filter.h"
|
| #include "ui/aura/focus_manager.h"
|
| @@ -82,6 +83,10 @@ class DefaultDesktopDelegate : public DesktopDelegate {
|
| return NULL;
|
| }
|
|
|
| + virtual DragDropController* GetDragDropController() const OVERRIDE {
|
| + return NULL;
|
| + }
|
| +
|
| Desktop* desktop_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DefaultDesktopDelegate);
|
| @@ -221,7 +226,8 @@ Desktop::Desktop()
|
| mouse_pressed_handler_(NULL),
|
| mouse_moved_handler_(NULL),
|
| focused_window_(NULL),
|
| - touch_event_handler_(NULL) {
|
| + touch_event_handler_(NULL),
|
| + drag_drop_in_progress_(false) {
|
| set_name("RootWindow");
|
| gfx::Screen::SetInstance(screen_);
|
| host_->SetDesktop(this);
|
| @@ -296,6 +302,25 @@ bool Desktop::DispatchMouseEvent(MouseEvent* event) {
|
|
|
| last_mouse_location_ = event->location();
|
|
|
| + if (drag_drop_in_progress_) {
|
| + DCHECK(delegate_->GetDragDropController());
|
| + switch (event->type()) {
|
| + case ui::ET_MOUSE_DRAGGED:
|
| + delegate_->GetDragDropController()->DragUpdate(*event);
|
| + break;
|
| + case ui::ET_MOUSE_RELEASED:
|
| + delegate_->GetDragDropController()->Drop(*event);
|
| + case ui::ET_MOUSE_EXITED:
|
| + drag_drop_in_progress_ = false;
|
| + MessageLoop::current()->Quit();
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + break;
|
| + }
|
| + return true;
|
| + }
|
| +
|
| Window* target =
|
| mouse_pressed_handler_ ? mouse_pressed_handler_ : capture_window_;
|
| if (!target)
|
| @@ -493,6 +518,17 @@ void Desktop::SetTransform(const ui::Transform& transform) {
|
| OnHostResized(host_->GetSize());
|
| }
|
|
|
| +void Desktop::StartDragAndDrop(const ui::OSExchangeData& data, int operation) {
|
| + if (delegate_->GetDragDropController() && !drag_drop_in_progress_) {
|
| + if (capture_window_)
|
| + ReleaseCapture(capture_window_);
|
| + delegate_->GetDragDropController()->StartDragAndDrop(data, operation,
|
| + last_mouse_location_);
|
| + drag_drop_in_progress_ = true;
|
| + MessageLoopForUI::current()->RunWithDispatcher(host_.get());
|
| + }
|
| +}
|
| +
|
| void Desktop::HandleMouseMoved(const MouseEvent& event, Window* target) {
|
| if (target == mouse_moved_handler_)
|
| return;
|
|
|