| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/drag_drop/drag_drop_tracker.h" | 9 #include "ash/drag_drop/drag_drop_tracker.h" |
| 10 #include "ash/drag_drop/drag_image_view.h" | 10 #include "ash/drag_drop/drag_image_view.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm_shell.h" | 12 #include "ash/shell_port.h" |
| 13 #include "ash/wm_window.h" | 13 #include "ash/wm_window.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "ui/aura/client/capture_client.h" | 19 #include "ui/aura/client/capture_client.h" |
| 20 #include "ui/aura/client/drag_drop_delegate.h" | 20 #include "ui/aura/client/drag_drop_delegate.h" |
| 21 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 DragDropController::DragDropController() | 129 DragDropController::DragDropController() |
| 130 : drag_data_(NULL), | 130 : drag_data_(NULL), |
| 131 drag_operation_(0), | 131 drag_operation_(0), |
| 132 drag_window_(NULL), | 132 drag_window_(NULL), |
| 133 drag_source_window_(NULL), | 133 drag_source_window_(NULL), |
| 134 should_block_during_drag_drop_(true), | 134 should_block_during_drag_drop_(true), |
| 135 drag_drop_window_delegate_(new DragDropTrackerDelegate(this)), | 135 drag_drop_window_delegate_(new DragDropTrackerDelegate(this)), |
| 136 current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE), | 136 current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE), |
| 137 weak_factory_(this) { | 137 weak_factory_(this) { |
| 138 Shell::Get()->PrependPreTargetHandler(this); | 138 Shell::Get()->PrependPreTargetHandler(this); |
| 139 WmShell::Get()->AddDisplayObserver(this); | 139 ShellPort::Get()->AddDisplayObserver(this); |
| 140 } | 140 } |
| 141 | 141 |
| 142 DragDropController::~DragDropController() { | 142 DragDropController::~DragDropController() { |
| 143 WmShell::Get()->RemoveDisplayObserver(this); | 143 ShellPort::Get()->RemoveDisplayObserver(this); |
| 144 Shell::Get()->RemovePreTargetHandler(this); | 144 Shell::Get()->RemovePreTargetHandler(this); |
| 145 Cleanup(); | 145 Cleanup(); |
| 146 if (cancel_animation_) | 146 if (cancel_animation_) |
| 147 cancel_animation_->End(); | 147 cancel_animation_->End(); |
| 148 if (drag_image_) | 148 if (drag_image_) |
| 149 drag_image_.reset(); | 149 drag_image_.reset(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 int DragDropController::StartDragAndDrop( | 152 int DragDropController::StartDragAndDrop( |
| 153 const ui::OSExchangeData& data, | 153 const ui::OSExchangeData& data, |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (drag_window_) | 574 if (drag_window_) |
| 575 drag_window_->RemoveObserver(this); | 575 drag_window_->RemoveObserver(this); |
| 576 drag_window_ = NULL; | 576 drag_window_ = NULL; |
| 577 drag_data_ = NULL; | 577 drag_data_ = NULL; |
| 578 // Cleanup can be called again while deleting DragDropTracker, so delete | 578 // Cleanup can be called again while deleting DragDropTracker, so delete |
| 579 // the pointer with a local variable to avoid double free. | 579 // the pointer with a local variable to avoid double free. |
| 580 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); | 580 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); |
| 581 } | 581 } |
| 582 | 582 |
| 583 } // namespace ash | 583 } // namespace ash |
| OLD | NEW |