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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/window_observer.h"
10 #include "ui/base/dragdrop/drop_target_win.h"
14 class DragDropDelegate
;
19 class DropTargetEvent
;
25 // DesktopDropTargetWin takes care of managing drag and drop for
26 // DesktopWindowTreeHostWin. It converts Windows OLE drop messages into
27 // aura::client::DragDropDelegate calls.
28 class DesktopDropTargetWin
: public ui::DropTargetWin
,
29 public aura::WindowObserver
{
31 DesktopDropTargetWin(aura::Window
* root_window
, HWND window
);
32 ~DesktopDropTargetWin() override
;
35 // ui::DropTargetWin implementation:
36 DWORD
OnDragEnter(IDataObject
* data_object
,
39 DWORD effect
) override
;
40 DWORD
OnDragOver(IDataObject
* data_object
,
43 DWORD effect
) override
;
44 void OnDragLeave(IDataObject
* data_object
) override
;
45 DWORD
OnDrop(IDataObject
* data_object
,
48 DWORD effect
) override
;
50 // aura::WindowObserver implementation:
51 void OnWindowDestroyed(aura::Window
* window
) override
;
53 // Common functionality for the ui::DropTargetWin methods to translate from
54 // COM data types to Aura ones.
55 void Translate(IDataObject
* data_object
,
57 POINT cursor_position
,
59 scoped_ptr
<ui::OSExchangeData
>* data
,
60 scoped_ptr
<ui::DropTargetEvent
>* event
,
61 aura::client::DragDropDelegate
** delegate
);
63 void NotifyDragLeave();
65 // The root window associated with this drop target.
66 aura::Window
* root_window_
;
68 // The Aura window that is currently under the cursor. We need to manually
69 // keep track of this because Windows will only call our drag enter method
70 // once when the user enters the associated HWND. But inside that HWND there
71 // could be multiple aura windows, so we need to generate drag enter events
73 aura::Window
* target_window_
;
75 DISALLOW_COPY_AND_ASSIGN(DesktopDropTargetWin
);
80 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTIOP_DROP_TARGET_WIN_H_