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