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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 int drag_image_vertical_offset = 0; | 145 int drag_image_vertical_offset = 0; |
146 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | 146 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { |
147 drag_image_scale = kTouchDragImageScale; | 147 drag_image_scale = kTouchDragImageScale; |
148 drag_image_vertical_offset = kTouchDragImageVerticalOffset; | 148 drag_image_vertical_offset = kTouchDragImageVerticalOffset; |
149 } | 149 } |
150 gfx::Point start_location = root_location; | 150 gfx::Point start_location = root_location; |
151 ash::wm::ConvertPointToScreen(root_window, &start_location); | 151 ash::wm::ConvertPointToScreen(root_window, &start_location); |
152 drag_image_final_bounds_for_cancel_animation_ = gfx::Rect( | 152 drag_image_final_bounds_for_cancel_animation_ = gfx::Rect( |
153 start_location - provider->GetDragImageOffset(), | 153 start_location - provider->GetDragImageOffset(), |
154 provider->GetDragImage().size()); | 154 provider->GetDragImage().size()); |
155 drag_image_.reset(new DragImageView); | 155 drag_image_.reset(new DragImageView(source_window->GetRootWindow())); |
156 drag_image_->SetImage(provider->GetDragImage()); | 156 drag_image_->SetImage(provider->GetDragImage()); |
157 drag_image_offset_ = provider->GetDragImageOffset(); | 157 drag_image_offset_ = provider->GetDragImageOffset(); |
158 gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize()); | 158 gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize()); |
159 drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset(drag_image_bounds, | 159 drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset(drag_image_bounds, |
160 drag_image_vertical_offset, drag_image_scale, &drag_image_offset_); | 160 drag_image_vertical_offset, drag_image_scale, &drag_image_offset_); |
161 drag_image_->SetBoundsInScreen(drag_image_bounds); | 161 drag_image_->SetBoundsInScreen(drag_image_bounds); |
162 drag_image_->SetWidgetVisible(true); | 162 drag_image_->SetWidgetVisible(true); |
163 | 163 |
164 drag_window_ = NULL; | 164 drag_window_ = NULL; |
165 | 165 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 drag_window_->RemoveObserver(this); | 495 drag_window_->RemoveObserver(this); |
496 drag_window_ = NULL; | 496 drag_window_ = NULL; |
497 drag_data_ = NULL; | 497 drag_data_ = NULL; |
498 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 498 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
499 // instead of reset to avoid double free. | 499 // instead of reset to avoid double free. |
500 drag_drop_tracker_.Pass(); | 500 drag_drop_tracker_.Pass(); |
501 } | 501 } |
502 | 502 |
503 } // namespace internal | 503 } // namespace internal |
504 } // namespace ash | 504 } // namespace ash |
OLD | NEW |