Chromium Code Reviews| 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> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 uint32_t client_change_id); | 151 uint32_t client_change_id); |
| 152 | 152 |
| 153 // Called when a response from the window manager is obtained. Calls to | 153 // Called when a response from the window manager is obtained. Calls to |
| 154 // the client that initiated the change with the change id originally | 154 // the client that initiated the change with the change id originally |
| 155 // supplied by the client. | 155 // supplied by the client. |
| 156 void WindowManagerChangeCompleted(uint32_t window_manager_change_id, | 156 void WindowManagerChangeCompleted(uint32_t window_manager_change_id, |
| 157 bool success); | 157 bool success); |
| 158 void WindowManagerCreatedTopLevelWindow(WindowTree* wm_tree, | 158 void WindowManagerCreatedTopLevelWindow(WindowTree* wm_tree, |
| 159 uint32_t window_manager_change_id, | 159 uint32_t window_manager_change_id, |
| 160 const ServerWindow* window); | 160 const ServerWindow* window); |
| 161 void WindowManagerCompletedMoveLoop(uint32_t window_manager_change_id, | |
| 162 const ServerWindow* window, | |
| 163 bool completed); | |
| 161 | 164 |
| 162 // Called when we get an unexpected message from the WindowManager. | 165 // Called when we get an unexpected message from the WindowManager. |
| 163 // TODO(sky): decide what we want to do here. | 166 // TODO(sky): decide what we want to do here. |
| 164 void WindowManagerSentBogusMessage() {} | 167 void WindowManagerSentBogusMessage() {} |
| 165 | 168 |
| 166 // These functions trivially delegate to all WindowTrees, which in | 169 // These functions trivially delegate to all WindowTrees, which in |
| 167 // term notify their clients. | 170 // term notify their clients. |
| 168 void ProcessWindowBoundsChanged(const ServerWindow* window, | 171 void ProcessWindowBoundsChanged(const ServerWindow* window, |
| 169 const gfx::Rect& old_bounds, | 172 const gfx::Rect& old_bounds, |
| 170 const gfx::Rect& new_bounds); | 173 const gfx::Rect& new_bounds); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 189 // Sends an |event| to all WindowTrees belonging to |user_id| that might be | 192 // Sends an |event| to all WindowTrees belonging to |user_id| that might be |
| 190 // observing events. Skips |ignore_tree| if it is non-null. | 193 // observing events. Skips |ignore_tree| if it is non-null. |
| 191 void SendToEventObservers(const ui::Event& event, | 194 void SendToEventObservers(const ui::Event& event, |
| 192 const UserId& user_id, | 195 const UserId& user_id, |
| 193 WindowTree* ignore_tree); | 196 WindowTree* ignore_tree); |
| 194 | 197 |
| 195 // Sets a callback to be called whenever a ServerWindow is scheduled for | 198 // Sets a callback to be called whenever a ServerWindow is scheduled for |
| 196 // a [re]paint. This should only be called in a test configuration. | 199 // a [re]paint. This should only be called in a test configuration. |
| 197 void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback); | 200 void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback); |
| 198 | 201 |
| 202 void StartMoveLoop(uint32_t change_id, | |
| 203 ServerWindow* window, | |
| 204 WindowTree* initiator, | |
| 205 const gfx::Rect& revert_bounds); | |
| 206 void EndMoveLoop(); | |
| 207 uint32_t GetCurrentMoveLoopChangeId(); | |
| 208 ServerWindow* GetCurrentMoveLoopWindow(); | |
| 209 WindowTree* GetCurrentMoveLoopInitiator(); | |
| 210 gfx::Rect GetCurrentMoveLoopRevertBounds(); | |
| 211 bool in_move_loop() { return !!current_move_loop_.get(); } | |
|
sky
2016/06/29 00:04:09
nit: const
| |
| 212 | |
| 199 private: | 213 private: |
| 214 struct CurrentMoveLoopState; | |
| 200 friend class Operation; | 215 friend class Operation; |
| 201 | 216 |
| 202 using WindowTreeMap = | 217 using WindowTreeMap = |
| 203 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; | 218 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; |
| 204 using UserActivityMonitorMap = | 219 using UserActivityMonitorMap = |
| 205 std::map<UserId, std::unique_ptr<UserActivityMonitor>>; | 220 std::map<UserId, std::unique_ptr<UserActivityMonitor>>; |
| 206 | 221 |
| 207 struct InFlightWindowManagerChange { | 222 struct InFlightWindowManagerChange { |
| 208 // Identifies the client that initiated the change. | 223 // Identifies the client that initiated the change. |
| 209 ClientSpecificId client_id; | 224 ClientSpecificId client_id; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 WindowServerDelegate* delegate_; | 319 WindowServerDelegate* delegate_; |
| 305 | 320 |
| 306 // State for rendering into a Surface. | 321 // State for rendering into a Surface. |
| 307 scoped_refptr<mus::SurfacesState> surfaces_state_; | 322 scoped_refptr<mus::SurfacesState> surfaces_state_; |
| 308 | 323 |
| 309 // ID to use for next WindowTree. | 324 // ID to use for next WindowTree. |
| 310 ClientSpecificId next_client_id_; | 325 ClientSpecificId next_client_id_; |
| 311 | 326 |
| 312 std::unique_ptr<DisplayManager> display_manager_; | 327 std::unique_ptr<DisplayManager> display_manager_; |
| 313 | 328 |
| 329 std::unique_ptr<CurrentMoveLoopState> current_move_loop_; | |
| 330 | |
| 314 // Set of WindowTrees. | 331 // Set of WindowTrees. |
| 315 WindowTreeMap tree_map_; | 332 WindowTreeMap tree_map_; |
| 316 | 333 |
| 317 // If non-null then we're processing a client operation. The Operation is | 334 // If non-null then we're processing a client operation. The Operation is |
| 318 // not owned by us (it's created on the stack by WindowTree). | 335 // not owned by us (it's created on the stack by WindowTree). |
| 319 Operation* current_operation_; | 336 Operation* current_operation_; |
| 320 | 337 |
| 321 bool in_destructor_; | 338 bool in_destructor_; |
| 322 | 339 |
| 323 // Maps from window manager change id to the client that initiated the | 340 // Maps from window manager change id to the client that initiated the |
| 324 // request. | 341 // request. |
| 325 InFlightWindowManagerChangeMap in_flight_wm_change_map_; | 342 InFlightWindowManagerChangeMap in_flight_wm_change_map_; |
| 326 | 343 |
| 327 // Next id supplied to the window manager. | 344 // Next id supplied to the window manager. |
| 328 uint32_t next_wm_change_id_; | 345 uint32_t next_wm_change_id_; |
| 329 | 346 |
| 330 base::Callback<void(ServerWindow*)> window_paint_callback_; | 347 base::Callback<void(ServerWindow*)> window_paint_callback_; |
| 331 | 348 |
| 332 UserActivityMonitorMap activity_monitor_map_; | 349 UserActivityMonitorMap activity_monitor_map_; |
| 333 | 350 |
| 334 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; | 351 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; |
| 335 | 352 |
| 336 DISALLOW_COPY_AND_ASSIGN(WindowServer); | 353 DISALLOW_COPY_AND_ASSIGN(WindowServer); |
| 337 }; | 354 }; |
| 338 | 355 |
| 339 } // namespace ws | 356 } // namespace ws |
| 340 } // namespace mus | 357 } // namespace mus |
| 341 | 358 |
| 342 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_ | 359 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_ |
| OLD | NEW |