| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DISPLAY_H_ | 5 #ifndef SERVICES_UI_WS_DISPLAY_H_ |
| 6 #define SERVICES_UI_WS_DISPLAY_H_ | 6 #define SERVICES_UI_WS_DISPLAY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // ways: | 48 // ways: |
| 49 // . with a DisplayBinding. In this mode there is only ever one WindowManager | 49 // . with a DisplayBinding. In this mode there is only ever one WindowManager |
| 50 // for the display, which comes from the client that created the | 50 // for the display, which comes from the client that created the |
| 51 // Display. | 51 // Display. |
| 52 // . without a DisplayBinding. In this mode a WindowManager is automatically | 52 // . without a DisplayBinding. In this mode a WindowManager is automatically |
| 53 // created per user. | 53 // created per user. |
| 54 class Display : public PlatformDisplayDelegate, | 54 class Display : public PlatformDisplayDelegate, |
| 55 public mojom::WindowTreeHost, | 55 public mojom::WindowTreeHost, |
| 56 public FocusControllerObserver, | 56 public FocusControllerObserver, |
| 57 public FocusControllerDelegate, | 57 public FocusControllerDelegate, |
| 58 public ServerWindowObserver, | |
| 59 public UserIdTrackerObserver, | 58 public UserIdTrackerObserver, |
| 60 public WindowManagerWindowTreeFactorySetObserver { | 59 public WindowManagerWindowTreeFactorySetObserver { |
| 61 public: | 60 public: |
| 62 Display(WindowServer* window_server, | 61 Display(WindowServer* window_server, |
| 63 const PlatformDisplayInitParams& platform_display_init_params); | 62 const PlatformDisplayInitParams& platform_display_init_params); |
| 64 ~Display() override; | 63 ~Display() override; |
| 65 | 64 |
| 66 // Initializes state that depends on the existence of a Display. | 65 // Initializes state that depends on the existence of a Display. |
| 67 void Init(std::unique_ptr<DisplayBinding> binding); | 66 void Init(std::unique_ptr<DisplayBinding> binding); |
| 68 | 67 |
| 69 int64_t GetId() const; | 68 int64_t GetId() const; |
| 70 | 69 |
| 71 DisplayManager* display_manager(); | 70 DisplayManager* display_manager(); |
| 72 const DisplayManager* display_manager() const; | 71 const DisplayManager* display_manager() const; |
| 73 | 72 |
| 74 PlatformDisplay* platform_display() { return platform_display_.get(); } | 73 PlatformDisplay* platform_display() { return platform_display_.get(); } |
| 75 | 74 |
| 76 // Returns a mojom::WsDisplay for the specified display. WindowManager | 75 // Returns a mojom::WsDisplay for the specified display. WindowManager |
| 77 // specific values are not set. | 76 // specific values are not set. |
| 78 mojom::WsDisplayPtr ToWsDisplay() const; | 77 mojom::WsDisplayPtr ToWsDisplay() const; |
| 79 | 78 |
| 80 // Returns a display::Display for the specficied display. | 79 // Returns a display::Display for the specficied display. |
| 81 display::Display ToDisplay() const; | 80 display::Display ToDisplay() const; |
| 82 | 81 |
| 83 // Schedules a paint for the specified region in the coordinates of |window|. | 82 // Schedules a paint for the specified region in the coordinates of |window|. |
| 84 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds); | 83 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds); |
| 85 | 84 |
| 86 // Schedules destruction of surfaces in |window|. If a frame has been | |
| 87 // scheduled but not drawn surface destruction is delayed until the frame is | |
| 88 // drawn, otherwise destruction is immediate. | |
| 89 void ScheduleSurfaceDestruction(ServerWindow* window); | |
| 90 | |
| 91 display::Display::Rotation GetRotation() const; | 85 display::Display::Rotation GetRotation() const; |
| 92 gfx::Size GetSize() const; | 86 gfx::Size GetSize() const; |
| 93 | 87 |
| 94 WindowServer* window_server() { return window_server_; } | 88 WindowServer* window_server() { return window_server_; } |
| 95 | 89 |
| 96 // Returns the root of the Display. The root's children are the roots | 90 // Returns the root of the Display. The root's children are the roots |
| 97 // of the corresponding WindowManagers. | 91 // of the corresponding WindowManagers. |
| 98 ServerWindow* root_window() { return root_.get(); } | 92 ServerWindow* root_window() { return root_.get(); } |
| 99 const ServerWindow* root_window() const { return root_.get(); } | 93 const ServerWindow* root_window() const { return root_.get(); } |
| 100 | 94 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 WindowManagerWindowTreeFactory* factory); | 162 WindowManagerWindowTreeFactory* factory); |
| 169 | 163 |
| 170 // PlatformDisplayDelegate: | 164 // PlatformDisplayDelegate: |
| 171 void CreateRootWindow(const gfx::Size& size) override; | 165 void CreateRootWindow(const gfx::Size& size) override; |
| 172 ServerWindow* GetRootWindow() override; | 166 ServerWindow* GetRootWindow() override; |
| 173 bool IsInHighContrastMode() override; | 167 bool IsInHighContrastMode() override; |
| 174 void OnEvent(const ui::Event& event) override; | 168 void OnEvent(const ui::Event& event) override; |
| 175 void OnNativeCaptureLost() override; | 169 void OnNativeCaptureLost() override; |
| 176 void OnViewportMetricsChanged(const ViewportMetrics& old_metrics, | 170 void OnViewportMetricsChanged(const ViewportMetrics& old_metrics, |
| 177 const ViewportMetrics& new_metrics) override; | 171 const ViewportMetrics& new_metrics) override; |
| 178 void OnCompositorFrameDrawn() override; | |
| 179 | 172 |
| 180 // FocusControllerDelegate: | 173 // FocusControllerDelegate: |
| 181 bool CanHaveActiveChildren(ServerWindow* window) const override; | 174 bool CanHaveActiveChildren(ServerWindow* window) const override; |
| 182 | 175 |
| 183 // FocusControllerObserver: | 176 // FocusControllerObserver: |
| 184 void OnActivationChanged(ServerWindow* old_active_window, | 177 void OnActivationChanged(ServerWindow* old_active_window, |
| 185 ServerWindow* new_active_window) override; | 178 ServerWindow* new_active_window) override; |
| 186 void OnFocusChanged(FocusControllerChangeSource change_source, | 179 void OnFocusChanged(FocusControllerChangeSource change_source, |
| 187 ServerWindow* old_focused_window, | 180 ServerWindow* old_focused_window, |
| 188 ServerWindow* new_focused_window) override; | 181 ServerWindow* new_focused_window) override; |
| 189 | 182 |
| 190 // ServerWindowObserver: | |
| 191 void OnWindowDestroyed(ServerWindow* window) override; | |
| 192 | |
| 193 // UserIdTrackerObserver: | 183 // UserIdTrackerObserver: |
| 194 void OnUserIdRemoved(const UserId& id) override; | 184 void OnUserIdRemoved(const UserId& id) override; |
| 195 | 185 |
| 196 // WindowManagerWindowTreeFactorySetObserver: | 186 // WindowManagerWindowTreeFactorySetObserver: |
| 197 void OnWindowManagerWindowTreeFactoryReady( | 187 void OnWindowManagerWindowTreeFactoryReady( |
| 198 WindowManagerWindowTreeFactory* factory) override; | 188 WindowManagerWindowTreeFactory* factory) override; |
| 199 | 189 |
| 200 std::unique_ptr<DisplayBinding> binding_; | 190 std::unique_ptr<DisplayBinding> binding_; |
| 201 // Set once Init() has been called. | 191 // Set once Init() has been called. |
| 202 bool init_called_ = false; | 192 bool init_called_ = false; |
| 203 WindowServer* const window_server_; | 193 WindowServer* const window_server_; |
| 204 std::unique_ptr<ServerWindow> root_; | 194 std::unique_ptr<ServerWindow> root_; |
| 205 std::unique_ptr<PlatformDisplay> platform_display_; | 195 std::unique_ptr<PlatformDisplay> platform_display_; |
| 206 std::unique_ptr<FocusController> focus_controller_; | 196 std::unique_ptr<FocusController> focus_controller_; |
| 207 | 197 |
| 208 // The last cursor set. Used to track whether we need to change the cursor. | 198 // The last cursor set. Used to track whether we need to change the cursor. |
| 209 mojom::Cursor last_cursor_; | 199 mojom::Cursor last_cursor_; |
| 210 | 200 |
| 211 ServerWindowTracker activation_parents_; | 201 ServerWindowTracker activation_parents_; |
| 212 | 202 |
| 213 // Set of windows with surfaces that need to be destroyed once the frame | |
| 214 // draws. | |
| 215 std::set<ServerWindow*> windows_needing_frame_destruction_; | |
| 216 | |
| 217 WindowManagerDisplayRootMap window_manager_display_root_map_; | 203 WindowManagerDisplayRootMap window_manager_display_root_map_; |
| 218 | 204 |
| 219 DISALLOW_COPY_AND_ASSIGN(Display); | 205 DISALLOW_COPY_AND_ASSIGN(Display); |
| 220 }; | 206 }; |
| 221 | 207 |
| 222 } // namespace ws | 208 } // namespace ws |
| 223 } // namespace ui | 209 } // namespace ui |
| 224 | 210 |
| 225 #endif // SERVICES_UI_WS_DISPLAY_H_ | 211 #endif // SERVICES_UI_WS_DISPLAY_H_ |
| OLD | NEW |