| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/containers/hash_tables.h" | 18 #include "base/containers/hash_tables.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "cc/ipc/surface_id.mojom.h" | 20 #include "cc/ipc/surface_id.mojom.h" |
| 21 #include "mojo/public/cpp/bindings/associated_binding.h" | 21 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 22 #include "services/ui/public/interfaces/window_tree.mojom.h" | 22 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 23 #include "services/ui/ws/access_policy_delegate.h" | 23 #include "services/ui/ws/access_policy_delegate.h" |
| 24 #include "services/ui/ws/drag_source.h" |
| 25 #include "services/ui/ws/drag_target_connection.h" |
| 24 #include "services/ui/ws/ids.h" | 26 #include "services/ui/ws/ids.h" |
| 25 #include "services/ui/ws/user_id.h" | 27 #include "services/ui/ws/user_id.h" |
| 26 #include "services/ui/ws/window_tree_binding.h" | 28 #include "services/ui/ws/window_tree_binding.h" |
| 27 | 29 |
| 28 namespace gfx { | 30 namespace gfx { |
| 29 class Insets; | 31 class Insets; |
| 30 class Rect; | 32 class Rect; |
| 31 } | 33 } |
| 32 | 34 |
| 33 namespace ui { | 35 namespace ui { |
| 34 class Event; | 36 class Event; |
| 35 } | 37 } |
| 36 | 38 |
| 37 namespace ui { | 39 namespace ui { |
| 38 namespace ws { | 40 namespace ws { |
| 39 | 41 |
| 40 class AccessPolicy; | 42 class AccessPolicy; |
| 41 class DisplayManager; | 43 class DisplayManager; |
| 42 class Display; | 44 class Display; |
| 45 class DragTargetConnection; |
| 43 class EventMatcher; | 46 class EventMatcher; |
| 44 class ServerWindow; | 47 class ServerWindow; |
| 45 class TargetedEvent; | 48 class TargetedEvent; |
| 46 class WindowManagerDisplayRoot; | 49 class WindowManagerDisplayRoot; |
| 47 class WindowManagerState; | 50 class WindowManagerState; |
| 48 class WindowServer; | 51 class WindowServer; |
| 49 class WindowTreeTest; | 52 class WindowTreeTest; |
| 50 | 53 |
| 51 namespace test { | 54 namespace test { |
| 52 class WindowTreeTestApi; | 55 class WindowTreeTestApi; |
| 53 } | 56 } |
| 54 | 57 |
| 55 // WindowTree represents a view onto portions of the window tree. The parts of | 58 // WindowTree represents a view onto portions of the window tree. The parts of |
| 56 // the tree exposed to the client start at the root windows. A WindowTree may | 59 // the tree exposed to the client start at the root windows. A WindowTree may |
| 57 // have any number of roots (including none). A WindowTree may not have | 60 // have any number of roots (including none). A WindowTree may not have |
| 58 // visibility of all the descendants of its roots. | 61 // visibility of all the descendants of its roots. |
| 59 // | 62 // |
| 60 // WindowTree notifies its client as changes happen to windows exposed to the | 63 // WindowTree notifies its client as changes happen to windows exposed to the |
| 61 // the client. | 64 // the client. |
| 62 // | 65 // |
| 63 // See ids.h for details on how WindowTree handles identity of windows. | 66 // See ids.h for details on how WindowTree handles identity of windows. |
| 64 class WindowTree : public mojom::WindowTree, | 67 class WindowTree : public mojom::WindowTree, |
| 65 public AccessPolicyDelegate, | 68 public AccessPolicyDelegate, |
| 66 public mojom::WindowManagerClient { | 69 public mojom::WindowManagerClient, |
| 70 public DragSource, |
| 71 public DragTargetConnection { |
| 67 public: | 72 public: |
| 68 WindowTree(WindowServer* window_server, | 73 WindowTree(WindowServer* window_server, |
| 69 const UserId& user_id, | 74 const UserId& user_id, |
| 70 ServerWindow* root, | 75 ServerWindow* root, |
| 71 std::unique_ptr<AccessPolicy> access_policy); | 76 std::unique_ptr<AccessPolicy> access_policy); |
| 72 ~WindowTree() override; | 77 ~WindowTree() override; |
| 73 | 78 |
| 74 void Init(std::unique_ptr<WindowTreeBinding> binding, | 79 void Init(std::unique_ptr<WindowTreeBinding> binding, |
| 75 mojom::WindowTreePtr tree); | 80 mojom::WindowTreePtr tree); |
| 76 | 81 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 mojo::TextInputStatePtr state) override; | 416 mojo::TextInputStatePtr state) override; |
| 412 void SetImeVisibility(Id transport_window_id, | 417 void SetImeVisibility(Id transport_window_id, |
| 413 bool visible, | 418 bool visible, |
| 414 mojo::TextInputStatePtr state) override; | 419 mojo::TextInputStatePtr state) override; |
| 415 void OnWindowInputEventAck(uint32_t event_id, | 420 void OnWindowInputEventAck(uint32_t event_id, |
| 416 mojom::EventResult result) override; | 421 mojom::EventResult result) override; |
| 417 void SetClientArea( | 422 void SetClientArea( |
| 418 Id transport_window_id, | 423 Id transport_window_id, |
| 419 const gfx::Insets& insets, | 424 const gfx::Insets& insets, |
| 420 mojo::Array<gfx::Rect> transport_additional_client_areas) override; | 425 mojo::Array<gfx::Rect> transport_additional_client_areas) override; |
| 426 void SetCanAcceptDrops(Id window_id, bool accepts_drops) override; |
| 421 void SetHitTestMask(Id transport_window_id, | 427 void SetHitTestMask(Id transport_window_id, |
| 422 const base::Optional<gfx::Rect>& mask) override; | 428 const base::Optional<gfx::Rect>& mask) override; |
| 423 void GetWindowManagerClient( | 429 void GetWindowManagerClient( |
| 424 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) | 430 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) |
| 425 override; | 431 override; |
| 426 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback) | 432 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback) |
| 427 override; | 433 override; |
| 434 void PerformDragDrop(uint32_t change_id, |
| 435 uint32_t source_window_id, |
| 436 int32_t drag_pointer, |
| 437 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data, |
| 438 uint32_t drag_operation) override; |
| 428 void PerformWindowMove(uint32_t change_id, | 439 void PerformWindowMove(uint32_t change_id, |
| 429 Id window_id, | 440 Id window_id, |
| 430 ui::mojom::MoveLoopSource source, | 441 ui::mojom::MoveLoopSource source, |
| 431 const gfx::Point& cursor) override; | 442 const gfx::Point& cursor) override; |
| 432 void CancelWindowMove(Id window_id) override; | 443 void CancelWindowMove(Id window_id) override; |
| 433 | 444 |
| 434 // mojom::WindowManagerClient: | 445 // mojom::WindowManagerClient: |
| 435 void AddAccelerator(uint32_t id, | 446 void AddAccelerator(uint32_t id, |
| 436 mojom::EventMatcherPtr event_matcher, | 447 mojom::EventMatcherPtr event_matcher, |
| 437 const AddAcceleratorCallback& callback) override; | 448 const AddAcceleratorCallback& callback) override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 453 void OnWmCreatedTopLevelWindow(uint32_t change_id, | 464 void OnWmCreatedTopLevelWindow(uint32_t change_id, |
| 454 Id transport_window_id) override; | 465 Id transport_window_id) override; |
| 455 void OnAcceleratorAck(uint32_t event_id, mojom::EventResult result) override; | 466 void OnAcceleratorAck(uint32_t event_id, mojom::EventResult result) override; |
| 456 | 467 |
| 457 // AccessPolicyDelegate: | 468 // AccessPolicyDelegate: |
| 458 bool HasRootForAccessPolicy(const ServerWindow* window) const override; | 469 bool HasRootForAccessPolicy(const ServerWindow* window) const override; |
| 459 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; | 470 bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; |
| 460 bool IsWindowRootOfAnotherTreeForAccessPolicy( | 471 bool IsWindowRootOfAnotherTreeForAccessPolicy( |
| 461 const ServerWindow* window) const override; | 472 const ServerWindow* window) const override; |
| 462 | 473 |
| 474 // DragSource: |
| 475 void OnDragCompleted(bool success) override; |
| 476 ServerWindow* GetWindowById(const WindowId& id) override; |
| 477 DragTargetConnection* GetDragTargetWithRoot( |
| 478 const ServerWindow* window) override; |
| 479 |
| 480 // DragTargetConnection: |
| 481 void PerformOnDragStart( |
| 482 const ServerWindow* window, |
| 483 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override; |
| 484 void PerformOnDragEnter( |
| 485 const ServerWindow* window, |
| 486 uint32_t key_state, |
| 487 const gfx::Point& cursor_offset, |
| 488 uint32_t effect_bitmask, |
| 489 const base::Callback<void(uint32_t)>& callback) override; |
| 490 void PerformOnDragOver( |
| 491 const ServerWindow* window, |
| 492 uint32_t key_state, |
| 493 const gfx::Point& cursor_offset, |
| 494 uint32_t effect_bitmask, |
| 495 const base::Callback<void(uint32_t)>& callback) override; |
| 496 void PerformOnDragLeave(const ServerWindow* window) override; |
| 497 void PerformOnDragDrop( |
| 498 const ServerWindow* window, |
| 499 uint32_t key_state, |
| 500 const gfx::Point& cursor_offset, |
| 501 uint32_t effect_bitmask, |
| 502 const base::Callback<void(uint32_t)>& callback) override; |
| 503 void PerformOnDragFinish(const ServerWindow* window) override; |
| 504 |
| 463 WindowServer* window_server_; | 505 WindowServer* window_server_; |
| 464 | 506 |
| 465 UserId user_id_; | 507 UserId user_id_; |
| 466 | 508 |
| 467 // Id of this tree as assigned by WindowServer. | 509 // Id of this tree as assigned by WindowServer. |
| 468 const ClientSpecificId id_; | 510 const ClientSpecificId id_; |
| 469 std::string name_; | 511 std::string name_; |
| 470 | 512 |
| 471 ClientSpecificId next_window_id_; | 513 ClientSpecificId next_window_id_; |
| 472 | 514 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 waiting_for_top_level_window_info_; | 556 waiting_for_top_level_window_info_; |
| 515 bool embedder_intercepts_events_ = false; | 557 bool embedder_intercepts_events_ = false; |
| 516 | 558 |
| 517 DISALLOW_COPY_AND_ASSIGN(WindowTree); | 559 DISALLOW_COPY_AND_ASSIGN(WindowTree); |
| 518 }; | 560 }; |
| 519 | 561 |
| 520 } // namespace ws | 562 } // namespace ws |
| 521 } // namespace ui | 563 } // namespace ui |
| 522 | 564 |
| 523 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ | 565 #endif // SERVICES_UI_WS_WINDOW_TREE_H_ |
| OLD | NEW |