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

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

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear the implicit pointer drags before start. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_EVENT_DISPATCHER_H_ 5 #ifndef SERVICES_UI_WS_EVENT_DISPATCHER_H_
6 #define SERVICES_UI_WS_EVENT_DISPATCHER_H_ 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "services/ui/common/types.h" 15 #include "services/ui/common/types.h"
16 #include "services/ui/public/interfaces/event_matcher.mojom.h" 16 #include "services/ui/public/interfaces/event_matcher.mojom.h"
17 #include "services/ui/ws/modal_window_controller.h" 17 #include "services/ui/ws/modal_window_controller.h"
18 #include "services/ui/ws/server_window_observer.h" 18 #include "services/ui/ws/server_window_observer.h"
19 #include "ui/gfx/geometry/rect_f.h" 19 #include "ui/gfx/geometry/rect_f.h"
20 20
21 namespace ui { 21 namespace ui {
22 class Event; 22 class Event;
23 class KeyEvent; 23 class KeyEvent;
24 class LocatedEvent; 24 class LocatedEvent;
25 25
26 namespace ws { 26 namespace ws {
27 27
28 class Accelerator; 28 class Accelerator;
29 class DragController;
30 class DragSource;
29 class EventDispatcherDelegate; 31 class EventDispatcherDelegate;
30 class ServerWindow; 32 class ServerWindow;
33 class WindowTree;
31 34
32 namespace test { 35 namespace test {
33 class EventDispatcherTestApi; 36 class EventDispatcherTestApi;
34 } 37 }
35 38
36 // Handles dispatching events to the right location as well as updating focus. 39 // Handles dispatching events to the right location as well as updating focus.
37 class EventDispatcher : public ServerWindowObserver { 40 class EventDispatcher : public ServerWindowObserver {
38 public: 41 public:
39 enum class AcceleratorMatchPhase { 42 enum class AcceleratorMatchPhase {
40 // Both pre and post should be considered. 43 // Both pre and post should be considered.
(...skipping 27 matching lines...) Expand all
68 // Setting capture can fail if the window is blocked by a modal window 71 // Setting capture can fail if the window is blocked by a modal window
69 // (indicated by returning |false|). 72 // (indicated by returning |false|).
70 bool SetCaptureWindow(ServerWindow* capture_window, 73 bool SetCaptureWindow(ServerWindow* capture_window,
71 ClientSpecificId client_id); 74 ClientSpecificId client_id);
72 75
73 // Id of the client that capture events are sent to. 76 // Id of the client that capture events are sent to.
74 ClientSpecificId capture_window_client_id() const { 77 ClientSpecificId capture_window_client_id() const {
75 return capture_window_client_id_; 78 return capture_window_client_id_;
76 } 79 }
77 80
81 void SetDragDropSourceWindow(
82 DragSource* drag_source,
83 ServerWindow* window,
84 int32_t drag_pointer,
85 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data,
86 uint32_t drag_operations);
87 void EndDragDrop();
88
78 // Adds a system modal window. The window remains modal to system until it is 89 // Adds a system modal window. The window remains modal to system until it is
79 // destroyed. There can exist multiple system modal windows, in which case the 90 // destroyed. There can exist multiple system modal windows, in which case the
80 // one that is visible and added most recently or shown most recently would be 91 // one that is visible and added most recently or shown most recently would be
81 // the active one. 92 // the active one.
82 void AddSystemModalWindow(ServerWindow* window); 93 void AddSystemModalWindow(ServerWindow* window);
83 94
84 // Checks if |modal_window| is a visible modal window that blocks current 95 // Checks if |modal_window| is a visible modal window that blocks current
85 // capture window and if that's the case, releases the capture. 96 // capture window and if that's the case, releases the capture.
86 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window); 97 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window);
87 98
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void ObserveWindow(ServerWindow* winodw); 208 void ObserveWindow(ServerWindow* winodw);
198 void UnobserveWindow(ServerWindow* winodw); 209 void UnobserveWindow(ServerWindow* winodw);
199 210
200 // Returns an Accelerator bound to the specified code/flags, and of the 211 // Returns an Accelerator bound to the specified code/flags, and of the
201 // matching |phase|. Otherwise returns null. 212 // matching |phase|. Otherwise returns null.
202 Accelerator* FindAccelerator(const ui::KeyEvent& event, 213 Accelerator* FindAccelerator(const ui::KeyEvent& event,
203 const ui::mojom::AcceleratorPhase phase); 214 const ui::mojom::AcceleratorPhase phase);
204 215
205 ServerWindow* FindDeepestVisibleWindowForEvents(gfx::Point* location); 216 ServerWindow* FindDeepestVisibleWindowForEvents(gfx::Point* location);
206 217
218 // Clears the implicit captures in |pointer_targets_|, with the exception of
219 // |window|. |window| may be null.
220 void CancelImplicitCaptureExcept(ServerWindow* window);
221
207 // ServerWindowObserver: 222 // ServerWindowObserver:
208 void OnWillChangeWindowHierarchy(ServerWindow* window, 223 void OnWillChangeWindowHierarchy(ServerWindow* window,
209 ServerWindow* new_parent, 224 ServerWindow* new_parent,
210 ServerWindow* old_parent) override; 225 ServerWindow* old_parent) override;
211 void OnWindowVisibilityChanged(ServerWindow* window) override; 226 void OnWindowVisibilityChanged(ServerWindow* window) override;
212 void OnWindowDestroyed(ServerWindow* window) override; 227 void OnWindowDestroyed(ServerWindow* window) override;
213 228
214 EventDispatcherDelegate* delegate_; 229 EventDispatcherDelegate* delegate_;
215 230
216 ServerWindow* capture_window_; 231 ServerWindow* capture_window_;
217 ClientSpecificId capture_window_client_id_; 232 ClientSpecificId capture_window_client_id_;
218 233
234 std::unique_ptr<DragController> drag_controller_;
235
219 ModalWindowController modal_window_controller_; 236 ModalWindowController modal_window_controller_;
220 237
221 bool mouse_button_down_; 238 bool mouse_button_down_;
222 ServerWindow* mouse_cursor_source_window_; 239 ServerWindow* mouse_cursor_source_window_;
223 bool mouse_cursor_in_non_client_area_; 240 bool mouse_cursor_in_non_client_area_;
224 241
225 // The on screen location of the mouse pointer. This can be outside the 242 // The on screen location of the mouse pointer. This can be outside the
226 // bounds of |mouse_cursor_source_window_|, which can capture the cursor. 243 // bounds of |mouse_cursor_source_window_|, which can capture the cursor.
227 gfx::Point mouse_pointer_last_location_; 244 gfx::Point mouse_pointer_last_location_;
228 245
(...skipping 15 matching lines...) Expand all
244 AcceleratorMatchPhase::ANY; 261 AcceleratorMatchPhase::ANY;
245 #endif 262 #endif
246 263
247 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); 264 DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
248 }; 265 };
249 266
250 } // namespace ws 267 } // namespace ws
251 } // namespace ui 268 } // namespace ui
252 269
253 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ 270 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698