Chromium Code Reviews| 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 #ifndef UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_ | 5 #ifndef UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_ |
| 6 #define UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_ | 6 #define UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_ |
| 7 | 7 |
| 8 #include <objidl.h> | 8 #include <objidl.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/base/dragdrop/drag_drop_types.h" | |
| 12 #include "ui/base/ui_export.h" | 13 #include "ui/base/ui_export.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 | 16 |
| 16 // A base IDropSource implementation. Handles notifications sent by an active | 17 // A base IDropSource implementation. Handles notifications sent by an active |
| 17 // drag-drop operation as the user mouses over other drop targets on their | 18 // drag-drop operation as the user mouses over other drop targets on their |
| 18 // system. This object tells Windows whether or not the drag should continue, | 19 // system. This object tells Windows whether or not the drag should continue, |
| 19 // and supplies the appropriate cursors. | 20 // and supplies the appropriate cursors. |
| 20 class UI_EXPORT DragSourceWin | 21 class UI_EXPORT DragSourceWin |
| 21 : public IDropSource, | 22 : public IDropSource, |
| 22 public base::RefCountedThreadSafe<DragSourceWin> { | 23 public base::RefCountedThreadSafe<DragSourceWin> { |
| 23 public: | 24 public: |
| 24 DragSourceWin(); | 25 DragSourceWin(); |
| 26 DragSourceWin(DragDropTypes::DragEventSource event_source); | |
|
sky
2013/06/07 21:29:50
explicit, and nuke the other constructors.
Hongbo Min
2013/06/08 03:08:49
Done.
| |
| 25 virtual ~DragSourceWin() {} | 27 virtual ~DragSourceWin() {} |
| 26 | 28 |
| 27 // Stop the drag operation at the next chance we get. This doesn't | 29 // Stop the drag operation at the next chance we get. This doesn't |
| 28 // synchronously stop the drag (since Windows is controlling that), | 30 // synchronously stop the drag (since Windows is controlling that), |
| 29 // but lets us tell Windows to cancel the drag the next chance we get. | 31 // but lets us tell Windows to cancel the drag the next chance we get. |
| 30 void CancelDrag() { | 32 void CancelDrag() { |
| 31 cancel_drag_ = true; | 33 cancel_drag_ = true; |
| 32 } | 34 } |
| 33 | 35 |
| 34 // IDropSource implementation: | 36 // IDropSource implementation: |
| 35 HRESULT __stdcall QueryContinueDrag(BOOL escape_pressed, DWORD key_state); | 37 HRESULT __stdcall QueryContinueDrag(BOOL escape_pressed, DWORD key_state); |
| 36 HRESULT __stdcall GiveFeedback(DWORD effect); | 38 HRESULT __stdcall GiveFeedback(DWORD effect); |
| 37 | 39 |
| 38 // IUnknown implementation: | 40 // IUnknown implementation: |
| 39 HRESULT __stdcall QueryInterface(const IID& iid, void** object); | 41 HRESULT __stdcall QueryInterface(const IID& iid, void** object); |
| 40 ULONG __stdcall AddRef(); | 42 ULONG __stdcall AddRef(); |
| 41 ULONG __stdcall Release(); | 43 ULONG __stdcall Release(); |
| 42 | 44 |
| 43 protected: | 45 protected: |
| 44 virtual void OnDragSourceCancel() {} | 46 virtual void OnDragSourceCancel() {} |
| 45 virtual void OnDragSourceDrop() {} | 47 virtual void OnDragSourceDrop() {} |
| 46 virtual void OnDragSourceMove() {} | 48 virtual void OnDragSourceMove() {} |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 // Set to true if we want to cancel the drag operation. | 51 // Set to true if we want to cancel the drag operation. |
| 50 bool cancel_drag_; | 52 bool cancel_drag_; |
| 51 | 53 |
| 54 // Indicate the drag initiator, mouse or touch. | |
| 55 const DragDropTypes::DragEventSource event_source_; | |
| 56 | |
| 52 DISALLOW_COPY_AND_ASSIGN(DragSourceWin); | 57 DISALLOW_COPY_AND_ASSIGN(DragSourceWin); |
| 53 }; | 58 }; |
| 54 | 59 |
| 55 } // namespace ui | 60 } // namespace ui |
| 56 | 61 |
| 57 #endif // UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_ | 62 #endif // UI_BASE_DRAGDROP_DRAG_SOURCE_WIN_H_ |
| OLD | NEW |