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 "base/optional.h" | 16 #include "base/optional.h" |
17 #include "cc/ipc/display_compositor.mojom.h" | 17 #include "cc/ipc/display_compositor.mojom.h" |
18 #include "mojo/public/cpp/bindings/array.h" | 18 #include "mojo/public/cpp/bindings/array.h" |
19 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
20 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" | 20 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" |
21 #include "services/ui/public/interfaces/window_tree.mojom.h" | 21 #include "services/ui/public/interfaces/window_tree.mojom.h" |
22 #include "services/ui/ws/display.h" | 22 #include "services/ui/ws/display.h" |
23 #include "services/ui/ws/gpu_service_proxy_delegate.h" | 23 #include "services/ui/ws/gpu_host_delegate.h" |
24 #include "services/ui/ws/ids.h" | 24 #include "services/ui/ws/ids.h" |
25 #include "services/ui/ws/operation.h" | 25 #include "services/ui/ws/operation.h" |
26 #include "services/ui/ws/server_window_delegate.h" | 26 #include "services/ui/ws/server_window_delegate.h" |
27 #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" | 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 GpuServiceProxy; | 38 class GpuHost; |
39 class ServerWindow; | 39 class ServerWindow; |
40 class UserActivityMonitor; | 40 class UserActivityMonitor; |
41 class WindowManagerState; | 41 class WindowManagerState; |
42 class WindowServerDelegate; | 42 class WindowServerDelegate; |
43 class WindowTree; | 43 class WindowTree; |
44 class WindowTreeBinding; | 44 class WindowTreeBinding; |
45 | 45 |
46 // WindowServer manages the set of clients of the window server (all the | 46 // WindowServer manages the set of clients of the window server (all the |
47 // WindowTrees) as well as providing the root of the hierarchy. | 47 // WindowTrees) as well as providing the root of the hierarchy. |
48 class WindowServer : public ServerWindowDelegate, | 48 class WindowServer : public ServerWindowDelegate, |
49 public ServerWindowObserver, | 49 public ServerWindowObserver, |
50 public GpuServiceProxyDelegate, | 50 public GpuHostDelegate, |
51 public UserDisplayManagerDelegate, | 51 public UserDisplayManagerDelegate, |
52 public UserIdTrackerObserver, | 52 public UserIdTrackerObserver, |
53 public cc::mojom::DisplayCompositorClient { | 53 public cc::mojom::DisplayCompositorClient { |
54 public: | 54 public: |
55 explicit WindowServer(WindowServerDelegate* delegate); | 55 explicit WindowServer(WindowServerDelegate* delegate); |
56 ~WindowServer() override; | 56 ~WindowServer() override; |
57 | 57 |
58 WindowServerDelegate* delegate() { return delegate_; } | 58 WindowServerDelegate* delegate() { return delegate_; } |
59 | 59 |
60 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } | 60 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } |
61 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; } | 61 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; } |
62 | 62 |
63 DisplayManager* display_manager() { return display_manager_.get(); } | 63 DisplayManager* display_manager() { return display_manager_.get(); } |
64 const DisplayManager* display_manager() const { | 64 const DisplayManager* display_manager() const { |
65 return display_manager_.get(); | 65 return display_manager_.get(); |
66 } | 66 } |
67 | 67 |
68 GpuServiceProxy* gpu_proxy() { return gpu_proxy_.get(); } | 68 GpuHost* gpu_host() { return gpu_host_.get(); } |
69 | 69 |
70 // Creates a new ServerWindow. The return value is owned by the caller, but | 70 // Creates a new ServerWindow. The return value is owned by the caller, but |
71 // must be destroyed before WindowServer. | 71 // must be destroyed before WindowServer. |
72 ServerWindow* CreateServerWindow( | 72 ServerWindow* CreateServerWindow( |
73 const WindowId& id, | 73 const WindowId& id, |
74 const std::map<std::string, std::vector<uint8_t>>& properties); | 74 const std::map<std::string, std::vector<uint8_t>>& properties); |
75 | 75 |
76 // Returns the id for the next WindowTree. | 76 // Returns the id for the next WindowTree. |
77 ClientSpecificId GetAndAdvanceNextClientId(); | 77 ClientSpecificId GetAndAdvanceNextClientId(); |
78 | 78 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 mojom::Cursor cursor_id) override; | 317 mojom::Cursor cursor_id) override; |
318 void OnWindowNonClientCursorChanged(ServerWindow* window, | 318 void OnWindowNonClientCursorChanged(ServerWindow* window, |
319 mojom::Cursor cursor_id) override; | 319 mojom::Cursor cursor_id) override; |
320 void OnWindowTextInputStateChanged(ServerWindow* window, | 320 void OnWindowTextInputStateChanged(ServerWindow* window, |
321 const ui::TextInputState& state) override; | 321 const ui::TextInputState& state) override; |
322 void OnTransientWindowAdded(ServerWindow* window, | 322 void OnTransientWindowAdded(ServerWindow* window, |
323 ServerWindow* transient_child) override; | 323 ServerWindow* transient_child) override; |
324 void OnTransientWindowRemoved(ServerWindow* window, | 324 void OnTransientWindowRemoved(ServerWindow* window, |
325 ServerWindow* transient_child) override; | 325 ServerWindow* transient_child) override; |
326 | 326 |
327 // GpuServiceProxyDelegate: | 327 // GpuHostDelegate: |
328 void OnGpuServiceInitialized() override; | 328 void OnGpuServiceInitialized() override; |
329 | 329 |
330 // cc::mojom::DisplayCompositorClient: | 330 // cc::mojom::DisplayCompositorClient: |
331 void OnSurfaceCreated(const cc::SurfaceId& surface_id, | 331 void OnSurfaceCreated(const cc::SurfaceId& surface_id, |
332 const gfx::Size& frame_size, | 332 const gfx::Size& frame_size, |
333 float device_scale_factor) override; | 333 float device_scale_factor) override; |
334 void OnDisplayCompositorCreated( | 334 void OnDisplayCompositorCreated( |
335 const cc::SurfaceId& root_surface_id) override; | 335 const cc::SurfaceId& root_surface_id) override; |
336 | 336 |
337 // UserIdTrackerObserver: | 337 // UserIdTrackerObserver: |
(...skipping 24 matching lines...) Expand all Loading... |
362 bool in_destructor_; | 362 bool in_destructor_; |
363 std::map<UserId, bool> high_contrast_mode_; | 363 std::map<UserId, bool> high_contrast_mode_; |
364 | 364 |
365 // Maps from window manager change id to the client that initiated the | 365 // Maps from window manager change id to the client that initiated the |
366 // request. | 366 // request. |
367 InFlightWindowManagerChangeMap in_flight_wm_change_map_; | 367 InFlightWindowManagerChangeMap in_flight_wm_change_map_; |
368 | 368 |
369 // Next id supplied to the window manager. | 369 // Next id supplied to the window manager. |
370 uint32_t next_wm_change_id_; | 370 uint32_t next_wm_change_id_; |
371 | 371 |
372 std::unique_ptr<GpuServiceProxy> gpu_proxy_; | 372 std::unique_ptr<GpuHost> gpu_host_; |
373 base::Callback<void(ServerWindow*)> window_paint_callback_; | 373 base::Callback<void(ServerWindow*)> window_paint_callback_; |
374 | 374 |
375 UserActivityMonitorMap activity_monitor_map_; | 375 UserActivityMonitorMap activity_monitor_map_; |
376 | 376 |
377 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; | 377 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; |
378 | 378 |
379 cc::SurfaceId root_surface_id_; | 379 cc::SurfaceId root_surface_id_; |
380 | 380 |
381 mojo::Binding<cc::mojom::DisplayCompositorClient> | 381 mojo::Binding<cc::mojom::DisplayCompositorClient> |
382 display_compositor_client_binding_; | 382 display_compositor_client_binding_; |
383 // State for rendering into a Surface. | 383 // State for rendering into a Surface. |
384 cc::mojom::DisplayCompositorPtr display_compositor_; | 384 cc::mojom::DisplayCompositorPtr display_compositor_; |
385 | 385 |
386 DISALLOW_COPY_AND_ASSIGN(WindowServer); | 386 DISALLOW_COPY_AND_ASSIGN(WindowServer); |
387 }; | 387 }; |
388 | 388 |
389 } // namespace ws | 389 } // namespace ws |
390 } // namespace ui | 390 } // namespace ui |
391 | 391 |
392 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ | 392 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ |
OLD | NEW |