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_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "ui/gfx/path.h" | 26 #include "ui/gfx/path.h" |
27 #include "ui/gfx/point.h" | 27 #include "ui/gfx/point.h" |
28 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
29 #include "ui/gfx/rect_conversions.h" | 29 #include "ui/gfx/rect_conversions.h" |
30 #include "ui/views/views_delegate.h" | 30 #include "ui/views/views_delegate.h" |
31 #include "ui/views/widget/native_widget_aura.h" | 31 #include "ui/views/widget/native_widget_aura.h" |
32 | 32 |
33 namespace ash { | 33 namespace ash { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 using aura::RootWindow; | |
37 | |
38 namespace { | 36 namespace { |
39 // The duration of the drag cancel animation in millisecond. | 37 // The duration of the drag cancel animation in millisecond. |
40 const int kCancelAnimationDuration = 250; | 38 const int kCancelAnimationDuration = 250; |
41 const int kTouchCancelAnimationDuration = 20; | 39 const int kTouchCancelAnimationDuration = 20; |
42 // The frame rate of the drag cancel animation in hertz. | 40 // The frame rate of the drag cancel animation in hertz. |
43 const int kCancelAnimationFrameRate = 60; | 41 const int kCancelAnimationFrameRate = 60; |
44 | 42 |
45 // For touch initiated dragging, we scale and shift drag image by the following: | 43 // For touch initiated dragging, we scale and shift drag image by the following: |
46 static const float kTouchDragImageScale = 1.2f; | 44 static const float kTouchDragImageScale = 1.2f; |
47 static const int kTouchDragImageVerticalOffset = -25; | 45 static const int kTouchDragImageVerticalOffset = -25; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Shell::GetInstance()->RemovePreTargetHandler(this); | 151 Shell::GetInstance()->RemovePreTargetHandler(this); |
154 Cleanup(); | 152 Cleanup(); |
155 if (cancel_animation_) | 153 if (cancel_animation_) |
156 cancel_animation_->End(); | 154 cancel_animation_->End(); |
157 if (drag_image_) | 155 if (drag_image_) |
158 drag_image_.reset(); | 156 drag_image_.reset(); |
159 } | 157 } |
160 | 158 |
161 int DragDropController::StartDragAndDrop( | 159 int DragDropController::StartDragAndDrop( |
162 const ui::OSExchangeData& data, | 160 const ui::OSExchangeData& data, |
163 aura::RootWindow* root_window, | 161 aura::Window* root_window, |
164 aura::Window* source_window, | 162 aura::Window* source_window, |
165 const gfx::Point& root_location, | 163 const gfx::Point& root_location, |
166 int operation, | 164 int operation, |
167 ui::DragDropTypes::DragEventSource source) { | 165 ui::DragDropTypes::DragEventSource source) { |
168 if (IsDragDropInProgress()) | 166 if (IsDragDropInProgress()) |
169 return 0; | 167 return 0; |
170 | 168 |
171 const ui::OSExchangeData::Provider* provider = &data.provider(); | 169 const ui::OSExchangeData::Provider* provider = &data.provider(); |
172 // We do not support touch drag/drop without a drag image. | 170 // We do not support touch drag/drop without a drag image. |
173 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && | 171 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 drag_window_->RemoveObserver(this); | 561 drag_window_->RemoveObserver(this); |
564 drag_window_ = NULL; | 562 drag_window_ = NULL; |
565 drag_data_ = NULL; | 563 drag_data_ = NULL; |
566 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 564 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
567 // instead of reset to avoid double free. | 565 // instead of reset to avoid double free. |
568 drag_drop_tracker_.Pass(); | 566 drag_drop_tracker_.Pass(); |
569 } | 567 } |
570 | 568 |
571 } // namespace internal | 569 } // namespace internal |
572 } // namespace ash | 570 } // namespace ash |
OLD | NEW |