| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
| 6 | 6 |
| 7 #include "ash/drag_drop/drag_image_view.h" | 7 #include "ash/drag_drop/drag_image_view.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "ui/aura/client/drag_drop_delegate.h" | 10 #include "ui/aura/client/drag_drop_delegate.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (drag_operation_ == 0) | 142 if (drag_operation_ == 0) |
| 143 StartCanceledAnimation(); | 143 StartCanceledAnimation(); |
| 144 else | 144 else |
| 145 drag_image_.reset(); | 145 drag_image_.reset(); |
| 146 } else { | 146 } else { |
| 147 drag_image_.reset(); | 147 drag_image_.reset(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 Cleanup(); | 150 Cleanup(); |
| 151 if (should_block_during_drag_drop_) | 151 if (should_block_during_drag_drop_) |
| 152 MessageLoop::current()->Quit(); | 152 MessageLoop::current()->QuitNow(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void DragDropController::DragCancel() { | 155 void DragDropController::DragCancel() { |
| 156 Shell::GetRootWindow()->SetCursor(ui::kCursorPointer); | 156 Shell::GetRootWindow()->SetCursor(ui::kCursorPointer); |
| 157 | 157 |
| 158 // |drag_window_| can be NULL if we have just started the drag and have not | 158 // |drag_window_| can be NULL if we have just started the drag and have not |
| 159 // received any DragUpdates, or, if the |drag_window_| gets destroyed during | 159 // received any DragUpdates, or, if the |drag_window_| gets destroyed during |
| 160 // a drag/drop. | 160 // a drag/drop. |
| 161 aura::client::DragDropDelegate* delegate = drag_window_? | 161 aura::client::DragDropDelegate* delegate = drag_window_? |
| 162 aura::client::GetDragDropDelegate(drag_window_) : NULL; | 162 aura::client::GetDragDropDelegate(drag_window_) : NULL; |
| 163 if (delegate) | 163 if (delegate) |
| 164 delegate->OnDragExited(); | 164 delegate->OnDragExited(); |
| 165 | 165 |
| 166 Cleanup(); | 166 Cleanup(); |
| 167 drag_operation_ = 0; | 167 drag_operation_ = 0; |
| 168 StartCanceledAnimation(); | 168 StartCanceledAnimation(); |
| 169 if (should_block_during_drag_drop_) | 169 if (should_block_during_drag_drop_) |
| 170 MessageLoop::current()->Quit(); | 170 MessageLoop::current()->QuitNow(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool DragDropController::IsDragDropInProgress() { | 173 bool DragDropController::IsDragDropInProgress() { |
| 174 return drag_drop_in_progress_; | 174 return drag_drop_in_progress_; |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool DragDropController::PreHandleKeyEvent(aura::Window* target, | 177 bool DragDropController::PreHandleKeyEvent(aura::Window* target, |
| 178 aura::KeyEvent* event) { | 178 aura::KeyEvent* event) { |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 void DragDropController::Cleanup() { | 264 void DragDropController::Cleanup() { |
| 265 if (drag_window_) | 265 if (drag_window_) |
| 266 drag_window_->RemoveObserver(this); | 266 drag_window_->RemoveObserver(this); |
| 267 drag_window_ = NULL; | 267 drag_window_ = NULL; |
| 268 drag_data_ = NULL; | 268 drag_data_ = NULL; |
| 269 drag_drop_in_progress_ = false; | 269 drag_drop_in_progress_ = false; |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace internal | 272 } // namespace internal |
| 273 } // namespace ash | 273 } // namespace ash |
| OLD | NEW |