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 SERVICES_UI_WS_WINDOW_SERVER_H_ | 5 #ifndef SERVICES_UI_WS_WINDOW_SERVER_H_ |
6 #define SERVICES_UI_WS_WINDOW_SERVER_H_ | 6 #define SERVICES_UI_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 <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "mojo/public/cpp/bindings/array.h" | 16 #include "mojo/public/cpp/bindings/array.h" |
17 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
18 #include "services/ui/clipboard/clipboard_impl.h" | 18 #include "services/ui/clipboard/clipboard_impl.h" |
19 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" | 19 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" |
20 #include "services/ui/public/interfaces/window_tree.mojom.h" | 20 #include "services/ui/public/interfaces/window_tree.mojom.h" |
21 #include "services/ui/public/interfaces/window_tree_host.mojom.h" | 21 #include "services/ui/public/interfaces/window_tree_host.mojom.h" |
22 #include "services/ui/surfaces/surfaces_state.h" | 22 #include "services/ui/surfaces/surfaces_state.h" |
23 #include "services/ui/ws/display.h" | 23 #include "services/ui/ws/display.h" |
24 #include "services/ui/ws/display_manager_delegate.h" | |
25 #include "services/ui/ws/ids.h" | 24 #include "services/ui/ws/ids.h" |
26 #include "services/ui/ws/operation.h" | 25 #include "services/ui/ws/operation.h" |
27 #include "services/ui/ws/server_window_delegate.h" | 26 #include "services/ui/ws/server_window_delegate.h" |
28 #include "services/ui/ws/server_window_observer.h" | 27 #include "services/ui/ws/server_window_observer.h" |
| 28 #include "services/ui/ws/user_display_manager_delegate.h" |
29 #include "services/ui/ws/user_id_tracker.h" | 29 #include "services/ui/ws/user_id_tracker.h" |
30 #include "services/ui/ws/user_id_tracker_observer.h" | 30 #include "services/ui/ws/user_id_tracker_observer.h" |
31 #include "services/ui/ws/window_manager_window_tree_factory_set.h" | 31 #include "services/ui/ws/window_manager_window_tree_factory_set.h" |
32 | 32 |
33 namespace ui { | 33 namespace ui { |
34 namespace ws { | 34 namespace ws { |
35 | 35 |
36 class AccessPolicy; | 36 class AccessPolicy; |
37 class DisplayManager; | 37 class DisplayManager; |
38 class ServerWindow; | 38 class ServerWindow; |
39 class UserActivityMonitor; | 39 class UserActivityMonitor; |
40 class WindowManagerState; | 40 class WindowManagerState; |
41 class WindowServerDelegate; | 41 class WindowServerDelegate; |
42 class WindowTree; | 42 class WindowTree; |
43 class WindowTreeBinding; | 43 class WindowTreeBinding; |
44 | 44 |
45 // WindowServer manages the set of clients of the window server (all the | 45 // WindowServer manages the set of clients of the window server (all the |
46 // WindowTrees) as well as providing the root of the hierarchy. | 46 // WindowTrees) as well as providing the root of the hierarchy. |
47 class WindowServer : public ServerWindowDelegate, | 47 class WindowServer : public ServerWindowDelegate, |
48 public ServerWindowObserver, | 48 public ServerWindowObserver, |
49 public DisplayManagerDelegate, | 49 public UserDisplayManagerDelegate, |
50 public UserIdTrackerObserver { | 50 public UserIdTrackerObserver { |
51 public: | 51 public: |
52 WindowServer(WindowServerDelegate* delegate, | 52 explicit WindowServer(WindowServerDelegate* delegate); |
53 const scoped_refptr<ui::SurfacesState>& surfaces_state); | |
54 ~WindowServer() override; | 53 ~WindowServer() override; |
55 | 54 |
56 WindowServerDelegate* delegate() { return delegate_; } | 55 WindowServerDelegate* delegate() { return delegate_; } |
57 | 56 |
58 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } | 57 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } |
59 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; } | 58 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; } |
60 | 59 |
61 DisplayManager* display_manager() { return display_manager_.get(); } | 60 DisplayManager* display_manager() { return display_manager_.get(); } |
62 const DisplayManager* display_manager() const { | 61 const DisplayManager* display_manager() const { |
63 return display_manager_.get(); | 62 return display_manager_.get(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 ServerWindow* window, | 208 ServerWindow* window, |
210 WindowTree* initiator, | 209 WindowTree* initiator, |
211 const gfx::Rect& revert_bounds); | 210 const gfx::Rect& revert_bounds); |
212 void EndMoveLoop(); | 211 void EndMoveLoop(); |
213 uint32_t GetCurrentMoveLoopChangeId(); | 212 uint32_t GetCurrentMoveLoopChangeId(); |
214 ServerWindow* GetCurrentMoveLoopWindow(); | 213 ServerWindow* GetCurrentMoveLoopWindow(); |
215 WindowTree* GetCurrentMoveLoopInitiator(); | 214 WindowTree* GetCurrentMoveLoopInitiator(); |
216 gfx::Rect GetCurrentMoveLoopRevertBounds(); | 215 gfx::Rect GetCurrentMoveLoopRevertBounds(); |
217 bool in_move_loop() const { return !!current_move_loop_; } | 216 bool in_move_loop() const { return !!current_move_loop_; } |
218 | 217 |
| 218 void OnFirstDisplayReady(); |
| 219 void OnNoMoreDisplays(); |
| 220 WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id); |
| 221 |
| 222 // ServerWindowDelegate: |
| 223 ui::SurfacesState* GetSurfacesState() override; |
| 224 |
| 225 // UserDisplayManagerDelegate: |
| 226 bool GetFrameDecorationsForUser( |
| 227 const UserId& user_id, |
| 228 mojom::FrameDecorationValuesPtr* values) override; |
| 229 |
219 private: | 230 private: |
220 struct CurrentMoveLoopState; | 231 struct CurrentMoveLoopState; |
221 friend class Operation; | 232 friend class Operation; |
222 | 233 |
223 using WindowTreeMap = | 234 using WindowTreeMap = |
224 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; | 235 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; |
225 using UserActivityMonitorMap = | 236 using UserActivityMonitorMap = |
226 std::map<UserId, std::unique_ptr<UserActivityMonitor>>; | 237 std::map<UserId, std::unique_ptr<UserActivityMonitor>>; |
227 using UserClipboardMap = | 238 using UserClipboardMap = |
228 std::map<UserId, std::unique_ptr<ui::clipboard::ClipboardImpl>>; | 239 std::map<UserId, std::unique_ptr<ui::clipboard::ClipboardImpl>>; |
(...skipping 30 matching lines...) Expand all Loading... |
259 void UpdateNativeCursorFromMouseLocation(ServerWindow* window); | 270 void UpdateNativeCursorFromMouseLocation(ServerWindow* window); |
260 | 271 |
261 // Updates the native cursor if the cursor is currently inside |window|. This | 272 // Updates the native cursor if the cursor is currently inside |window|. This |
262 // is run in response to events that change the mouse cursor properties of | 273 // is run in response to events that change the mouse cursor properties of |
263 // |window|. | 274 // |window|. |
264 void UpdateNativeCursorIfOver(ServerWindow* window); | 275 void UpdateNativeCursorIfOver(ServerWindow* window); |
265 | 276 |
266 bool IsUserInHighContrastMode(const UserId& user) const; | 277 bool IsUserInHighContrastMode(const UserId& user) const; |
267 | 278 |
268 // Overridden from ServerWindowDelegate: | 279 // Overridden from ServerWindowDelegate: |
269 ui::SurfacesState* GetSurfacesState() override; | |
270 void OnScheduleWindowPaint(ServerWindow* window) override; | 280 void OnScheduleWindowPaint(ServerWindow* window) override; |
271 const ServerWindow* GetRootWindow(const ServerWindow* window) const override; | 281 const ServerWindow* GetRootWindow(const ServerWindow* window) const override; |
272 void ScheduleSurfaceDestruction(ServerWindow* window) override; | 282 void ScheduleSurfaceDestruction(ServerWindow* window) override; |
273 | 283 |
274 // Overridden from ServerWindowObserver: | 284 // Overridden from ServerWindowObserver: |
275 void OnWindowDestroyed(ServerWindow* window) override; | 285 void OnWindowDestroyed(ServerWindow* window) override; |
276 void OnWillChangeWindowHierarchy(ServerWindow* window, | 286 void OnWillChangeWindowHierarchy(ServerWindow* window, |
277 ServerWindow* new_parent, | 287 ServerWindow* new_parent, |
278 ServerWindow* old_parent) override; | 288 ServerWindow* old_parent) override; |
279 void OnWindowHierarchyChanged(ServerWindow* window, | 289 void OnWindowHierarchyChanged(ServerWindow* window, |
(...skipping 22 matching lines...) Expand all Loading... |
302 int32_t cursor_id) override; | 312 int32_t cursor_id) override; |
303 void OnWindowNonClientCursorChanged(ServerWindow* window, | 313 void OnWindowNonClientCursorChanged(ServerWindow* window, |
304 int32_t cursor_id) override; | 314 int32_t cursor_id) override; |
305 void OnWindowTextInputStateChanged(ServerWindow* window, | 315 void OnWindowTextInputStateChanged(ServerWindow* window, |
306 const ui::TextInputState& state) override; | 316 const ui::TextInputState& state) override; |
307 void OnTransientWindowAdded(ServerWindow* window, | 317 void OnTransientWindowAdded(ServerWindow* window, |
308 ServerWindow* transient_child) override; | 318 ServerWindow* transient_child) override; |
309 void OnTransientWindowRemoved(ServerWindow* window, | 319 void OnTransientWindowRemoved(ServerWindow* window, |
310 ServerWindow* transient_child) override; | 320 ServerWindow* transient_child) override; |
311 | 321 |
312 // DisplayManagerDelegate: | |
313 void OnFirstDisplayReady() override; | |
314 void OnNoMoreDisplays() override; | |
315 bool GetFrameDecorationsForUser( | |
316 const UserId& user_id, | |
317 mojom::FrameDecorationValuesPtr* values) override; | |
318 WindowManagerState* GetWindowManagerStateForUser( | |
319 const UserId& user_id) override; | |
320 | |
321 // UserIdTrackerObserver: | 322 // UserIdTrackerObserver: |
322 void OnActiveUserIdChanged(const UserId& previously_active_id, | 323 void OnActiveUserIdChanged(const UserId& previously_active_id, |
323 const UserId& active_id) override; | 324 const UserId& active_id) override; |
324 void OnUserIdAdded(const UserId& id) override; | 325 void OnUserIdAdded(const UserId& id) override; |
325 void OnUserIdRemoved(const UserId& id) override; | 326 void OnUserIdRemoved(const UserId& id) override; |
326 | 327 |
327 UserIdTracker user_id_tracker_; | 328 UserIdTracker user_id_tracker_; |
328 | 329 |
329 WindowServerDelegate* delegate_; | 330 WindowServerDelegate* delegate_; |
330 | 331 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 363 |
363 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; | 364 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; |
364 | 365 |
365 DISALLOW_COPY_AND_ASSIGN(WindowServer); | 366 DISALLOW_COPY_AND_ASSIGN(WindowServer); |
366 }; | 367 }; |
367 | 368 |
368 } // namespace ws | 369 } // namespace ws |
369 } // namespace ui | 370 } // namespace ui |
370 | 371 |
371 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ | 372 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ |
OLD | NEW |