OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/widget/drop_helper.h" | 5 #include "views/widget/drop_helper.h" |
6 | 6 |
7 #include "app/drag_drop_types.h" | 7 #include "ui/base/dragdrop/drag_drop_types.h" |
8 #include "views/view.h" | 8 #include "views/view.h" |
9 #include "views/widget/root_view.h" | 9 #include "views/widget/root_view.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 | 12 |
13 DropHelper::DropHelper(RootView* root_view) | 13 DropHelper::DropHelper(RootView* root_view) |
14 : root_view_(root_view), | 14 : root_view_(root_view), |
15 target_view_(NULL), | 15 target_view_(NULL), |
16 deepest_view_(NULL) { | 16 deepest_view_(NULL) { |
17 } | 17 } |
(...skipping 28 matching lines...) Expand all Loading... |
46 NotifyDragExit(); | 46 NotifyDragExit(); |
47 deepest_view_ = target_view_ = NULL; | 47 deepest_view_ = target_view_ = NULL; |
48 } | 48 } |
49 | 49 |
50 int DropHelper::OnDrop(const OSExchangeData& data, | 50 int DropHelper::OnDrop(const OSExchangeData& data, |
51 const gfx::Point& root_view_location, | 51 const gfx::Point& root_view_location, |
52 int drag_operation) { | 52 int drag_operation) { |
53 View* drop_view = target_view_; | 53 View* drop_view = target_view_; |
54 deepest_view_ = target_view_ = NULL; | 54 deepest_view_ = target_view_ = NULL; |
55 if (!drop_view) | 55 if (!drop_view) |
56 return DragDropTypes::DRAG_NONE; | 56 return ui::DragDropTypes::DRAG_NONE; |
57 | 57 |
58 if (drag_operation == DragDropTypes::DRAG_NONE) { | 58 if (drag_operation == ui::DragDropTypes::DRAG_NONE) { |
59 drop_view->OnDragExited(); | 59 drop_view->OnDragExited(); |
60 return DragDropTypes::DRAG_NONE; | 60 return ui::DragDropTypes::DRAG_NONE; |
61 } | 61 } |
62 | 62 |
63 gfx::Point view_location(root_view_location); | 63 gfx::Point view_location(root_view_location); |
64 View::ConvertPointToView(NULL, drop_view, &view_location); | 64 View::ConvertPointToView(NULL, drop_view, &view_location); |
65 DropTargetEvent drop_event(data, view_location.x(), view_location.y(), | 65 DropTargetEvent drop_event(data, view_location.x(), view_location.y(), |
66 drag_operation); | 66 drag_operation); |
67 return drop_view->OnPerformDrop(drop_event); | 67 return drop_view->OnPerformDrop(drop_event); |
68 } | 68 } |
69 | 69 |
70 View* DropHelper::CalculateTargetView( | 70 View* DropHelper::CalculateTargetView( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 target_view_location.x(), | 129 target_view_location.x(), |
130 target_view_location.y(), | 130 target_view_location.y(), |
131 drag_operation); | 131 drag_operation); |
132 target_view_->OnDragEntered(enter_event); | 132 target_view_->OnDragEntered(enter_event); |
133 } | 133 } |
134 | 134 |
135 int DropHelper::NotifyDragOver(const OSExchangeData& data, | 135 int DropHelper::NotifyDragOver(const OSExchangeData& data, |
136 const gfx::Point& root_view_location, | 136 const gfx::Point& root_view_location, |
137 int drag_operation) { | 137 int drag_operation) { |
138 if (!target_view_) | 138 if (!target_view_) |
139 return DragDropTypes::DRAG_NONE; | 139 return ui::DragDropTypes::DRAG_NONE; |
140 | 140 |
141 gfx::Point target_view_location(root_view_location); | 141 gfx::Point target_view_location(root_view_location); |
142 View::ConvertPointToView(root_view_, target_view_, &target_view_location); | 142 View::ConvertPointToView(root_view_, target_view_, &target_view_location); |
143 DropTargetEvent enter_event(data, | 143 DropTargetEvent enter_event(data, |
144 target_view_location.x(), | 144 target_view_location.x(), |
145 target_view_location.y(), | 145 target_view_location.y(), |
146 drag_operation); | 146 drag_operation); |
147 return target_view_->OnDragUpdated(enter_event); | 147 return target_view_->OnDragUpdated(enter_event); |
148 } | 148 } |
149 | 149 |
150 void DropHelper::NotifyDragExit() { | 150 void DropHelper::NotifyDragExit() { |
151 if (target_view_) | 151 if (target_view_) |
152 target_view_->OnDragExited(); | 152 target_view_->OnDragExited(); |
153 } | 153 } |
154 | 154 |
155 } // namespace views | 155 } // namespace views |
OLD | NEW |