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

Side by Side Diff: components/mus/ws/window_tree.h

Issue 1909733002: mus: Add EventObserver to allow passively listening to UI events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_MUS_WS_WINDOW_TREE_H_ 5 #ifndef COMPONENTS_MUS_WS_WINDOW_TREE_H_
6 #define COMPONENTS_MUS_WS_WINDOW_TREE_H_ 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 21 matching lines...) Expand all
32 namespace ui { 32 namespace ui {
33 class Event; 33 class Event;
34 } 34 }
35 35
36 namespace mus { 36 namespace mus {
37 namespace ws { 37 namespace ws {
38 38
39 class AccessPolicy; 39 class AccessPolicy;
40 class DisplayManager; 40 class DisplayManager;
41 class Display; 41 class Display;
42 class EventTester;
42 class ServerWindow; 43 class ServerWindow;
43 class TargetedEvent; 44 class TargetedEvent;
44 class WindowManagerState; 45 class WindowManagerState;
45 class WindowServer; 46 class WindowServer;
46 class WindowTreeTest; 47 class WindowTreeTest;
47 48
48 namespace test { 49 namespace test {
49 class WindowTreeTestApi; 50 class WindowTreeTestApi;
50 } 51 }
51 52
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const ServerWindow* new_focused_window); 201 const ServerWindow* new_focused_window);
201 void ProcessLostCapture(const ServerWindow* old_lost_capture, 202 void ProcessLostCapture(const ServerWindow* old_lost_capture,
202 bool originated_change); 203 bool originated_change);
203 void ProcessTransientWindowAdded(const ServerWindow* window, 204 void ProcessTransientWindowAdded(const ServerWindow* window,
204 const ServerWindow* transient_window, 205 const ServerWindow* transient_window,
205 bool originated_change); 206 bool originated_change);
206 void ProcessTransientWindowRemoved(const ServerWindow* window, 207 void ProcessTransientWindowRemoved(const ServerWindow* window,
207 const ServerWindow* transient_window, 208 const ServerWindow* transient_window,
208 bool originated_change); 209 bool originated_change);
209 210
211 // Sends this event to the client if it matches an active event observer.
212 void SendToEventObserver(const ui::Event& event);
213
210 private: 214 private:
211 friend class test::WindowTreeTestApi; 215 friend class test::WindowTreeTestApi;
212 216
213 struct WaitingForTopLevelWindowInfo { 217 struct WaitingForTopLevelWindowInfo {
214 WaitingForTopLevelWindowInfo(const ClientWindowId& client_window_id, 218 WaitingForTopLevelWindowInfo(const ClientWindowId& client_window_id,
215 uint32_t wm_change_id) 219 uint32_t wm_change_id)
216 : client_window_id(client_window_id), wm_change_id(wm_change_id) {} 220 : client_window_id(client_window_id), wm_change_id(wm_change_id) {}
217 ~WaitingForTopLevelWindowInfo() {} 221 ~WaitingForTopLevelWindowInfo() {}
218 222
219 // Id supplied from the client. 223 // Id supplied from the client.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 void ReorderWindow(uint32_t change_Id, 332 void ReorderWindow(uint32_t change_Id,
329 Id window_id, 333 Id window_id,
330 Id relative_window_id, 334 Id relative_window_id,
331 mojom::OrderDirection direction) override; 335 mojom::OrderDirection direction) override;
332 void GetWindowTree( 336 void GetWindowTree(
333 Id window_id, 337 Id window_id,
334 const mojo::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) 338 const mojo::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback)
335 override; 339 override;
336 void SetCapture(uint32_t change_id, Id window_id) override; 340 void SetCapture(uint32_t change_id, Id window_id) override;
337 void ReleaseCapture(uint32_t change_id, Id window_id) override; 341 void ReleaseCapture(uint32_t change_id, Id window_id) override;
342 void SetEventObserver(mojom::EventMatcherPtr matcher) override;
343 void ClearEventObserver() override;
338 void SetWindowBounds(uint32_t change_id, 344 void SetWindowBounds(uint32_t change_id,
339 Id window_id, 345 Id window_id,
340 mojo::RectPtr bounds) override; 346 mojo::RectPtr bounds) override;
341 void SetWindowVisibility(uint32_t change_id, 347 void SetWindowVisibility(uint32_t change_id,
342 Id window_id, 348 Id window_id,
343 bool visible) override; 349 bool visible) override;
344 void SetWindowProperty(uint32_t change_id, 350 void SetWindowProperty(uint32_t change_id,
345 Id transport_window_id, 351 Id transport_window_id,
346 const mojo::String& name, 352 const mojo::String& name,
347 mojo::Array<uint8_t> value) override; 353 mojo::Array<uint8_t> value) override;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 base::hash_map<WindowId, ServerWindow*> created_window_map_; 428 base::hash_map<WindowId, ServerWindow*> created_window_map_;
423 429
424 // The client is allowed to assign ids. These two maps providing the mapping 430 // The client is allowed to assign ids. These two maps providing the mapping
425 // from the ids native to the server (WindowId) to those understood by the 431 // from the ids native to the server (WindowId) to those understood by the
426 // client (ClientWindowId). 432 // client (ClientWindowId).
427 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; 433 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_;
428 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; 434 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_;
429 435
430 uint32_t event_ack_id_; 436 uint32_t event_ack_id_;
431 437
438 // Set when the client is using SetEventObserver() to observe events,
439 // otherwise null.
440 std::unique_ptr<EventTester> event_observer_tester_;
441
432 // WindowManager the current event came from. 442 // WindowManager the current event came from.
433 WindowManagerState* event_source_wms_ = nullptr; 443 WindowManagerState* event_source_wms_ = nullptr;
434 444
435 std::queue<scoped_ptr<TargetedEvent>> event_queue_; 445 std::queue<scoped_ptr<TargetedEvent>> event_queue_;
436 446
437 scoped_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> 447 scoped_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>>
438 window_manager_internal_client_binding_; 448 window_manager_internal_client_binding_;
439 mojom::WindowManager* window_manager_internal_; 449 mojom::WindowManager* window_manager_internal_;
440 450
441 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_; 451 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_;
442 452
443 DISALLOW_COPY_AND_ASSIGN(WindowTree); 453 DISALLOW_COPY_AND_ASSIGN(WindowTree);
444 }; 454 };
445 455
446 } // namespace ws 456 } // namespace ws
447 } // namespace mus 457 } // namespace mus
448 458
449 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_ 459 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698