Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / dragdrop / drag_source_win.h
blob9d442a89463bcf91d0a7dd9b59cb2e37616eaada
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_
8 #include <objidl.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"
15 namespace ui {
17 class OSExchangeData;
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>,
26 IDropSource> {
27 public:
28 DragSourceWin();
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.
34 void CancelDrag() {
35 cancel_drag_ = true;
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
45 // terminates.
46 void set_data(const OSExchangeData* data) { data_ = data; }
48 protected:
49 virtual void OnDragSourceCancel() {}
50 virtual void OnDragSourceDrop();
51 virtual void OnDragSourceMove() {}
53 private:
54 // Set to true if we want to cancel the drag operation.
55 bool cancel_drag_;
57 const OSExchangeData* data_;
59 DISALLOW_COPY_AND_ASSIGN(DragSourceWin);
62 } // namespace ui
64 #endif // UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_