OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/widget/drop_target_win.h" | 5 #include "ui/views/widget/drop_target_win.h" |
6 | 6 |
7 #include "ui/base/dragdrop/drag_drop_types.h" | 7 #include "ui/base/dragdrop/drag_drop_types.h" |
8 #include "ui/base/dragdrop/os_exchange_data.h" | 8 #include "ui/base/dragdrop/os_exchange_data.h" |
9 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 9 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 void DropTargetWin::ResetTargetViewIfEquals(View* view) { | 27 void DropTargetWin::ResetTargetViewIfEquals(View* view) { |
28 helper_.ResetTargetViewIfEquals(view); | 28 helper_.ResetTargetViewIfEquals(view); |
29 } | 29 } |
30 | 30 |
31 DWORD DropTargetWin::OnDragOver(IDataObject* data_object, | 31 DWORD DropTargetWin::OnDragOver(IDataObject* data_object, |
32 DWORD key_state, | 32 DWORD key_state, |
33 POINT cursor_position, | 33 POINT cursor_position, |
34 DWORD effect) { | 34 DWORD effect) { |
35 gfx::Point root_view_location(cursor_position.x, cursor_position.y); | 35 gfx::Point root_view_location(cursor_position.x, cursor_position.y); |
36 View::ConvertPointToView(NULL, helper_.root_view(), &root_view_location); | 36 View::ConvertPointToTarget(NULL, helper_.root_view(), &root_view_location); |
37 OSExchangeData data(new OSExchangeDataProviderWin(data_object)); | 37 OSExchangeData data(new OSExchangeDataProviderWin(data_object)); |
38 int drop_operation = | 38 int drop_operation = |
39 helper_.OnDragOver(data, root_view_location, | 39 helper_.OnDragOver(data, root_view_location, |
40 ui::DragDropTypes::DropEffectToDragOperation(effect)); | 40 ui::DragDropTypes::DropEffectToDragOperation(effect)); |
41 return ui::DragDropTypes::DragOperationToDropEffect(drop_operation); | 41 return ui::DragDropTypes::DragOperationToDropEffect(drop_operation); |
42 } | 42 } |
43 | 43 |
44 void DropTargetWin::OnDragLeave(IDataObject* data_object) { | 44 void DropTargetWin::OnDragLeave(IDataObject* data_object) { |
45 helper_.OnDragExit(); | 45 helper_.OnDragExit(); |
46 } | 46 } |
47 | 47 |
48 DWORD DropTargetWin::OnDrop(IDataObject* data_object, | 48 DWORD DropTargetWin::OnDrop(IDataObject* data_object, |
49 DWORD key_state, | 49 DWORD key_state, |
50 POINT cursor_position, | 50 POINT cursor_position, |
51 DWORD effect) { | 51 DWORD effect) { |
52 gfx::Point root_view_location(cursor_position.x, cursor_position.y); | 52 gfx::Point root_view_location(cursor_position.x, cursor_position.y); |
53 View::ConvertPointToView(NULL, helper_.root_view(), &root_view_location); | 53 View::ConvertPointToTarget(NULL, helper_.root_view(), &root_view_location); |
54 | 54 |
55 OSExchangeData data(new OSExchangeDataProviderWin(data_object)); | 55 OSExchangeData data(new OSExchangeDataProviderWin(data_object)); |
56 int drop_operation = ui::DragDropTypes::DropEffectToDragOperation(effect); | 56 int drop_operation = ui::DragDropTypes::DropEffectToDragOperation(effect); |
57 drop_operation = helper_.OnDragOver(data, root_view_location, | 57 drop_operation = helper_.OnDragOver(data, root_view_location, |
58 drop_operation); | 58 drop_operation); |
59 drop_operation = helper_.OnDrop(data, root_view_location, drop_operation); | 59 drop_operation = helper_.OnDrop(data, root_view_location, drop_operation); |
60 return ui::DragDropTypes::DragOperationToDropEffect(drop_operation); | 60 return ui::DragDropTypes::DragOperationToDropEffect(drop_operation); |
61 } | 61 } |
62 | 62 |
63 } // namespace views | 63 } // namespace views |
OLD | NEW |