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

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: review comments 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 EventMatcher;
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;
338 void SetWindowBounds(uint32_t change_id, 343 void SetWindowBounds(uint32_t change_id,
339 Id window_id, 344 Id window_id,
340 mojo::RectPtr bounds) override; 345 mojo::RectPtr bounds) override;
341 void SetWindowVisibility(uint32_t change_id, 346 void SetWindowVisibility(uint32_t change_id,
342 Id window_id, 347 Id window_id,
343 bool visible) override; 348 bool visible) override;
344 void SetWindowProperty(uint32_t change_id, 349 void SetWindowProperty(uint32_t change_id,
345 Id transport_window_id, 350 Id transport_window_id,
346 const mojo::String& name, 351 const mojo::String& name,
347 mojo::Array<uint8_t> value) override; 352 mojo::Array<uint8_t> value) override;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 Id transport_window_id) override; 401 Id transport_window_id) override;
397 402
398 // AccessPolicyDelegate: 403 // AccessPolicyDelegate:
399 bool HasRootForAccessPolicy(const ServerWindow* window) const override; 404 bool HasRootForAccessPolicy(const ServerWindow* window) const override;
400 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; 405 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override;
401 bool IsWindowRootOfAnotherTreeForAccessPolicy( 406 bool IsWindowRootOfAnotherTreeForAccessPolicy(
402 const ServerWindow* window) const override; 407 const ServerWindow* window) const override;
403 408
404 WindowServer* window_server_; 409 WindowServer* window_server_;
405 410
406 const UserId user_id_; 411 UserId user_id_;
407 412
408 // Id of this tree as assigned by WindowServer. 413 // Id of this tree as assigned by WindowServer.
409 const ConnectionSpecificId id_; 414 const ConnectionSpecificId id_;
410 415
411 ConnectionSpecificId next_window_id_; 416 ConnectionSpecificId next_window_id_;
412 417
413 scoped_ptr<WindowTreeBinding> binding_; 418 scoped_ptr<WindowTreeBinding> binding_;
414 419
415 scoped_ptr<mus::ws::AccessPolicy> access_policy_; 420 scoped_ptr<mus::ws::AccessPolicy> access_policy_;
416 421
417 // The roots, or embed points, of this tree. A WindowTree may have any 422 // The roots, or embed points, of this tree. A WindowTree may have any
418 // number of roots, including 0. 423 // number of roots, including 0.
419 std::set<const ServerWindow*> roots_; 424 std::set<const ServerWindow*> roots_;
420 425
421 // The windows created by this tree. This tree owns these objects. 426 // The windows created by this tree. This tree owns these objects.
422 base::hash_map<WindowId, ServerWindow*> created_window_map_; 427 base::hash_map<WindowId, ServerWindow*> created_window_map_;
423 428
424 // The client is allowed to assign ids. These two maps providing the mapping 429 // 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 430 // from the ids native to the server (WindowId) to those understood by the
426 // client (ClientWindowId). 431 // client (ClientWindowId).
427 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; 432 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_;
428 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; 433 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_;
429 434
430 uint32_t event_ack_id_; 435 uint32_t event_ack_id_;
431 436
437 // Set when the client is using SetEventObserver() to observe events,
438 // otherwise null.
439 std::unique_ptr<EventMatcher> event_observer_matcher_;
440
432 // WindowManager the current event came from. 441 // WindowManager the current event came from.
433 WindowManagerState* event_source_wms_ = nullptr; 442 WindowManagerState* event_source_wms_ = nullptr;
434 443
435 std::queue<scoped_ptr<TargetedEvent>> event_queue_; 444 std::queue<scoped_ptr<TargetedEvent>> event_queue_;
436 445
437 scoped_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> 446 scoped_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>>
438 window_manager_internal_client_binding_; 447 window_manager_internal_client_binding_;
439 mojom::WindowManager* window_manager_internal_; 448 mojom::WindowManager* window_manager_internal_;
440 449
441 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_; 450 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_;
442 451
443 DISALLOW_COPY_AND_ASSIGN(WindowTree); 452 DISALLOW_COPY_AND_ASSIGN(WindowTree);
444 }; 453 };
445 454
446 } // namespace ws 455 } // namespace ws
447 } // namespace mus 456 } // namespace mus
448 457
449 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_ 458 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698