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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_
6 #define UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_
9 #include <wrl/implements.h>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "ui/base/ui_base_export.h"
19 // A base IDropSource implementation. Handles notifications sent by an active
20 // drag-drop operation as the user mouses over other drop targets on their
21 // system. This object tells Windows whether or not the drag should continue,
22 // and supplies the appropriate cursors.
23 class UI_BASE_EXPORT DragSourceWin
24 : public Microsoft::WRL::RuntimeClass
<
25 Microsoft::WRL::RuntimeClassFlags
<Microsoft::WRL::ClassicCom
>,
29 ~DragSourceWin() override
{}
31 // Stop the drag operation at the next chance we get. This doesn't
32 // synchronously stop the drag (since Windows is controlling that),
33 // but lets us tell Windows to cancel the drag the next chance we get.
38 // IDropSource implementation:
39 HRESULT __stdcall
QueryContinueDrag(BOOL escape_pressed
,
40 DWORD key_state
) override
;
41 HRESULT __stdcall
GiveFeedback(DWORD effect
) override
;
43 // Used to set the active data object for the current drag operation. The
44 // caller must ensure that |data| is not destroyed before the nested drag loop
46 void set_data(const OSExchangeData
* data
) { data_
= data
; }
49 virtual void OnDragSourceCancel() {}
50 virtual void OnDragSourceDrop();
51 virtual void OnDragSourceMove() {}
54 // Set to true if we want to cancel the drag operation.
57 const OSExchangeData
* data_
;
59 DISALLOW_COPY_AND_ASSIGN(DragSourceWin
);
64 #endif // UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_