| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 BASE_BASE_DROP_TARGET_H_ | 5 #ifndef APP_WIN_DROP_TARGET_H_ |
| 6 #define BASE_BASE_DROP_TARGET_H_ | 6 #define APP_WIN_DROP_TARGET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <objidl.h> | 9 #include <objidl.h> |
| 10 | 10 |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 | 12 |
| 13 // Windows interface. |
| 13 struct IDropTargetHelper; | 14 struct IDropTargetHelper; |
| 14 | 15 |
| 16 namespace app { |
| 17 namespace win { |
| 18 |
| 15 // A DropTarget implementation that takes care of the nitty gritty | 19 // A DropTarget implementation that takes care of the nitty gritty |
| 16 // of dnd. While this class is concrete, subclasses will most likely | 20 // of dnd. While this class is concrete, subclasses will most likely |
| 17 // want to override various OnXXX methods. | 21 // want to override various OnXXX methods. |
| 18 // | 22 // |
| 19 // Because BaseDropTarget is ref counted you shouldn't delete it directly, | 23 // Because DropTarget is ref counted you shouldn't delete it directly, |
| 20 // rather wrap it in a scoped_refptr. Be sure and invoke RevokeDragDrop(m_hWnd) | 24 // rather wrap it in a scoped_refptr. Be sure and invoke RevokeDragDrop(m_hWnd) |
| 21 // before the HWND is deleted too. | 25 // before the HWND is deleted too. |
| 22 // | 26 // |
| 23 // This class is meant to be used in a STA and is not multithread-safe. | 27 // This class is meant to be used in a STA and is not multithread-safe. |
| 24 class BaseDropTarget : public IDropTarget { | 28 class DropTarget : public IDropTarget { |
| 25 public: | 29 public: |
| 26 // Create a new BaseDropTarget associating it with the given HWND. | 30 // Create a new DropTarget associating it with the given HWND. |
| 27 explicit BaseDropTarget(HWND hwnd); | 31 explicit DropTarget(HWND hwnd); |
| 28 virtual ~BaseDropTarget(); | 32 virtual ~DropTarget(); |
| 29 | 33 |
| 30 // When suspended is set to |true|, the drop target does not receive drops | 34 // When suspended is set to |true|, the drop target does not receive drops |
| 31 // from drags initiated within the owning HWND. | 35 // from drags initiated within the owning HWND. |
| 32 bool suspended() const { return suspended_; } | 36 bool suspended() const { return suspended_; } |
| 33 void set_suspended(bool suspended) { suspended_ = suspended; } | 37 void set_suspended(bool suspended) { suspended_ = suspended; } |
| 34 | 38 |
| 35 // IDropTarget implementation: | 39 // IDropTarget implementation: |
| 36 HRESULT __stdcall DragEnter(IDataObject* data_object, | 40 HRESULT __stdcall DragEnter(IDataObject* data_object, |
| 37 DWORD key_state, | 41 DWORD key_state, |
| 38 POINTL cursor_position, | 42 POINTL cursor_position, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // The HWND of the source. This HWND is used to determine coordinates for | 120 // The HWND of the source. This HWND is used to determine coordinates for |
| 117 // mouse events that are sent to the renderer notifying various drag states. | 121 // mouse events that are sent to the renderer notifying various drag states. |
| 118 HWND hwnd_; | 122 HWND hwnd_; |
| 119 | 123 |
| 120 // Whether or not we are currently processing drag notifications for drags | 124 // Whether or not we are currently processing drag notifications for drags |
| 121 // initiated in this window. | 125 // initiated in this window. |
| 122 bool suspended_; | 126 bool suspended_; |
| 123 | 127 |
| 124 LONG ref_count_; | 128 LONG ref_count_; |
| 125 | 129 |
| 126 DISALLOW_COPY_AND_ASSIGN(BaseDropTarget); | 130 DISALLOW_COPY_AND_ASSIGN(DropTarget); |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 #endif // BASE_BASE_DROP_TARGET_H_ | 133 } // namespace win |
| 134 } // namespace app |
| 135 |
| 136 #endif // APP_WIN_DROP_TARGET_H_ |
| OLD | NEW |