| 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_SERVER_H_ | 5 #ifndef COMPONENTS_MUS_WS_WINDOW_SERVER_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_SERVER_H_ | 6 #define COMPONENTS_MUS_WS_WINDOW_SERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" | 15 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" |
| 16 #include "components/mus/public/interfaces/window_tree.mojom.h" | 16 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 17 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 17 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 18 #include "components/mus/surfaces/surfaces_state.h" | 18 #include "components/mus/surfaces/surfaces_state.h" |
| 19 #include "components/mus/ws/display.h" | 19 #include "components/mus/ws/display.h" |
| 20 #include "components/mus/ws/display_manager_delegate.h" | 20 #include "components/mus/ws/display_manager_delegate.h" |
| 21 #include "components/mus/ws/ids.h" | 21 #include "components/mus/ws/ids.h" |
| 22 #include "components/mus/ws/operation.h" | 22 #include "components/mus/ws/operation.h" |
| 23 #include "components/mus/ws/server_window_delegate.h" | 23 #include "components/mus/ws/server_window_delegate.h" |
| 24 #include "components/mus/ws/server_window_observer.h" | 24 #include "components/mus/ws/server_window_observer.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const std::map<std::string, std::vector<uint8_t>>& properties); | 66 const std::map<std::string, std::vector<uint8_t>>& properties); |
| 67 | 67 |
| 68 // Returns the id for the next WindowTree. | 68 // Returns the id for the next WindowTree. |
| 69 ConnectionSpecificId GetAndAdvanceNextConnectionId(); | 69 ConnectionSpecificId GetAndAdvanceNextConnectionId(); |
| 70 | 70 |
| 71 // See description of WindowTree::Embed() for details. This assumes | 71 // See description of WindowTree::Embed() for details. This assumes |
| 72 // |transport_window_id| is valid. | 72 // |transport_window_id| is valid. |
| 73 WindowTree* EmbedAtWindow(ServerWindow* root, | 73 WindowTree* EmbedAtWindow(ServerWindow* root, |
| 74 const UserId& user_id, | 74 const UserId& user_id, |
| 75 mojom::WindowTreeClientPtr client, | 75 mojom::WindowTreeClientPtr client, |
| 76 scoped_ptr<AccessPolicy> access_policy); | 76 std::unique_ptr<AccessPolicy> access_policy); |
| 77 | 77 |
| 78 // Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to | 78 // Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to |
| 79 // destroy the tree. | 79 // destroy the tree. |
| 80 WindowTree* AddTree(scoped_ptr<WindowTree> tree_impl_ptr, | 80 WindowTree* AddTree(std::unique_ptr<WindowTree> tree_impl_ptr, |
| 81 scoped_ptr<WindowTreeBinding> binding, | 81 std::unique_ptr<WindowTreeBinding> binding, |
| 82 mojom::WindowTreePtr tree_ptr); | 82 mojom::WindowTreePtr tree_ptr); |
| 83 WindowTree* CreateTreeForWindowManager(Display* display, | 83 WindowTree* CreateTreeForWindowManager(Display* display, |
| 84 mojom::WindowManagerFactory* factory, | 84 mojom::WindowManagerFactory* factory, |
| 85 ServerWindow* root, | 85 ServerWindow* root, |
| 86 const UserId& user_id); | 86 const UserId& user_id); |
| 87 // Invoked when a WindowTree's connection encounters an error. | 87 // Invoked when a WindowTree's connection encounters an error. |
| 88 void DestroyTree(WindowTree* tree); | 88 void DestroyTree(WindowTree* tree); |
| 89 | 89 |
| 90 // Returns the connection by id. | 90 // Returns the connection by id. |
| 91 WindowTree* GetTreeWithId(ConnectionSpecificId connection_id); | 91 WindowTree* GetTreeWithId(ConnectionSpecificId connection_id); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void ProcessWillChangeWindowPredefinedCursor(ServerWindow* window, | 188 void ProcessWillChangeWindowPredefinedCursor(ServerWindow* window, |
| 189 int32_t cursor_id); | 189 int32_t cursor_id); |
| 190 | 190 |
| 191 // Sets a callback to be called whenever a ServerWindow is scheduled for | 191 // Sets a callback to be called whenever a ServerWindow is scheduled for |
| 192 // a [re]paint. This should only be called in a test configuration. | 192 // a [re]paint. This should only be called in a test configuration. |
| 193 void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback); | 193 void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback); |
| 194 | 194 |
| 195 private: | 195 private: |
| 196 friend class Operation; | 196 friend class Operation; |
| 197 | 197 |
| 198 using WindowTreeMap = std::map<ConnectionSpecificId, scoped_ptr<WindowTree>>; | 198 using WindowTreeMap = |
| 199 std::map<ConnectionSpecificId, std::unique_ptr<WindowTree>>; |
| 199 | 200 |
| 200 struct InFlightWindowManagerChange { | 201 struct InFlightWindowManagerChange { |
| 201 // Identifies the client that initiated the change. | 202 // Identifies the client that initiated the change. |
| 202 ConnectionSpecificId connection_id; | 203 ConnectionSpecificId connection_id; |
| 203 | 204 |
| 204 // Change id supplied by the client. | 205 // Change id supplied by the client. |
| 205 uint32_t client_change_id; | 206 uint32_t client_change_id; |
| 206 }; | 207 }; |
| 207 | 208 |
| 208 using InFlightWindowManagerChangeMap = | 209 using InFlightWindowManagerChangeMap = |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 UserIdTracker user_id_tracker_; | 280 UserIdTracker user_id_tracker_; |
| 280 | 281 |
| 281 WindowServerDelegate* delegate_; | 282 WindowServerDelegate* delegate_; |
| 282 | 283 |
| 283 // State for rendering into a Surface. | 284 // State for rendering into a Surface. |
| 284 scoped_refptr<mus::SurfacesState> surfaces_state_; | 285 scoped_refptr<mus::SurfacesState> surfaces_state_; |
| 285 | 286 |
| 286 // ID to use for next WindowTree. | 287 // ID to use for next WindowTree. |
| 287 ConnectionSpecificId next_connection_id_; | 288 ConnectionSpecificId next_connection_id_; |
| 288 | 289 |
| 289 scoped_ptr<DisplayManager> display_manager_; | 290 std::unique_ptr<DisplayManager> display_manager_; |
| 290 | 291 |
| 291 // Set of WindowTrees. | 292 // Set of WindowTrees. |
| 292 WindowTreeMap tree_map_; | 293 WindowTreeMap tree_map_; |
| 293 | 294 |
| 294 // If non-null then we're processing a client operation. The Operation is | 295 // If non-null then we're processing a client operation. The Operation is |
| 295 // not owned by us (it's created on the stack by WindowTree). | 296 // not owned by us (it's created on the stack by WindowTree). |
| 296 Operation* current_operation_; | 297 Operation* current_operation_; |
| 297 | 298 |
| 298 bool in_destructor_; | 299 bool in_destructor_; |
| 299 | 300 |
| 300 // Maps from window manager change id to the client that initiated the | 301 // Maps from window manager change id to the client that initiated the |
| 301 // request. | 302 // request. |
| 302 InFlightWindowManagerChangeMap in_flight_wm_change_map_; | 303 InFlightWindowManagerChangeMap in_flight_wm_change_map_; |
| 303 | 304 |
| 304 // Next id supplied to the window manager. | 305 // Next id supplied to the window manager. |
| 305 uint32_t next_wm_change_id_; | 306 uint32_t next_wm_change_id_; |
| 306 | 307 |
| 307 base::Callback<void(ServerWindow*)> window_paint_callback_; | 308 base::Callback<void(ServerWindow*)> window_paint_callback_; |
| 308 | 309 |
| 309 WindowManagerFactoryRegistry window_manager_factory_registry_; | 310 WindowManagerFactoryRegistry window_manager_factory_registry_; |
| 310 | 311 |
| 311 DISALLOW_COPY_AND_ASSIGN(WindowServer); | 312 DISALLOW_COPY_AND_ASSIGN(WindowServer); |
| 312 }; | 313 }; |
| 313 | 314 |
| 314 } // namespace ws | 315 } // namespace ws |
| 315 } // namespace mus | 316 } // namespace mus |
| 316 | 317 |
| 317 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_ | 318 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_ |
| OLD | NEW |