| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 |
| 12 namespace mus { |
| 13 namespace ws { |
| 14 |
| 15 class ServerWindow; |
| 16 class WindowTreeHostImpl; |
| 17 class WindowTreeImpl; |
| 18 |
| 19 // Manages the state associated with a connection to a WindowManager for |
| 20 // a specific user. |
| 21 class WindowManagerState { |
| 22 public: |
| 23 // Creates a WindowManagerState that can host content from any user. |
| 24 explicit WindowManagerState(WindowTreeHostImpl* tree_host); |
| 25 WindowManagerState(WindowTreeHostImpl* tree_host, uint32_t user_id); |
| 26 ~WindowManagerState(); |
| 27 |
| 28 bool is_user_id_valid() const { return is_user_id_valid_; } |
| 29 |
| 30 ServerWindow* root() { return root_.get(); } |
| 31 const ServerWindow* root() const { return root_.get(); } |
| 32 |
| 33 WindowTreeImpl* tree() { return tree_; } |
| 34 const WindowTreeImpl* tree() const { return tree_; } |
| 35 |
| 36 private: |
| 37 friend class WindowTreeHostImpl; |
| 38 |
| 39 WindowManagerState(WindowTreeHostImpl* tree_host, |
| 40 bool is_user_id_valid, |
| 41 uint32_t user_id); |
| 42 |
| 43 WindowTreeHostImpl* tree_host_; |
| 44 // If this was created implicitly by a call |
| 45 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_| |
| 46 // is false. |
| 47 const bool is_user_id_valid_; |
| 48 const uint32_t user_id_; |
| 49 scoped_ptr<ServerWindow> root_; |
| 50 WindowTreeImpl* tree_ = nullptr; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); |
| 53 }; |
| 54 |
| 55 } // namespace ws |
| 56 } // namespace mus |
| 57 |
| 58 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| OLD | NEW |