Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "services/ui/ws/focus_controller_observer.h" | 22 #include "services/ui/ws/focus_controller_observer.h" |
| 23 #include "services/ui/ws/platform_display.h" | 23 #include "services/ui/ws/platform_display.h" |
| 24 #include "services/ui/ws/platform_display_delegate.h" | 24 #include "services/ui/ws/platform_display_delegate.h" |
| 25 #include "services/ui/ws/server_window.h" | 25 #include "services/ui/ws/server_window.h" |
| 26 #include "services/ui/ws/server_window_observer.h" | 26 #include "services/ui/ws/server_window_observer.h" |
| 27 #include "services/ui/ws/server_window_tracker.h" | 27 #include "services/ui/ws/server_window_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_observer.h" | 29 #include "services/ui/ws/window_manager_window_tree_factory_set_observer.h" |
| 30 #include "ui/display/display.h" | 30 #include "ui/display/display.h" |
| 31 | 31 |
| 32 namespace display { | |
| 33 struct ViewportMetrics; | |
| 34 } | |
| 35 | |
| 32 namespace ui { | 36 namespace ui { |
| 33 namespace ws { | 37 namespace ws { |
| 34 | 38 |
| 35 class DisplayBinding; | 39 class DisplayBinding; |
| 36 class DisplayManager; | 40 class DisplayManager; |
| 37 class FocusController; | 41 class FocusController; |
| 38 struct PlatformDisplayInitParams; | |
| 39 class WindowManagerDisplayRoot; | 42 class WindowManagerDisplayRoot; |
| 40 class WindowServer; | 43 class WindowServer; |
| 41 class WindowTree; | 44 class WindowTree; |
| 42 | 45 |
| 43 namespace test { | 46 namespace test { |
| 44 class DisplayTestApi; | 47 class DisplayTestApi; |
| 45 } | 48 } |
| 46 | 49 |
| 47 // Displays manages the state associated with a single display. Display has a | 50 // Displays manages the state associated with a single display. Display has a |
| 48 // single root window whose children are the roots for a per-user | 51 // single root window whose children are the roots for a per-user |
| 49 // WindowManager. Display is configured in two distinct | 52 // WindowManager. Display is configured in two distinct |
| 50 // ways: | 53 // ways: |
| 51 // . with a DisplayBinding. In this mode there is only ever one WindowManager | 54 // . with a DisplayBinding. In this mode there is only ever one WindowManager |
| 52 // for the display, which comes from the client that created the | 55 // for the display, which comes from the client that created the |
| 53 // Display. | 56 // Display. |
| 54 // . without a DisplayBinding. In this mode a WindowManager is automatically | 57 // . without a DisplayBinding. In this mode a WindowManager is automatically |
| 55 // created per user. | 58 // created per user. |
| 56 class Display : public PlatformDisplayDelegate, | 59 class Display : public PlatformDisplayDelegate, |
| 57 public mojom::WindowTreeHost, | 60 public mojom::WindowTreeHost, |
| 58 public FocusControllerObserver, | 61 public FocusControllerObserver, |
| 59 public FocusControllerDelegate, | 62 public FocusControllerDelegate, |
| 60 public UserIdTrackerObserver, | 63 public UserIdTrackerObserver, |
| 61 public WindowManagerWindowTreeFactorySetObserver { | 64 public WindowManagerWindowTreeFactorySetObserver { |
| 62 public: | 65 public: |
| 63 explicit Display(WindowServer* window_server); | 66 explicit Display(WindowServer* window_server); |
| 64 ~Display() override; | 67 ~Display() override; |
| 65 | 68 |
| 66 // Initializes the display root ServerWindow and PlatformDisplay. Adds this to | 69 // Initializes the display root ServerWindow and PlatformDisplay. Adds this to |
| 67 // DisplayManager as a pending display, until accelerated widget is available. | 70 // DisplayManager as a pending display, until accelerated widget is available. |
| 68 void Init(const PlatformDisplayInitParams& init_params, | 71 void Init(const display::ViewportMetrics& metrics, |
| 69 std::unique_ptr<DisplayBinding> binding); | 72 std::unique_ptr<DisplayBinding> binding); |
| 70 | 73 |
| 74 // Returns an ID for this display. In internal mode this the display::Display | |
| 75 // ID. In external mode this hasn't been defined yet. | |
| 71 int64_t GetId() const; | 76 int64_t GetId() const; |
| 72 | 77 |
| 78 // Sets the display::Display corresponding to this ws::Display. This is only | |
| 79 // valid in internal window mode. | |
| 80 void SetDisplay(const display::Display& display); | |
| 81 | |
| 82 // PlatformDisplayDelegate: | |
| 83 display::Display GetDisplay() override; | |
|
sky
2017/03/13 18:29:06
Can this return a const Display& ?
kylechar
2017/03/13 19:28:02
Yep! I missed that it wasn't.
| |
| 84 | |
| 73 DisplayManager* display_manager(); | 85 DisplayManager* display_manager(); |
| 74 const DisplayManager* display_manager() const; | 86 const DisplayManager* display_manager() const; |
| 75 | 87 |
| 76 PlatformDisplay* platform_display() { return platform_display_.get(); } | 88 PlatformDisplay* platform_display() { return platform_display_.get(); } |
| 77 | 89 |
| 78 // Returns a display::Display corresponding to this ws::Display. | |
| 79 display::Display ToDisplay() const; | |
| 80 | |
| 81 // Returns the size of the display in physical pixels. | 90 // Returns the size of the display in physical pixels. |
| 82 gfx::Size GetSize() const; | 91 gfx::Size GetSize() const; |
| 83 | 92 |
| 84 WindowServer* window_server() { return window_server_; } | 93 WindowServer* window_server() { return window_server_; } |
| 85 | 94 |
| 86 // Returns the root of the Display. The root's children are the roots | 95 // Returns the root of the Display. The root's children are the roots |
| 87 // of the corresponding WindowManagers. | 96 // of the corresponding WindowManagers. |
| 88 ServerWindow* root_window() { return root_.get(); } | 97 ServerWindow* root_window() { return root_.get(); } |
| 89 const ServerWindow* root_window() const { return root_.get(); } | 98 const ServerWindow* root_window() const { return root_.get(); } |
| 90 | 99 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 void CreateWindowManagerDisplayRootsFromFactories(); | 170 void CreateWindowManagerDisplayRootsFromFactories(); |
| 162 | 171 |
| 163 void CreateWindowManagerDisplayRootFromFactory( | 172 void CreateWindowManagerDisplayRootFromFactory( |
| 164 WindowManagerWindowTreeFactory* factory); | 173 WindowManagerWindowTreeFactory* factory); |
| 165 | 174 |
| 166 // Creates the root ServerWindow for this display, where |size| is in physical | 175 // Creates the root ServerWindow for this display, where |size| is in physical |
| 167 // pixels. | 176 // pixels. |
| 168 void CreateRootWindow(const gfx::Size& size); | 177 void CreateRootWindow(const gfx::Size& size); |
| 169 | 178 |
| 170 // PlatformDisplayDelegate: | 179 // PlatformDisplayDelegate: |
| 171 display::Display GetDisplay() override; | |
| 172 ServerWindow* GetRootWindow() override; | 180 ServerWindow* GetRootWindow() override; |
| 173 void OnAcceleratedWidgetAvailable() override; | 181 void OnAcceleratedWidgetAvailable() override; |
| 174 bool IsInHighContrastMode() override; | 182 bool IsInHighContrastMode() override; |
| 175 void OnEvent(const ui::Event& event) override; | 183 void OnEvent(const ui::Event& event) override; |
| 176 void OnNativeCaptureLost() override; | 184 void OnNativeCaptureLost() override; |
| 177 | 185 |
| 178 // FocusControllerDelegate: | 186 // FocusControllerDelegate: |
| 179 bool CanHaveActiveChildren(ServerWindow* window) const override; | 187 bool CanHaveActiveChildren(ServerWindow* window) const override; |
| 180 | 188 |
| 181 // FocusControllerObserver: | 189 // FocusControllerObserver: |
| 182 void OnActivationChanged(ServerWindow* old_active_window, | 190 void OnActivationChanged(ServerWindow* old_active_window, |
| 183 ServerWindow* new_active_window) override; | 191 ServerWindow* new_active_window) override; |
| 184 void OnFocusChanged(FocusControllerChangeSource change_source, | 192 void OnFocusChanged(FocusControllerChangeSource change_source, |
| 185 ServerWindow* old_focused_window, | 193 ServerWindow* old_focused_window, |
| 186 ServerWindow* new_focused_window) override; | 194 ServerWindow* new_focused_window) override; |
| 187 | 195 |
| 188 // UserIdTrackerObserver: | 196 // UserIdTrackerObserver: |
| 189 void OnUserIdRemoved(const UserId& id) override; | 197 void OnUserIdRemoved(const UserId& id) override; |
| 190 | 198 |
| 191 // WindowManagerWindowTreeFactorySetObserver: | 199 // WindowManagerWindowTreeFactorySetObserver: |
| 192 void OnWindowManagerWindowTreeFactoryReady( | 200 void OnWindowManagerWindowTreeFactoryReady( |
| 193 WindowManagerWindowTreeFactory* factory) override; | 201 WindowManagerWindowTreeFactory* factory) override; |
| 194 | 202 |
| 195 std::unique_ptr<DisplayBinding> binding_; | 203 std::unique_ptr<DisplayBinding> binding_; |
| 196 WindowServer* const window_server_; | 204 WindowServer* const window_server_; |
| 197 std::unique_ptr<ServerWindow> root_; | 205 std::unique_ptr<ServerWindow> root_; |
| 198 std::unique_ptr<PlatformDisplay> platform_display_; | 206 std::unique_ptr<PlatformDisplay> platform_display_; |
| 199 std::unique_ptr<FocusController> focus_controller_; | 207 std::unique_ptr<FocusController> focus_controller_; |
| 200 | 208 |
| 209 // In internal window mode this contains information about the display. In | |
| 210 // external window mode this will be invalid. | |
| 211 display::Display display_; | |
| 212 | |
| 201 // The last cursor set. Used to track whether we need to change the cursor. | 213 // The last cursor set. Used to track whether we need to change the cursor. |
| 202 mojom::Cursor last_cursor_; | 214 mojom::Cursor last_cursor_; |
| 203 | 215 |
| 204 ServerWindowTracker activation_parents_; | 216 ServerWindowTracker activation_parents_; |
| 205 | 217 |
| 206 cc::LocalSurfaceIdAllocator allocator_; | 218 cc::LocalSurfaceIdAllocator allocator_; |
| 207 | 219 |
| 208 WindowManagerDisplayRootMap window_manager_display_root_map_; | 220 WindowManagerDisplayRootMap window_manager_display_root_map_; |
| 209 | 221 |
| 210 DISALLOW_COPY_AND_ASSIGN(Display); | 222 DISALLOW_COPY_AND_ASSIGN(Display); |
| 211 }; | 223 }; |
| 212 | 224 |
| 213 } // namespace ws | 225 } // namespace ws |
| 214 } // namespace ui | 226 } // namespace ui |
| 215 | 227 |
| 216 #endif // SERVICES_UI_WS_DISPLAY_H_ | 228 #endif // SERVICES_UI_WS_DISPLAY_H_ |
| OLD | NEW |