| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_BASE_DROP_TARGET_H_ |
| 6 #define BASE_BASE_DROP_TARGET_H_ | 6 #define BASE_BASE_DROP_TARGET_H_ |
| 7 | 7 |
| 8 #include <objidl.h> | 8 #include <objidl.h> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // dnd session. | 78 // dnd session. |
| 79 virtual void OnDragLeave(IDataObject* data_object); | 79 virtual void OnDragLeave(IDataObject* data_object); |
| 80 | 80 |
| 81 // Invoked when the drop ends on the window. This should return the operation | 81 // Invoked when the drop ends on the window. This should return the operation |
| 82 // that was taken. | 82 // that was taken. |
| 83 virtual DWORD OnDrop(IDataObject* data_object, | 83 virtual DWORD OnDrop(IDataObject* data_object, |
| 84 DWORD key_state, | 84 DWORD key_state, |
| 85 POINT cursor_position, | 85 POINT cursor_position, |
| 86 DWORD effect); | 86 DWORD effect); |
| 87 | 87 |
| 88 // Return the drag identity. |
| 89 static int32 GetDragIdentity() { return drag_identity_; } |
| 90 |
| 88 private: | 91 private: |
| 89 // Returns the cached drop helper, creating one if necessary. The returned | 92 // Returns the cached drop helper, creating one if necessary. The returned |
| 90 // object is not addrefed. May return NULL if the object couldn't be created. | 93 // object is not addrefed. May return NULL if the object couldn't be created. |
| 91 static IDropTargetHelper* DropHelper(); | 94 static IDropTargetHelper* DropHelper(); |
| 92 | 95 |
| 93 // The data object currently being dragged over this drop target. | 96 // The data object currently being dragged over this drop target. |
| 94 scoped_refptr<IDataObject> current_data_object_; | 97 scoped_refptr<IDataObject> current_data_object_; |
| 95 | 98 |
| 96 // A helper object that is used to provide drag image support while the mouse | 99 // A helper object that is used to provide drag image support while the mouse |
| 97 // is dragging over the content area. | 100 // is dragging over the content area. |
| 98 // | 101 // |
| 99 // DO NOT ACCESS DIRECTLY! Use DropHelper() instead, which will lazily create | 102 // DO NOT ACCESS DIRECTLY! Use DropHelper() instead, which will lazily create |
| 100 // this if it doesn't exist yet. This object can take tens of milliseconds to | 103 // this if it doesn't exist yet. This object can take tens of milliseconds to |
| 101 // create, and we don't want to block any window opening for this, especially | 104 // create, and we don't want to block any window opening for this, especially |
| 102 // since often, DnD will never be used. Instead, we force this penalty to the | 105 // since often, DnD will never be used. Instead, we force this penalty to the |
| 103 // first time it is actually used. | 106 // first time it is actually used. |
| 104 static IDropTargetHelper* cached_drop_target_helper_; | 107 static IDropTargetHelper* cached_drop_target_helper_; |
| 105 | 108 |
| 109 // The drag identity (id). An up-counter that increases when the cursor first |
| 110 // moves over the HWND in a DnD session (OnDragEnter). 0 is reserved to mean |
| 111 // the "no/unknown" identity, and is used for initialization. The identity is |
| 112 // sent to the renderer in drag enter notifications. Note: the identity value |
| 113 // is passed over the renderer NPAPI interface to gears, so use int32 instead |
| 114 // of int here. |
| 115 static int32 drag_identity_; |
| 116 |
| 106 // The HWND of the source. This HWND is used to determine coordinates for | 117 // The HWND of the source. This HWND is used to determine coordinates for |
| 107 // mouse events that are sent to the renderer notifying various drag states. | 118 // mouse events that are sent to the renderer notifying various drag states. |
| 108 HWND hwnd_; | 119 HWND hwnd_; |
| 109 | 120 |
| 110 // Whether or not we are currently processing drag notifications for drags | 121 // Whether or not we are currently processing drag notifications for drags |
| 111 // initiated in this window. | 122 // initiated in this window. |
| 112 bool suspend_; | 123 bool suspend_; |
| 113 | 124 |
| 114 LONG ref_count_; | 125 LONG ref_count_; |
| 115 | 126 |
| 116 DISALLOW_EVIL_CONSTRUCTORS(BaseDropTarget); | 127 DISALLOW_EVIL_CONSTRUCTORS(BaseDropTarget); |
| 117 }; | 128 }; |
| 118 | 129 |
| 119 #endif // BASE_BASE_DROP_TARGET_H_ | 130 #endif // BASE_BASE_DROP_TARGET_H_ |
| OLD | NEW |