| 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_IMPL_H_ | 5 #ifndef COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_ | 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "components/mus/public/interfaces/surface_id.mojom.h" | 20 #include "components/mus/public/interfaces/surface_id.mojom.h" |
| 21 #include "components/mus/public/interfaces/window_tree.mojom.h" | 21 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 22 #include "components/mus/ws/access_policy_delegate.h" | 22 #include "components/mus/ws/access_policy_delegate.h" |
| 23 #include "components/mus/ws/client_connection.h" |
| 23 #include "components/mus/ws/ids.h" | 24 #include "components/mus/ws/ids.h" |
| 24 #include "mojo/public/cpp/bindings/associated_binding.h" | 25 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 25 | 26 |
| 26 namespace gfx { | 27 namespace gfx { |
| 27 class Insets; | 28 class Insets; |
| 28 class Rect; | 29 class Rect; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace mus { | 32 namespace mus { |
| 32 namespace ws { | 33 namespace ws { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 // internal state) as necessary. | 45 // internal state) as necessary. |
| 45 class WindowTreeImpl : public mojom::WindowTree, | 46 class WindowTreeImpl : public mojom::WindowTree, |
| 46 public AccessPolicyDelegate, | 47 public AccessPolicyDelegate, |
| 47 public mojom::WindowManagerClient { | 48 public mojom::WindowManagerClient { |
| 48 public: | 49 public: |
| 49 WindowTreeImpl(ConnectionManager* connection_manager, | 50 WindowTreeImpl(ConnectionManager* connection_manager, |
| 50 ServerWindow* root, | 51 ServerWindow* root, |
| 51 uint32_t policy_bitmask); | 52 uint32_t policy_bitmask); |
| 52 ~WindowTreeImpl() override; | 53 ~WindowTreeImpl() override; |
| 53 | 54 |
| 54 void Init(mojom::WindowTreeClient* client, mojom::WindowTreePtr tree); | 55 void Init(scoped_ptr<ClientConnection> client_connection, |
| 56 mojom::WindowTreePtr tree); |
| 55 | 57 |
| 56 // Called if this WindowTreeImpl hosts the WindowManager. This happens if | 58 // Called if this WindowTreeImpl hosts the WindowManager. This happens if |
| 57 // this WindowTreeImpl serves as the root of a WindowTreeHost. | 59 // this WindowTreeImpl serves as the root of a WindowTreeHost. |
| 58 void ConfigureWindowManager(); | 60 void ConfigureWindowManager(); |
| 59 | 61 |
| 60 ConnectionSpecificId id() const { return id_; } | 62 ConnectionSpecificId id() const { return id_; } |
| 61 | 63 |
| 62 mojom::WindowTreeClient* client() { return client_; } | 64 mojom::WindowTreeClient* client() { return client_connection_->client(); } |
| 63 | 65 |
| 64 // Returns the Window with the specified id. | 66 // Returns the Window with the specified id. |
| 65 ServerWindow* GetWindow(const WindowId& id) { | 67 ServerWindow* GetWindow(const WindowId& id) { |
| 66 return const_cast<ServerWindow*>( | 68 return const_cast<ServerWindow*>( |
| 67 const_cast<const WindowTreeImpl*>(this)->GetWindow(id)); | 69 const_cast<const WindowTreeImpl*>(this)->GetWindow(id)); |
| 68 } | 70 } |
| 69 const ServerWindow* GetWindow(const WindowId& id) const; | 71 const ServerWindow* GetWindow(const WindowId& id) const; |
| 70 | 72 |
| 71 // Returns the Window with the specified client id *only* if known to this | 73 // Returns the Window with the specified client id *only* if known to this |
| 72 // client, returns null if not known. | 74 // client, returns null if not known. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 const ServerWindow* window) const override; | 366 const ServerWindow* window) const override; |
| 365 bool IsDescendantOfEmbedRoot(const ServerWindow* window) override; | 367 bool IsDescendantOfEmbedRoot(const ServerWindow* window) override; |
| 366 | 368 |
| 367 ConnectionManager* connection_manager_; | 369 ConnectionManager* connection_manager_; |
| 368 | 370 |
| 369 // Id of this connection as assigned by ConnectionManager. | 371 // Id of this connection as assigned by ConnectionManager. |
| 370 const ConnectionSpecificId id_; | 372 const ConnectionSpecificId id_; |
| 371 | 373 |
| 372 ConnectionSpecificId next_window_id_; | 374 ConnectionSpecificId next_window_id_; |
| 373 | 375 |
| 374 mojom::WindowTreeClient* client_; | 376 scoped_ptr<ClientConnection> client_connection_; |
| 375 | 377 |
| 376 scoped_ptr<mus::ws::AccessPolicy> access_policy_; | 378 scoped_ptr<mus::ws::AccessPolicy> access_policy_; |
| 377 | 379 |
| 378 // The roots, or embed points, of this connection. A WindowTreeImpl may have | 380 // The roots, or embed points, of this connection. A WindowTreeImpl may have |
| 379 // any number of roots, including 0. | 381 // any number of roots, including 0. |
| 380 std::set<const ServerWindow*> roots_; | 382 std::set<const ServerWindow*> roots_; |
| 381 | 383 |
| 382 // The windows created by this connection. This connection owns these objects. | 384 // The windows created by this connection. This connection owns these objects. |
| 383 base::hash_map<WindowId, ServerWindow*> created_window_map_; | 385 base::hash_map<WindowId, ServerWindow*> created_window_map_; |
| 384 | 386 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 403 | 405 |
| 404 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_; | 406 scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_; |
| 405 | 407 |
| 406 DISALLOW_COPY_AND_ASSIGN(WindowTreeImpl); | 408 DISALLOW_COPY_AND_ASSIGN(WindowTreeImpl); |
| 407 }; | 409 }; |
| 408 | 410 |
| 409 } // namespace ws | 411 } // namespace ws |
| 410 } // namespace mus | 412 } // namespace mus |
| 411 | 413 |
| 412 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_ | 414 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_ |
| OLD | NEW |