| 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/public/interfaces/display.mojom.h" |
| 11 #include "components/mus/ws/user_id.h" | 12 #include "components/mus/ws/user_id.h" |
| 12 | 13 |
| 13 namespace mus { | 14 namespace mus { |
| 14 namespace ws { | 15 namespace ws { |
| 15 | 16 |
| 16 class Display; | 17 class Display; |
| 17 class ServerWindow; | 18 class ServerWindow; |
| 18 class WindowTree; | 19 class WindowTree; |
| 19 | 20 |
| 20 // Manages the state associated with a connection to a WindowManager for | 21 // Manages the state associated with a connection to a WindowManager for |
| 21 // a specific user. | 22 // a specific user. |
| 22 class WindowManagerState { | 23 class WindowManagerState { |
| 23 public: | 24 public: |
| 24 // Creates a WindowManagerState that can host content from any user. | 25 // Creates a WindowManagerState that can host content from any user. |
| 25 explicit WindowManagerState(Display* display); | 26 explicit WindowManagerState(Display* display); |
| 26 WindowManagerState(Display* display, const UserId& user_id); | 27 WindowManagerState(Display* display, const UserId& user_id); |
| 27 ~WindowManagerState(); | 28 ~WindowManagerState(); |
| 28 | 29 |
| 29 bool is_user_id_valid() const { return is_user_id_valid_; } | 30 bool is_user_id_valid() const { return is_user_id_valid_; } |
| 30 | 31 |
| 31 ServerWindow* root() { return root_.get(); } | 32 ServerWindow* root() { return root_.get(); } |
| 32 const ServerWindow* root() const { return root_.get(); } | 33 const ServerWindow* root() const { return root_.get(); } |
| 33 | 34 |
| 34 WindowTree* tree() { return tree_; } | 35 WindowTree* tree() { return tree_; } |
| 35 const WindowTree* tree() const { return tree_; } | 36 const WindowTree* tree() const { return tree_; } |
| 36 | 37 |
| 38 Display* display() { return display_; } |
| 39 const Display* display() const { return display_; } |
| 40 |
| 41 void SetFrameDecorationValues(mojom::FrameDecorationValuesPtr values); |
| 42 const mojom::FrameDecorationValues& frame_decoration_values() const { |
| 43 return *frame_decoration_values_; |
| 44 } |
| 45 bool got_frame_decoration_values() const { |
| 46 return got_frame_decoration_values_; |
| 47 } |
| 48 |
| 49 // Returns a mojom::Display for the specified display. WindowManager specific |
| 50 // values are not set. |
| 51 mojom::DisplayPtr ToMojomDisplay() const; |
| 52 |
| 37 private: | 53 private: |
| 38 friend class Display; | 54 friend class Display; |
| 39 | 55 |
| 40 WindowManagerState(Display* display, bool is_user_id_valid, | 56 WindowManagerState(Display* display, bool is_user_id_valid, |
| 41 const UserId& user_id); | 57 const UserId& user_id); |
| 42 | 58 |
| 43 Display* display_; | 59 Display* display_; |
| 44 // If this was created implicitly by a call | 60 // If this was created implicitly by a call |
| 45 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_| | 61 // WindowTreeHostFactory::CreateWindowTreeHost(), then |is_user_id_valid_| |
| 46 // is false. | 62 // is false. |
| 47 const bool is_user_id_valid_; | 63 const bool is_user_id_valid_; |
| 48 const UserId user_id_; | 64 const UserId user_id_; |
| 49 scoped_ptr<ServerWindow> root_; | 65 scoped_ptr<ServerWindow> root_; |
| 50 WindowTree* tree_ = nullptr; | 66 WindowTree* tree_ = nullptr; |
| 51 | 67 |
| 68 // Set to true the first time SetFrameDecorationValues() is received. |
| 69 bool got_frame_decoration_values_ = false; |
| 70 mojom::FrameDecorationValuesPtr frame_decoration_values_; |
| 71 |
| 52 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); | 72 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); |
| 53 }; | 73 }; |
| 54 | 74 |
| 55 } // namespace ws | 75 } // namespace ws |
| 56 } // namespace mus | 76 } // namespace mus |
| 57 | 77 |
| 58 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ | 78 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| OLD | NEW |