| 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 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> |
| 11 #include <memory> |
| 11 #include <queue> | 12 #include <queue> |
| 12 #include <set> | 13 #include <set> |
| 13 #include <string> | 14 #include <string> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/containers/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | |
| 19 #include "components/mus/public/interfaces/surface_id.mojom.h" | 19 #include "components/mus/public/interfaces/surface_id.mojom.h" |
| 20 #include "components/mus/public/interfaces/window_tree.mojom.h" | 20 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 21 #include "components/mus/ws/access_policy_delegate.h" | 21 #include "components/mus/ws/access_policy_delegate.h" |
| 22 #include "components/mus/ws/ids.h" | 22 #include "components/mus/ws/ids.h" |
| 23 #include "components/mus/ws/user_id.h" | 23 #include "components/mus/ws/user_id.h" |
| 24 #include "components/mus/ws/window_tree_binding.h" | 24 #include "components/mus/ws/window_tree_binding.h" |
| 25 #include "mojo/public/cpp/bindings/associated_binding.h" | 25 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 26 | 26 |
| 27 namespace gfx { | 27 namespace gfx { |
| 28 class Insets; | 28 class Insets; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 // the client. | 58 // the client. |
| 59 // | 59 // |
| 60 // See ids.h for details on how WindowTree handles identity of windows. | 60 // See ids.h for details on how WindowTree handles identity of windows. |
| 61 class WindowTree : public mojom::WindowTree, | 61 class WindowTree : public mojom::WindowTree, |
| 62 public AccessPolicyDelegate, | 62 public AccessPolicyDelegate, |
| 63 public mojom::WindowManagerClient { | 63 public mojom::WindowManagerClient { |
| 64 public: | 64 public: |
| 65 WindowTree(WindowServer* window_server, | 65 WindowTree(WindowServer* window_server, |
| 66 const UserId& user_id, | 66 const UserId& user_id, |
| 67 ServerWindow* root, | 67 ServerWindow* root, |
| 68 scoped_ptr<AccessPolicy> access_policy); | 68 std::unique_ptr<AccessPolicy> access_policy); |
| 69 ~WindowTree() override; | 69 ~WindowTree() override; |
| 70 | 70 |
| 71 void Init(scoped_ptr<WindowTreeBinding> binding, mojom::WindowTreePtr tree); | 71 void Init(std::unique_ptr<WindowTreeBinding> binding, |
| 72 mojom::WindowTreePtr tree); |
| 72 | 73 |
| 73 // Called if this WindowTree hosts the WindowManager. This happens if | 74 // Called if this WindowTree hosts the WindowManager. This happens if |
| 74 // this WindowTree serves as the root of a WindowTreeHost. | 75 // this WindowTree serves as the root of a WindowTreeHost. |
| 75 void ConfigureWindowManager(); | 76 void ConfigureWindowManager(); |
| 76 | 77 |
| 77 ConnectionSpecificId id() const { return id_; } | 78 ConnectionSpecificId id() const { return id_; } |
| 78 | 79 |
| 79 const UserId& user_id() const { return user_id_; } | 80 const UserId& user_id() const { return user_id_; } |
| 80 | 81 |
| 81 mojom::WindowTreeClient* client() { return binding_->client(); } | 82 mojom::WindowTreeClient* client() { return binding_->client(); } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 WindowServer* window_server_; | 408 WindowServer* window_server_; |
| 408 | 409 |
| 409 const UserId user_id_; | 410 const UserId user_id_; |
| 410 | 411 |
| 411 // Id of this tree as assigned by WindowServer. | 412 // Id of this tree as assigned by WindowServer. |
| 412 const ConnectionSpecificId id_; | 413 const ConnectionSpecificId id_; |
| 413 std::string connection_name_; | 414 std::string connection_name_; |
| 414 | 415 |
| 415 ConnectionSpecificId next_window_id_; | 416 ConnectionSpecificId next_window_id_; |
| 416 | 417 |
| 417 scoped_ptr<WindowTreeBinding> binding_; | 418 std::unique_ptr<WindowTreeBinding> binding_; |
| 418 | 419 |
| 419 scoped_ptr<mus::ws::AccessPolicy> access_policy_; | 420 std::unique_ptr<mus::ws::AccessPolicy> access_policy_; |
| 420 | 421 |
| 421 // 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 |
| 422 // number of roots, including 0. | 423 // number of roots, including 0. |
| 423 std::set<const ServerWindow*> roots_; | 424 std::set<const ServerWindow*> roots_; |
| 424 | 425 |
| 425 // The windows created by this tree. This tree owns these objects. | 426 // The windows created by this tree. This tree owns these objects. |
| 426 base::hash_map<WindowId, ServerWindow*> created_window_map_; | 427 base::hash_map<WindowId, ServerWindow*> created_window_map_; |
| 427 | 428 |
| 428 // 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 |
| 429 // 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 |
| 430 // client (ClientWindowId). | 431 // client (ClientWindowId). |
| 431 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; | 432 base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_; |
| 432 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; | 433 base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_; |
| 433 | 434 |
| 434 uint32_t event_ack_id_; | 435 uint32_t event_ack_id_; |
| 435 | 436 |
| 436 // WindowManager the current event came from. | 437 // WindowManager the current event came from. |
| 437 WindowManagerState* event_source_wms_ = nullptr; | 438 WindowManagerState* event_source_wms_ = nullptr; |
| 438 | 439 |
| 439 std::queue<scoped_ptr<TargetedEvent>> event_queue_; | 440 std::queue<std::unique_ptr<TargetedEvent>> event_queue_; |
| 440 | 441 |
| 441 scoped_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> | 442 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> |
| 442 window_manager_internal_client_binding_; | 443 window_manager_internal_client_binding_; |
| 443 mojom::WindowManager* window_manager_internal_; | 444 mojom::WindowManager* window_manager_internal_; |
| 444 | 445 |
| 445 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_; | 446 std::unique_ptr<WaitingForTopLevelWindowInfo> |
| 447 waiting_for_top_level_window_info_; |
| 446 | 448 |
| 447 DISALLOW_COPY_AND_ASSIGN(WindowTree); | 449 DISALLOW_COPY_AND_ASSIGN(WindowTree); |
| 448 }; | 450 }; |
| 449 | 451 |
| 450 } // namespace ws | 452 } // namespace ws |
| 451 } // namespace mus | 453 } // namespace mus |
| 452 | 454 |
| 453 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_ | 455 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_ |
| OLD | NEW |