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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if (drag_image_.get()) | 55 if (drag_image_.get()) |
56 drag_image_.reset(); | 56 drag_image_.reset(); |
57 } | 57 } |
58 | 58 |
59 int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, | 59 int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, |
60 aura::RootWindow* root_window, | 60 aura::RootWindow* root_window, |
61 const gfx::Point& root_location, | 61 const gfx::Point& root_location, |
62 int operation) { | 62 int operation) { |
63 DCHECK(!IsDragDropInProgress()); | 63 DCHECK(!IsDragDropInProgress()); |
64 | 64 |
65 drag_drop_tracker_.reset(new DragDropTracker(root_window)); | 65 drag_drop_tracker_.reset(new DragDropTracker); |
66 | 66 |
67 drag_data_ = &data; | 67 drag_data_ = &data; |
68 drag_operation_ = operation; | 68 drag_operation_ = operation; |
69 const ui::OSExchangeDataProviderAura& provider = | 69 const ui::OSExchangeDataProviderAura& provider = |
70 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); | 70 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); |
71 | 71 |
72 drag_image_.reset(new DragImageView); | 72 drag_image_.reset(new DragImageView); |
73 drag_image_->SetImage(provider.drag_image()); | 73 drag_image_->SetImage(provider.drag_image()); |
74 drag_image_offset_ = provider.drag_image_offset(); | 74 drag_image_offset_ = provider.drag_image_offset(); |
75 drag_image_->SetBoundsInScreen(gfx::Rect( | 75 drag_image_->SetBoundsInScreen(gfx::Rect( |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 drag_window_->RemoveObserver(this); | 298 drag_window_->RemoveObserver(this); |
299 drag_window_ = NULL; | 299 drag_window_ = NULL; |
300 drag_data_ = NULL; | 300 drag_data_ = NULL; |
301 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 301 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
302 // instead of reset to avoid double free. | 302 // instead of reset to avoid double free. |
303 drag_drop_tracker_.Pass(); | 303 drag_drop_tracker_.Pass(); |
304 } | 304 } |
305 | 305 |
306 } // namespace internal | 306 } // namespace internal |
307 } // namespace ash | 307 } // namespace ash |
OLD | NEW |