| 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/binding.h" | 18 #include "mojo/public/cpp/bindings/binding.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/ws/gpu_host_delegate.h" | 21 #include "services/ui/ws/gpu_host_delegate.h" |
| 22 #include "services/ui/ws/ids.h" | 22 #include "services/ui/ws/ids.h" |
| 23 #include "services/ui/ws/operation.h" | 23 #include "services/ui/ws/operation.h" |
| 24 #include "services/ui/ws/server_window_delegate.h" | 24 #include "services/ui/ws/server_window_delegate.h" |
| 25 #include "services/ui/ws/server_window_observer.h" | 25 #include "services/ui/ws/server_window_observer.h" |
| 26 #include "services/ui/ws/user_display_manager_delegate.h" | 26 #include "services/ui/ws/user_display_manager_delegate.h" |
| 27 #include "services/ui/ws/user_id_tracker.h" | 27 #include "services/ui/ws/user_id_tracker.h" |
| 28 #include "services/ui/ws/user_id_tracker_observer.h" | 28 #include "services/ui/ws/user_id_tracker_observer.h" |
| 29 #include "services/ui/ws/window_manager_window_tree_factory_set.h" | 29 #include "services/ui/ws/window_manager_window_tree_factory_set.h" |
| 30 #include "services/ui/ws/window_tree_host_factory.h" |
| 30 | 31 |
| 31 namespace ui { | 32 namespace ui { |
| 32 namespace ws { | 33 namespace ws { |
| 33 | 34 |
| 34 class AccessPolicy; | 35 class AccessPolicy; |
| 35 class Display; | 36 class Display; |
| 36 class DisplayManager; | 37 class DisplayManager; |
| 37 class GpuHost; | 38 class GpuHost; |
| 38 class ServerWindow; | 39 class ServerWindow; |
| 39 class UserActivityMonitor; | 40 class UserActivityMonitor; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 mojom::WindowTreeRequest window_tree_request, | 94 mojom::WindowTreeRequest window_tree_request, |
| 94 mojom::WindowTreeClientPtr window_tree_client); | 95 mojom::WindowTreeClientPtr window_tree_client); |
| 95 // Invoked when a WindowTree's connection encounters an error. | 96 // Invoked when a WindowTree's connection encounters an error. |
| 96 void DestroyTree(WindowTree* tree); | 97 void DestroyTree(WindowTree* tree); |
| 97 | 98 |
| 98 // Returns the tree by client id. | 99 // Returns the tree by client id. |
| 99 WindowTree* GetTreeWithId(ClientSpecificId client_id); | 100 WindowTree* GetTreeWithId(ClientSpecificId client_id); |
| 100 | 101 |
| 101 WindowTree* GetTreeWithClientName(const std::string& client_name); | 102 WindowTree* GetTreeWithClientName(const std::string& client_name); |
| 102 | 103 |
| 104 WindowTree* GetTreeForExternalWindowMode(); |
| 105 |
| 103 size_t num_trees() const { return tree_map_.size(); } | 106 size_t num_trees() const { return tree_map_.size(); } |
| 104 | 107 |
| 105 // Returns the Window identified by |id|. | 108 // Returns the Window identified by |id|. |
| 106 ServerWindow* GetWindow(const WindowId& id); | 109 ServerWindow* GetWindow(const WindowId& id); |
| 107 | 110 |
| 108 OperationType current_operation_type() const { | 111 OperationType current_operation_type() const { |
| 109 return current_operation_ ? current_operation_->type() | 112 return current_operation_ ? current_operation_->type() |
| 110 : OperationType::NONE; | 113 : OperationType::NONE; |
| 111 } | 114 } |
| 112 | 115 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 129 const_cast<const WindowServer*>(this)->GetTreeWithRoot(window)); | 132 const_cast<const WindowServer*>(this)->GetTreeWithRoot(window)); |
| 130 } | 133 } |
| 131 const WindowTree* GetTreeWithRoot(const ServerWindow* window) const; | 134 const WindowTree* GetTreeWithRoot(const ServerWindow* window) const; |
| 132 | 135 |
| 133 UserActivityMonitor* GetUserActivityMonitorForUser(const UserId& user_id); | 136 UserActivityMonitor* GetUserActivityMonitorForUser(const UserId& user_id); |
| 134 | 137 |
| 135 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set() { | 138 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set() { |
| 136 return &window_manager_window_tree_factory_set_; | 139 return &window_manager_window_tree_factory_set_; |
| 137 } | 140 } |
| 138 | 141 |
| 142 void set_window_tree_host_factory( |
| 143 std::unique_ptr<WindowTreeHostFactory> factory) { |
| 144 DCHECK(factory); |
| 145 window_tree_host_factory_ = std::move(factory); |
| 146 } |
| 147 |
| 139 // Sets focus to |window|. Returns true if |window| already has focus, or | 148 // Sets focus to |window|. Returns true if |window| already has focus, or |
| 140 // focus was successfully changed. Returns |false| if |window| is not a valid | 149 // focus was successfully changed. Returns |false| if |window| is not a valid |
| 141 // window to receive focus. | 150 // window to receive focus. |
| 142 bool SetFocusedWindow(ServerWindow* window); | 151 bool SetFocusedWindow(ServerWindow* window); |
| 143 ServerWindow* GetFocusedWindow(); | 152 ServerWindow* GetFocusedWindow(); |
| 144 | 153 |
| 154 void SetInExternalWindowMode() { in_external_window_mode = true; } |
| 155 bool IsInExternalWindowMode() const { return in_external_window_mode; } |
| 156 |
| 145 bool IsActiveUserInHighContrastMode() const; | 157 bool IsActiveUserInHighContrastMode() const; |
| 146 void SetHighContrastMode(const UserId& user, bool enabled); | 158 void SetHighContrastMode(const UserId& user, bool enabled); |
| 147 | 159 |
| 148 // Returns a change id for the window manager that is associated with | 160 // Returns a change id for the window manager that is associated with |
| 149 // |source| and |client_change_id|. When the window manager replies | 161 // |source| and |client_change_id|. When the window manager replies |
| 150 // WindowManagerChangeCompleted() is called to obtain the original source | 162 // WindowManagerChangeCompleted() is called to obtain the original source |
| 151 // and client supplied change_id that initiated the called. | 163 // and client supplied change_id that initiated the called. |
| 152 uint32_t GenerateWindowManagerChangeId(WindowTree* source, | 164 uint32_t GenerateWindowManagerChangeId(WindowTree* source, |
| 153 uint32_t client_change_id); | 165 uint32_t client_change_id); |
| 154 | 166 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // Next id supplied to the window manager. | 386 // Next id supplied to the window manager. |
| 375 uint32_t next_wm_change_id_; | 387 uint32_t next_wm_change_id_; |
| 376 | 388 |
| 377 std::unique_ptr<GpuHost> gpu_host_; | 389 std::unique_ptr<GpuHost> gpu_host_; |
| 378 base::Callback<void(ServerWindow*)> window_paint_callback_; | 390 base::Callback<void(ServerWindow*)> window_paint_callback_; |
| 379 | 391 |
| 380 UserActivityMonitorMap activity_monitor_map_; | 392 UserActivityMonitorMap activity_monitor_map_; |
| 381 | 393 |
| 382 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; | 394 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; |
| 383 | 395 |
| 396 std::unique_ptr<WindowTreeHostFactory> window_tree_host_factory_; |
| 397 |
| 384 cc::SurfaceId root_surface_id_; | 398 cc::SurfaceId root_surface_id_; |
| 385 | 399 |
| 386 mojo::Binding<cc::mojom::DisplayCompositorClient> | 400 mojo::Binding<cc::mojom::DisplayCompositorClient> |
| 387 display_compositor_client_binding_; | 401 display_compositor_client_binding_; |
| 388 // State for rendering into a Surface. | 402 // State for rendering into a Surface. |
| 389 cc::mojom::DisplayCompositorPtr display_compositor_; | 403 cc::mojom::DisplayCompositorPtr display_compositor_; |
| 390 | 404 |
| 405 bool in_external_window_mode = false; |
| 406 |
| 391 DISALLOW_COPY_AND_ASSIGN(WindowServer); | 407 DISALLOW_COPY_AND_ASSIGN(WindowServer); |
| 392 }; | 408 }; |
| 393 | 409 |
| 394 } // namespace ws | 410 } // namespace ws |
| 395 } // namespace ui | 411 } // namespace ui |
| 396 | 412 |
| 397 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ | 413 #endif // SERVICES_UI_WS_WINDOW_SERVER_H_ |
| OLD | NEW |