OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_UI_WS_DRAG_CONTROLLER_H_ | 5 #ifndef SERVICES_UI_WS_DRAG_CONTROLLER_H_ |
6 #define SERVICES_UI_WS_DRAG_CONTROLLER_H_ | 6 #define SERVICES_UI_WS_DRAG_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 DragController( | 46 DragController( |
47 DragCursorUpdater* cursor_updater, | 47 DragCursorUpdater* cursor_updater, |
48 DragSource* source, | 48 DragSource* source, |
49 ServerWindow* source_window, | 49 ServerWindow* source_window, |
50 DragTargetConnection* source_connection, | 50 DragTargetConnection* source_connection, |
51 int32_t drag_pointer, | 51 int32_t drag_pointer, |
52 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data, | 52 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data, |
53 DropEffectBitmask drag_operations); | 53 DropEffectBitmask drag_operations); |
54 ~DragController() override; | 54 ~DragController() override; |
55 | 55 |
56 ui::mojom::CursorType current_cursor() const { return current_cursor_; } | 56 ui::CursorData current_cursor() const { return current_cursor_; } |
sky
2017/04/26 22:16:15
const ui::CursorData& ?
Elliot Glaysher
2017/04/26 23:09:04
Done.
| |
57 | 57 |
58 // Cancels the current drag, ie, due to the user pressing Escape. | 58 // Cancels the current drag, ie, due to the user pressing Escape. |
59 void Cancel(); | 59 void Cancel(); |
60 | 60 |
61 // Responds to a pointer move/release event. Returns true if the event was | 61 // Responds to a pointer move/release event. Returns true if the event was |
62 // handled by the drag. | 62 // handled by the drag. |
63 bool DispatchPointerEvent(const ui::PointerEvent& event, | 63 bool DispatchPointerEvent(const ui::PointerEvent& event, |
64 ServerWindow* current_target); | 64 ServerWindow* current_target); |
65 | 65 |
66 void OnWillDestroyDragTargetConnection(DragTargetConnection* connection); | 66 void OnWillDestroyDragTargetConnection(DragTargetConnection* connection); |
(...skipping 15 matching lines...) Expand all Loading... | |
82 size_t GetSizeOfQueueForWindow(ServerWindow* window); | 82 size_t GetSizeOfQueueForWindow(ServerWindow* window); |
83 | 83 |
84 // Sets |current_target_window_| to |current_target|, making sure that we add | 84 // Sets |current_target_window_| to |current_target|, making sure that we add |
85 // and release ServerWindow observers correctly. | 85 // and release ServerWindow observers correctly. |
86 void SetCurrentTargetWindow(ServerWindow* current_target); | 86 void SetCurrentTargetWindow(ServerWindow* current_target); |
87 | 87 |
88 // Updates the possible cursor effects for |window|. |bitmask| is a | 88 // Updates the possible cursor effects for |window|. |bitmask| is a |
89 // bitmask of the current valid drag operations. | 89 // bitmask of the current valid drag operations. |
90 void SetWindowDropOperations(ServerWindow* window, DropEffectBitmask bitmask); | 90 void SetWindowDropOperations(ServerWindow* window, DropEffectBitmask bitmask); |
91 | 91 |
92 // Returns the ui::mojom::Cursor for the window |bitmask|, adjusted for types | 92 // Returns the cursor for the window |bitmask|, adjusted for types that the |
93 // that the drag source allows. | 93 // drag source allows. |
94 ui::mojom::CursorType CursorForEffectBitmask(DropEffectBitmask bitmask); | 94 ui::CursorData CursorForEffectBitmask(DropEffectBitmask bitmask); |
95 | 95 |
96 // Ensure that |window| has an entry in |window_state_| and that we're an | 96 // Ensure that |window| has an entry in |window_state_| and that we're an |
97 // observer. | 97 // observer. |
98 void EnsureWindowObserved(ServerWindow* window); | 98 void EnsureWindowObserved(ServerWindow* window); |
99 | 99 |
100 void QueueOperation(ServerWindow* window, | 100 void QueueOperation(ServerWindow* window, |
101 OperationType type, | 101 OperationType type, |
102 uint32_t event_flags, | 102 uint32_t event_flags, |
103 const gfx::Point& screen_position); | 103 const gfx::Point& screen_position); |
104 void DispatchOperation(ServerWindow* window, WindowState* state); | 104 void DispatchOperation(ServerWindow* window, WindowState* state); |
(...skipping 14 matching lines...) Expand all Loading... | |
119 // Object to notify about all cursor changes. | 119 // Object to notify about all cursor changes. |
120 DragCursorUpdater* cursor_updater_; | 120 DragCursorUpdater* cursor_updater_; |
121 | 121 |
122 // A bit-field of acceptable drag operations offered by the source. | 122 // A bit-field of acceptable drag operations offered by the source. |
123 const DropEffectBitmask drag_operations_; | 123 const DropEffectBitmask drag_operations_; |
124 | 124 |
125 // Only act on pointer events that meet this id. | 125 // Only act on pointer events that meet this id. |
126 const int32_t drag_pointer_id_; | 126 const int32_t drag_pointer_id_; |
127 | 127 |
128 // The current mouse cursor during the drag. | 128 // The current mouse cursor during the drag. |
129 ui::mojom::CursorType current_cursor_; | 129 ui::CursorData current_cursor_; |
130 | 130 |
131 // Sending OnDragOver() to our |source_| destroys us; there is a period where | 131 // Sending OnDragOver() to our |source_| destroys us; there is a period where |
132 // we have to continue to exist, but not process any more pointer events. | 132 // we have to continue to exist, but not process any more pointer events. |
133 bool waiting_for_final_drop_response_ = false; | 133 bool waiting_for_final_drop_response_ = false; |
134 | 134 |
135 ServerWindow* source_window_; | 135 ServerWindow* source_window_; |
136 ServerWindow* current_target_window_ = nullptr; | 136 ServerWindow* current_target_window_ = nullptr; |
137 | 137 |
138 // The target connection that |source_window_| is part of. | 138 // The target connection that |source_window_| is part of. |
139 DragTargetConnection* source_connection_; | 139 DragTargetConnection* source_connection_; |
(...skipping 13 matching lines...) Expand all Loading... | |
153 | 153 |
154 base::WeakPtrFactory<DragController> weak_factory_; | 154 base::WeakPtrFactory<DragController> weak_factory_; |
155 | 155 |
156 DISALLOW_COPY_AND_ASSIGN(DragController); | 156 DISALLOW_COPY_AND_ASSIGN(DragController); |
157 }; | 157 }; |
158 | 158 |
159 } // namespace ws | 159 } // namespace ws |
160 } // namespace ui | 160 } // namespace ui |
161 | 161 |
162 #endif // SERVICES_UI_WS_DRAG_CONTROLLER_H_ | 162 #endif // SERVICES_UI_WS_DRAG_CONTROLLER_H_ |
OLD | NEW |