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

Side by Side Diff: services/ui/ws/drag_controller.h

Issue 2378883002: mus ws: Consistently use mojom::Cursor instead of int32_t. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/display.cc ('k') | services/ui/ws/drag_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "services/ui/common/types.h" 12 #include "services/ui/common/types.h"
13 #include "services/ui/public/interfaces/cursor.mojom.h"
13 #include "services/ui/ws/ids.h" 14 #include "services/ui/ws/ids.h"
14 #include "services/ui/ws/server_window_observer.h" 15 #include "services/ui/ws/server_window_observer.h"
15 16
16 namespace ui { 17 namespace ui {
17 namespace ws { 18 namespace ws {
18 19
19 namespace test { 20 namespace test {
20 class DragControllerTestApi; 21 class DragControllerTestApi;
21 } 22 }
22 23
(...skipping 15 matching lines...) Expand all
38 public: 39 public:
39 DragController(DragCursorUpdater* cursor_updater, 40 DragController(DragCursorUpdater* cursor_updater,
40 DragSource* source, 41 DragSource* source,
41 ServerWindow* source_window, 42 ServerWindow* source_window,
42 DragTargetConnection* source_connection, 43 DragTargetConnection* source_connection,
43 int32_t drag_pointer, 44 int32_t drag_pointer,
44 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data, 45 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data,
45 DropEffectBitmask drag_operations); 46 DropEffectBitmask drag_operations);
46 ~DragController() override; 47 ~DragController() override;
47 48
48 int32_t current_cursor() const { return current_cursor_; } 49 ui::mojom::Cursor current_cursor() const { return current_cursor_; }
49 50
50 // Cancels the current drag, ie, due to the user pressing Escape. 51 // Cancels the current drag, ie, due to the user pressing Escape.
51 void Cancel(); 52 void Cancel();
52 53
53 // Responds to a pointer move/release event. Returns true if the event was 54 // Responds to a pointer move/release event. Returns true if the event was
54 // handled by the drag. 55 // handled by the drag.
55 bool DispatchPointerEvent(const ui::PointerEvent& event, 56 bool DispatchPointerEvent(const ui::PointerEvent& event,
56 ServerWindow* current_target); 57 ServerWindow* current_target);
57 58
58 void OnWillDestroyDragTargetConnection(DragTargetConnection* connection); 59 void OnWillDestroyDragTargetConnection(DragTargetConnection* connection);
(...skipping 17 matching lines...) Expand all
76 // Sets |current_target_window_| to |current_target|, making sure that we add 77 // Sets |current_target_window_| to |current_target|, making sure that we add
77 // and release ServerWindow observers correctly. 78 // and release ServerWindow observers correctly.
78 void SetCurrentTargetWindow(ServerWindow* current_target); 79 void SetCurrentTargetWindow(ServerWindow* current_target);
79 80
80 // Updates the possible cursor effects for |window|. |bitmask| is a 81 // Updates the possible cursor effects for |window|. |bitmask| is a
81 // bitmask of the current valid drag operations. 82 // bitmask of the current valid drag operations.
82 void SetWindowDropOperations(ServerWindow* window, DropEffectBitmask bitmask); 83 void SetWindowDropOperations(ServerWindow* window, DropEffectBitmask bitmask);
83 84
84 // Returns the ui::mojom::Cursor for the window |bitmask|, adjusted for types 85 // Returns the ui::mojom::Cursor for the window |bitmask|, adjusted for types
85 // that the drag source allows. 86 // that the drag source allows.
86 int32_t CursorForEffectBitmask(DropEffectBitmask bitmask); 87 ui::mojom::Cursor CursorForEffectBitmask(DropEffectBitmask bitmask);
87 88
88 // Ensure that |window| has an entry in |window_state_| and that we're an 89 // Ensure that |window| has an entry in |window_state_| and that we're an
89 // observer. 90 // observer.
90 void EnsureWindowObserved(ServerWindow* window); 91 void EnsureWindowObserved(ServerWindow* window);
91 92
92 void QueueOperation(ServerWindow* window, 93 void QueueOperation(ServerWindow* window,
93 OperationType type, 94 OperationType type,
94 uint32_t event_flags, 95 uint32_t event_flags,
95 gfx::Point screen_position); 96 gfx::Point screen_position);
96 void DispatchOperation(ServerWindow* window, WindowState* state); 97 void DispatchOperation(ServerWindow* window, WindowState* state);
(...skipping 12 matching lines...) Expand all
109 // Object to notify about all cursor changes. 110 // Object to notify about all cursor changes.
110 DragCursorUpdater* cursor_updater_; 111 DragCursorUpdater* cursor_updater_;
111 112
112 // A bit-field of acceptable drag operations offered by the source. 113 // A bit-field of acceptable drag operations offered by the source.
113 const DropEffectBitmask drag_operations_; 114 const DropEffectBitmask drag_operations_;
114 115
115 // Only act on pointer events that meet this id. 116 // Only act on pointer events that meet this id.
116 const int32_t drag_pointer_id_; 117 const int32_t drag_pointer_id_;
117 118
118 // The current mouse cursor during the drag. 119 // The current mouse cursor during the drag.
119 int32_t current_cursor_; 120 ui::mojom::Cursor current_cursor_;
120 121
121 // Sending OnDragOver() to our |source_| destroys us; there is a period where 122 // Sending OnDragOver() to our |source_| destroys us; there is a period where
122 // we have to continue to exist, but not process any more pointer events. 123 // we have to continue to exist, but not process any more pointer events.
123 bool waiting_for_final_drop_response_ = false; 124 bool waiting_for_final_drop_response_ = false;
124 125
125 ServerWindow* source_window_; 126 ServerWindow* source_window_;
126 ServerWindow* current_target_window_ = nullptr; 127 ServerWindow* current_target_window_ = nullptr;
127 128
128 // The target connection that |source_window_| is part of. 129 // The target connection that |source_window_| is part of.
129 DragTargetConnection* source_connection_; 130 DragTargetConnection* source_connection_;
(...skipping 13 matching lines...) Expand all
143 144
144 base::WeakPtrFactory<DragController> weak_factory_; 145 base::WeakPtrFactory<DragController> weak_factory_;
145 146
146 DISALLOW_COPY_AND_ASSIGN(DragController); 147 DISALLOW_COPY_AND_ASSIGN(DragController);
147 }; 148 };
148 149
149 } // namespace ws 150 } // namespace ws
150 } // namespace ui 151 } // namespace ui
151 152
152 #endif // SERVICES_UI_WS_DRAG_CONTROLLER_H_ 153 #endif // SERVICES_UI_WS_DRAG_CONTROLLER_H_
OLDNEW
« no previous file with comments | « services/ui/ws/display.cc ('k') | services/ui/ws/drag_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698