| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 public: | 71 public: |
| 72 WindowTree(WindowServer* window_server, | 72 WindowTree(WindowServer* window_server, |
| 73 const UserId& user_id, | 73 const UserId& user_id, |
| 74 ServerWindow* root, | 74 ServerWindow* root, |
| 75 std::unique_ptr<AccessPolicy> access_policy); | 75 std::unique_ptr<AccessPolicy> access_policy); |
| 76 ~WindowTree() override; | 76 ~WindowTree() override; |
| 77 | 77 |
| 78 void Init(std::unique_ptr<WindowTreeBinding> binding, | 78 void Init(std::unique_ptr<WindowTreeBinding> binding, |
| 79 mojom::WindowTreePtr tree); | 79 mojom::WindowTreePtr tree); |
| 80 | 80 |
| 81 // Called if this WindowTree hosts a WindowManager. | 81 // Called if this WindowTree hosts a WindowManager. See mojom for details |
| 82 void ConfigureWindowManager(); | 82 // on |automatically_create_display_roots|. |
| 83 void ConfigureWindowManager(bool automatically_create_display_roots); |
| 84 |
| 85 bool automatically_create_display_roots() const { |
| 86 return automatically_create_display_roots_; |
| 87 } |
| 83 | 88 |
| 84 ClientSpecificId id() const { return id_; } | 89 ClientSpecificId id() const { return id_; } |
| 85 | 90 |
| 86 void set_embedder_intercepts_events() { embedder_intercepts_events_ = true; } | 91 void set_embedder_intercepts_events() { embedder_intercepts_events_ = true; } |
| 87 bool embedder_intercepts_events() const { | 92 bool embedder_intercepts_events() const { |
| 88 return embedder_intercepts_events_; | 93 return embedder_intercepts_events_; |
| 89 } | 94 } |
| 90 | 95 |
| 91 const UserId& user_id() const { return user_id_; } | 96 const UserId& user_id() const { return user_id_; } |
| 92 | 97 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 376 |
| 372 // Calls OnChangeCompleted() on the client. | 377 // Calls OnChangeCompleted() on the client. |
| 373 void NotifyChangeCompleted(uint32_t change_id, | 378 void NotifyChangeCompleted(uint32_t change_id, |
| 374 mojom::WindowManagerErrorCode error_code); | 379 mojom::WindowManagerErrorCode error_code); |
| 375 | 380 |
| 376 // Callback for when WmMoveDragImage completes. This sends off the next | 381 // Callback for when WmMoveDragImage completes. This sends off the next |
| 377 // queued move under the image if the mouse had further moves while we were | 382 // queued move under the image if the mouse had further moves while we were |
| 378 // waiting for the last move to be acknowledged. | 383 // waiting for the last move to be acknowledged. |
| 379 void OnWmMoveDragImageAck(); | 384 void OnWmMoveDragImageAck(); |
| 380 | 385 |
| 386 // Called from SetDisplayRoot(), see mojom for details. |
| 387 bool ProcessSetDisplayRoot(int64_t display_id, |
| 388 const ClientWindowId& client_window_id); |
| 389 |
| 381 // WindowTree: | 390 // WindowTree: |
| 382 void NewWindow(uint32_t change_id, | 391 void NewWindow(uint32_t change_id, |
| 383 Id transport_window_id, | 392 Id transport_window_id, |
| 384 const base::Optional< | 393 const base::Optional< |
| 385 std::unordered_map<std::string, std::vector<uint8_t>>>& | 394 std::unordered_map<std::string, std::vector<uint8_t>>>& |
| 386 transport_properties) override; | 395 transport_properties) override; |
| 387 void NewTopLevelWindow( | 396 void NewTopLevelWindow( |
| 388 uint32_t change_id, | 397 uint32_t change_id, |
| 389 Id transport_window_id, | 398 Id transport_window_id, |
| 390 const std::unordered_map<std::string, std::vector<uint8_t>>& | 399 const std::unordered_map<std::string, std::vector<uint8_t>>& |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 void CancelWindowMove(Id window_id) override; | 489 void CancelWindowMove(Id window_id) override; |
| 481 | 490 |
| 482 // mojom::WindowManagerClient: | 491 // mojom::WindowManagerClient: |
| 483 void AddAccelerators(std::vector<mojom::WmAcceleratorPtr> accelerators, | 492 void AddAccelerators(std::vector<mojom::WmAcceleratorPtr> accelerators, |
| 484 const AddAcceleratorsCallback& callback) override; | 493 const AddAcceleratorsCallback& callback) override; |
| 485 void RemoveAccelerator(uint32_t id) override; | 494 void RemoveAccelerator(uint32_t id) override; |
| 486 void AddActivationParent(Id transport_window_id) override; | 495 void AddActivationParent(Id transport_window_id) override; |
| 487 void RemoveActivationParent(Id transport_window_id) override; | 496 void RemoveActivationParent(Id transport_window_id) override; |
| 488 void ActivateNextWindow() override; | 497 void ActivateNextWindow() override; |
| 489 void SetExtendedHitArea(Id window_id, const gfx::Insets& hit_area) override; | 498 void SetExtendedHitArea(Id window_id, const gfx::Insets& hit_area) override; |
| 499 void SetDisplayRoot(int64_t display_id, |
| 500 Id window_id, |
| 501 const SetDisplayRootCallback& callback) override; |
| 490 void WmResponse(uint32_t change_id, bool response) override; | 502 void WmResponse(uint32_t change_id, bool response) override; |
| 491 void WmSetBoundsResponse(uint32_t change_id) override; | 503 void WmSetBoundsResponse(uint32_t change_id) override; |
| 492 void WmRequestClose(Id transport_window_id) override; | 504 void WmRequestClose(Id transport_window_id) override; |
| 493 void WmSetFrameDecorationValues( | 505 void WmSetFrameDecorationValues( |
| 494 mojom::FrameDecorationValuesPtr values) override; | 506 mojom::FrameDecorationValuesPtr values) override; |
| 495 void WmSetNonClientCursor(uint32_t window_id, | 507 void WmSetNonClientCursor(uint32_t window_id, |
| 496 mojom::CursorType cursor_id) override; | 508 mojom::CursorType cursor_id) override; |
| 497 void OnWmCreatedTopLevelWindow(uint32_t change_id, | 509 void OnWmCreatedTopLevelWindow(uint32_t change_id, |
| 498 Id transport_window_id) override; | 510 Id transport_window_id) override; |
| 499 void OnAcceleratorAck( | 511 void OnAcceleratorAck( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 bool pointer_watcher_want_moves_ = false; | 594 bool pointer_watcher_want_moves_ = false; |
| 583 | 595 |
| 584 // True if StartPointerWatcher() was called. | 596 // True if StartPointerWatcher() was called. |
| 585 bool has_pointer_watcher_ = false; | 597 bool has_pointer_watcher_ = false; |
| 586 | 598 |
| 587 // WindowManager the current event came from. | 599 // WindowManager the current event came from. |
| 588 WindowManagerState* event_source_wms_ = nullptr; | 600 WindowManagerState* event_source_wms_ = nullptr; |
| 589 | 601 |
| 590 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; | 602 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; |
| 591 | 603 |
| 604 // TODO(sky): move all window manager specific state into struct to make it |
| 605 // clear what applies only to the window manager. |
| 592 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> | 606 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> |
| 593 window_manager_internal_client_binding_; | 607 window_manager_internal_client_binding_; |
| 594 mojom::WindowManager* window_manager_internal_; | 608 mojom::WindowManager* window_manager_internal_; |
| 595 std::unique_ptr<WindowManagerState> window_manager_state_; | 609 std::unique_ptr<WindowManagerState> window_manager_state_; |
| 610 // See mojom for details. |
| 611 bool automatically_create_display_roots_ = true; |
| 596 | 612 |
| 597 std::unique_ptr<WaitingForTopLevelWindowInfo> | 613 std::unique_ptr<WaitingForTopLevelWindowInfo> |
| 598 waiting_for_top_level_window_info_; | 614 waiting_for_top_level_window_info_; |
| 599 bool embedder_intercepts_events_ = false; | 615 bool embedder_intercepts_events_ = false; |
| 600 | 616 |
| 601 // State kept while we're waiting for the window manager to ack a | 617 // State kept while we're waiting for the window manager to ack a |
| 602 // WmMoveDragImage. Non-null while we're waiting for a response. | 618 // WmMoveDragImage. Non-null while we're waiting for a response. |
| 603 struct DragMoveState; | 619 struct DragMoveState; |
| 604 std::unique_ptr<DragMoveState> drag_move_state_; | 620 std::unique_ptr<DragMoveState> drag_move_state_; |
| 605 | 621 |
| 606 // A weak ptr factory for callbacks from the window manager for when we send | 622 // A weak ptr factory for callbacks from the window manager for when we send |
| 607 // a image move. All weak ptrs are invalidated when a drag is completed. | 623 // a image move. All weak ptrs are invalidated when a drag is completed. |
| 608 base::WeakPtrFactory<WindowTree> drag_weak_factory_; | 624 base::WeakPtrFactory<WindowTree> drag_weak_factory_; |
| 609 | 625 |
| 610 DISALLOW_COPY_AND_ASSIGN(WindowTree); | 626 DISALLOW_COPY_AND_ASSIGN(WindowTree); |
| 611 }; | 627 }; |
| 612 | 628 |
| 613 } // namespace ws | 629 } // namespace ws |
| 614 } // namespace ui | 630 } // namespace ui |
| 615 | 631 |
| 616 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ | 632 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ |
| OLD | NEW |