Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(865)

Unified Diff: services/ui/ws/drag_controller.h

Issue 2376583003: mus: Keep track of the drag cursor during DnD operations. (Closed)
Patch Set: Add test for when target window closes to reset cursor Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/drag_controller.h
diff --git a/services/ui/ws/drag_controller.h b/services/ui/ws/drag_controller.h
index 3b781a44a2ebb43d2732ace7123f3f62b912b5e7..da28a591b177df6eee8acad9754b5227f0377333 100644
--- a/services/ui/ws/drag_controller.h
+++ b/services/ui/ws/drag_controller.h
@@ -17,6 +17,7 @@ namespace test {
class DragControllerTestApi;
}
+class DragCursorUpdater;
class DragSource;
class DragTargetConnection;
@@ -26,7 +27,8 @@ class DragTargetConnection;
// WindowManagerState's EventDispatcher creates and owns this instance.
class DragController : public ServerWindowObserver {
public:
- DragController(DragSource* source,
+ DragController(DragCursorUpdater* cursor_updater,
+ DragSource* source,
ServerWindow* source_window,
DragTargetConnection* source_connection,
int32_t drag_pointer,
@@ -34,6 +36,8 @@ class DragController : public ServerWindowObserver {
uint32_t drag_operations);
~DragController() override;
+ int32_t current_cursor() { return current_cursor_; }
sky 2016/09/28 15:38:13 const
+
// Cancels the current drag, ie, due to the user pressing Escape.
void Cancel();
@@ -64,6 +68,14 @@ class DragController : public ServerWindowObserver {
// and release ServerWindow observers correctly.
void SetCurrentTargetWindow(ServerWindow* current_target);
+ // Updates the possible cursor effects for |window|. |effect_bitmask| is a
+ // bitmask of the current valid drag operations.
+ void UpdateCursor(ServerWindow* window, uint32_t effect_bitmask);
sky 2016/09/28 15:38:13 This seems more like SetWindowDropOperations. It m
Elliot Glaysher 2016/09/28 18:15:31 Done.
+
+ // Returns the ui::mojom::Cursor for the window reporting it can handle
+ // |window_operations|.
+ int32_t CursorForWindowOperations(uint32_t window_operations);
sky 2016/09/28 15:38:13 Is there a reason you prefer using int32_t as the
Elliot Glaysher 2016/09/28 18:15:31 Because the consumer uses int32_t. I can, in a sep
+
// Ensure that |window| has an entry in |window_state_| and that we're an
// observer.
void EnsureWindowObserved(ServerWindow* window);
@@ -85,12 +97,18 @@ class DragController : public ServerWindowObserver {
// Our owner.
DragSource* source_;
+ // Object to notify about all cursor changes.
+ DragCursorUpdater* cursor_updater_;
+
// A bit-field of acceptable drag operations offered by the source.
const uint32_t drag_operations_;
// Only act on pointer events that meet this id.
const int32_t drag_pointer_id_;
+ // The current mouse cursor during the drag.
+ int32_t current_cursor_;
+
// Sending OnDragOver() to our |source_| destroys us; there is a period where
// we have to continue to exist, but not process any more pointer events.
bool waiting_for_final_drop_response_ = false;

Powered by Google App Engine
This is Rietveld 408576698