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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 int DragDropController::StartDragAndDrop( | 59 int DragDropController::StartDragAndDrop( |
60 const ui::OSExchangeData& data, | 60 const ui::OSExchangeData& data, |
61 aura::RootWindow* root_window, | 61 aura::RootWindow* root_window, |
62 aura::Window* source_window, | 62 aura::Window* source_window, |
63 const gfx::Point& root_location, | 63 const gfx::Point& root_location, |
64 int operation, | 64 int operation, |
65 ui::DragDropTypes::DragEventSource source) { | 65 ui::DragDropTypes::DragEventSource source) { |
66 DCHECK(!IsDragDropInProgress()); | 66 DCHECK(!IsDragDropInProgress()); |
67 | 67 |
68 drag_drop_tracker_.reset(new DragDropTracker); | 68 drag_drop_tracker_.reset(new DragDropTracker(root_window)); |
69 | 69 |
70 drag_data_ = &data; | 70 drag_data_ = &data; |
71 drag_operation_ = operation; | 71 drag_operation_ = operation; |
72 const ui::OSExchangeDataProviderAura& provider = | 72 const ui::OSExchangeDataProviderAura& provider = |
73 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); | 73 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); |
74 | 74 |
75 drag_image_.reset(new DragImageView); | 75 drag_image_.reset(new DragImageView); |
76 drag_image_->SetImage(provider.drag_image()); | 76 drag_image_->SetImage(provider.drag_image()); |
77 drag_image_offset_ = provider.drag_image_offset(); | 77 drag_image_offset_ = provider.drag_image_offset(); |
78 drag_image_->SetBoundsInScreen(gfx::Rect( | 78 drag_image_->SetBoundsInScreen(gfx::Rect( |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 drag_window_->RemoveObserver(this); | 292 drag_window_->RemoveObserver(this); |
293 drag_window_ = NULL; | 293 drag_window_ = NULL; |
294 drag_data_ = NULL; | 294 drag_data_ = NULL; |
295 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 295 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
296 // instead of reset to avoid double free. | 296 // instead of reset to avoid double free. |
297 drag_drop_tracker_.Pass(); | 297 drag_drop_tracker_.Pass(); |
298 } | 298 } |
299 | 299 |
300 } // namespace internal | 300 } // namespace internal |
301 } // namespace ash | 301 } // namespace ash |
OLD | NEW |