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 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/aura/window_observer.h" | 9 #include "ui/aura/window_observer.h" |
10 #include "ui/base/dragdrop/drop_target_win.h" | 10 #include "ui/base/dragdrop/drop_target_win.h" |
11 | 11 |
12 namespace aura { | 12 namespace aura { |
13 class RootWindow; | |
14 namespace client { | 13 namespace client { |
15 class DragDropDelegate; | 14 class DragDropDelegate; |
16 } | 15 } |
17 } | 16 } |
18 | 17 |
19 namespace ui { | 18 namespace ui { |
20 class DropTargetEvent; | 19 class DropTargetEvent; |
21 class OSExchangeData; | 20 class OSExchangeData; |
22 } | 21 } |
23 | 22 |
24 namespace views { | 23 namespace views { |
25 | 24 |
26 // DesktopDropTargetWin takes care of managing drag and drop for | 25 // DesktopDropTargetWin takes care of managing drag and drop for |
27 // DesktopRootWindowHostWin. It converts Windows OLE drop messages into | 26 // DesktopRootWindowHostWin. It converts Windows OLE drop messages into |
28 // aura::client::DragDropDelegate calls. | 27 // aura::client::DragDropDelegate calls. |
29 class DesktopDropTargetWin : public ui::DropTargetWin, | 28 class DesktopDropTargetWin : public ui::DropTargetWin, |
30 public aura::WindowObserver { | 29 public aura::WindowObserver { |
31 public: | 30 public: |
32 DesktopDropTargetWin(aura::RootWindow* root_window, HWND window); | 31 DesktopDropTargetWin(aura::Window* root_window, HWND window); |
33 virtual ~DesktopDropTargetWin(); | 32 virtual ~DesktopDropTargetWin(); |
34 | 33 |
35 private: | 34 private: |
36 // ui::DropTargetWin implementation: | 35 // ui::DropTargetWin implementation: |
37 virtual DWORD OnDragEnter(IDataObject* data_object, | 36 virtual DWORD OnDragEnter(IDataObject* data_object, |
38 DWORD key_state, | 37 DWORD key_state, |
39 POINT position, | 38 POINT position, |
40 DWORD effect) OVERRIDE; | 39 DWORD effect) OVERRIDE; |
41 virtual DWORD OnDragOver(IDataObject* data_object, | 40 virtual DWORD OnDragOver(IDataObject* data_object, |
42 DWORD key_state, | 41 DWORD key_state, |
(...skipping 14 matching lines...) Expand all Loading... |
57 DWORD key_state, | 56 DWORD key_state, |
58 POINT cursor_position, | 57 POINT cursor_position, |
59 DWORD effect, | 58 DWORD effect, |
60 scoped_ptr<ui::OSExchangeData>* data, | 59 scoped_ptr<ui::OSExchangeData>* data, |
61 scoped_ptr<ui::DropTargetEvent>* event, | 60 scoped_ptr<ui::DropTargetEvent>* event, |
62 aura::client::DragDropDelegate** delegate); | 61 aura::client::DragDropDelegate** delegate); |
63 | 62 |
64 void NotifyDragLeave(); | 63 void NotifyDragLeave(); |
65 | 64 |
66 // The root window associated with this drop target. | 65 // The root window associated with this drop target. |
67 aura::RootWindow* root_window_; | 66 aura::Window* root_window_; |
68 | 67 |
69 // The Aura window that is currently under the cursor. We need to manually | 68 // The Aura window that is currently under the cursor. We need to manually |
70 // keep track of this because Windows will only call our drag enter method | 69 // keep track of this because Windows will only call our drag enter method |
71 // once when the user enters the associated HWND. But inside that HWND there | 70 // once when the user enters the associated HWND. But inside that HWND there |
72 // could be multiple aura windows, so we need to generate drag enter events | 71 // could be multiple aura windows, so we need to generate drag enter events |
73 // for them. | 72 // for them. |
74 aura::Window* target_window_; | 73 aura::Window* target_window_; |
75 | 74 |
76 DISALLOW_COPY_AND_ASSIGN(DesktopDropTargetWin); | 75 DISALLOW_COPY_AND_ASSIGN(DesktopDropTargetWin); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace views | 78 } // namespace views |
80 | 79 |
81 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_ | 80 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_ |
OLD | NEW |