| OLD | NEW |
| 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 SERVICES_UI_WS_WINDOW_TREE_H_ | 5 #ifndef SERVICES_UI_WS_WINDOW_TREE_H_ |
| 6 #define SERVICES_UI_WS_WINDOW_TREE_H_ | 6 #define SERVICES_UI_WS_WINDOW_TREE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 bool CanEmbed(const ClientWindowId& window_id) const; | 330 bool CanEmbed(const ClientWindowId& window_id) const; |
| 331 void PrepareForEmbed(ServerWindow* window); | 331 void PrepareForEmbed(ServerWindow* window); |
| 332 void RemoveChildrenAsPartOfEmbed(ServerWindow* window); | 332 void RemoveChildrenAsPartOfEmbed(ServerWindow* window); |
| 333 | 333 |
| 334 // Generates a new event id for an accelerator or event ack, sets it in | 334 // Generates a new event id for an accelerator or event ack, sets it in |
| 335 // |event_ack_id_| and returns it. | 335 // |event_ack_id_| and returns it. |
| 336 uint32_t GenerateEventAckId(); | 336 uint32_t GenerateEventAckId(); |
| 337 | 337 |
| 338 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); | 338 void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event); |
| 339 | 339 |
| 340 // Returns true if the client has a pointer watcher and this event matches. |
| 341 bool EventMatchesPointerWatcher(const ui::Event& event); |
| 342 |
| 340 // Calls OnChangeCompleted() on the client. | 343 // Calls OnChangeCompleted() on the client. |
| 341 void NotifyChangeCompleted(uint32_t change_id, | 344 void NotifyChangeCompleted(uint32_t change_id, |
| 342 mojom::WindowManagerErrorCode error_code); | 345 mojom::WindowManagerErrorCode error_code); |
| 343 | 346 |
| 344 // WindowTree: | 347 // WindowTree: |
| 345 void NewWindow(uint32_t change_id, | 348 void NewWindow(uint32_t change_id, |
| 346 Id transport_window_id, | 349 Id transport_window_id, |
| 347 mojo::Map<mojo::String, mojo::Array<uint8_t>> | 350 mojo::Map<mojo::String, mojo::Array<uint8_t>> |
| 348 transport_properties) override; | 351 transport_properties) override; |
| 349 void NewTopLevelWindow(uint32_t change_id, | 352 void NewTopLevelWindow(uint32_t change_id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 364 Id relative_window_id, | 367 Id relative_window_id, |
| 365 mojom::OrderDirection direction) override; | 368 mojom::OrderDirection direction) override; |
| 366 void GetWindowTree( | 369 void GetWindowTree( |
| 367 Id window_id, | 370 Id window_id, |
| 368 const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) | 371 const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) |
| 369 override; | 372 override; |
| 370 void SetCapture(uint32_t change_id, Id window_id) override; | 373 void SetCapture(uint32_t change_id, Id window_id) override; |
| 371 void ReleaseCapture(uint32_t change_id, Id window_id) override; | 374 void ReleaseCapture(uint32_t change_id, Id window_id) override; |
| 372 void SetEventObserver(mojom::EventMatcherPtr matcher, | 375 void SetEventObserver(mojom::EventMatcherPtr matcher, |
| 373 uint32_t observer_id) override; | 376 uint32_t observer_id) override; |
| 377 void StartPointerWatcher(bool want_moves, |
| 378 uint32_t pointer_watcher_id) override; |
| 379 void StopPointerWatcher() override; |
| 374 void SetWindowBounds(uint32_t change_id, | 380 void SetWindowBounds(uint32_t change_id, |
| 375 Id window_id, | 381 Id window_id, |
| 376 const gfx::Rect& bounds) override; | 382 const gfx::Rect& bounds) override; |
| 377 void SetWindowVisibility(uint32_t change_id, | 383 void SetWindowVisibility(uint32_t change_id, |
| 378 Id window_id, | 384 Id window_id, |
| 379 bool visible) override; | 385 bool visible) override; |
| 380 void SetWindowProperty(uint32_t change_id, | 386 void SetWindowProperty(uint32_t change_id, |
| 381 Id transport_window_id, | 387 Id transport_window_id, |
| 382 const mojo::String& name, | 388 const mojo::String& name, |
| 383 mojo::Array<uint8_t> value) override; | 389 mojo::Array<uint8_t> value) override; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 // client (ClientWindowId). | 483 // client (ClientWindowId). |
| 478 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; | 484 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; |
| 479 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; | 485 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; |
| 480 | 486 |
| 481 uint32_t event_ack_id_; | 487 uint32_t event_ack_id_; |
| 482 | 488 |
| 483 // A client is considered janky if it hasn't ACK'ed input events within a | 489 // A client is considered janky if it hasn't ACK'ed input events within a |
| 484 // reasonable timeframe. | 490 // reasonable timeframe. |
| 485 bool janky_ = false; | 491 bool janky_ = false; |
| 486 | 492 |
| 487 // Set when the client is using SetEventObserver() to observe events, | 493 // Whether the client is observing pointer events. |
| 488 // otherwise null. | 494 bool has_pointer_watcher_ = false; |
| 489 std::unique_ptr<EventMatcher> event_observer_matcher_; | |
| 490 | 495 |
| 491 // The ID supplied by the client for the current event observer. | 496 // For performance reasons, only send move events if the client explicitly |
| 492 uint32_t event_observer_id_ = 0; | 497 // requests them. |
| 498 bool pointer_watcher_want_moves_ = false; |
| 499 |
| 500 // The ID supplied by the client for the current pointer watcher. |
| 501 uint32_t pointer_watcher_id_ = 0; |
| 493 | 502 |
| 494 // WindowManager the current event came from. | 503 // WindowManager the current event came from. |
| 495 WindowManagerState* event_source_wms_ = nullptr; | 504 WindowManagerState* event_source_wms_ = nullptr; |
| 496 | 505 |
| 497 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; | 506 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; |
| 498 | 507 |
| 499 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> | 508 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> |
| 500 window_manager_internal_client_binding_; | 509 window_manager_internal_client_binding_; |
| 501 mojom::WindowManager* window_manager_internal_; | 510 mojom::WindowManager* window_manager_internal_; |
| 502 std::unique_ptr<WindowManagerState> window_manager_state_; | 511 std::unique_ptr<WindowManagerState> window_manager_state_; |
| 503 | 512 |
| 504 std::unique_ptr<WaitingForTopLevelWindowInfo> | 513 std::unique_ptr<WaitingForTopLevelWindowInfo> |
| 505 waiting_for_top_level_window_info_; | 514 waiting_for_top_level_window_info_; |
| 506 bool embedder_intercepts_events_ = false; | 515 bool embedder_intercepts_events_ = false; |
| 507 | 516 |
| 508 DISALLOW_COPY_AND_ASSIGN(WindowTree); | 517 DISALLOW_COPY_AND_ASSIGN(WindowTree); |
| 509 }; | 518 }; |
| 510 | 519 |
| 511 } // namespace ws | 520 } // namespace ws |
| 512 } // namespace ui | 521 } // namespace ui |
| 513 | 522 |
| 514 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ | 523 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ |
| OLD | NEW |