| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <set> | 13 #include <set> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "services/ui/common/types.h" | 17 #include "services/ui/common/types.h" |
| 18 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 18 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 19 #include "services/ui/public/interfaces/window_tree_host.mojom.h" | 19 #include "services/ui/public/interfaces/window_tree_host.mojom.h" |
| 20 #include "services/ui/ws/focus_controller_delegate.h" | 20 #include "services/ui/ws/focus_controller_delegate.h" |
| 21 #include "services/ui/ws/focus_controller_observer.h" | 21 #include "services/ui/ws/focus_controller_observer.h" |
| 22 #include "services/ui/ws/platform_display.h" | 22 #include "services/ui/ws/platform_display.h" |
| 23 #include "services/ui/ws/platform_display_delegate.h" | 23 #include "services/ui/ws/platform_display_delegate.h" |
| 24 #include "services/ui/ws/server_window.h" | 24 #include "services/ui/ws/server_window.h" |
| 25 #include "services/ui/ws/server_window_observer.h" | 25 #include "services/ui/ws/server_window_observer.h" |
| 26 #include "services/ui/ws/server_window_tracker.h" | 26 #include "services/ui/ws/server_window_tracker.h" |
| 27 #include "services/ui/ws/user_id_tracker_observer.h" | 27 #include "services/ui/ws/user_id_tracker_observer.h" |
| 28 #include "services/ui/ws/window_manager_window_tree_factory_set_observer.h" | 28 #include "services/ui/ws/window_manager_window_tree_factory_set_observer.h" |
| 29 #include "ui/display/display.h" | 29 #include "ui/display/display.h" |
| 30 #include "ui/events/event_processor.h" |
| 30 | 31 |
| 31 namespace ui { | 32 namespace ui { |
| 32 namespace ws { | 33 namespace ws { |
| 33 | 34 |
| 34 class DisplayBinding; | 35 class DisplayBinding; |
| 35 class DisplayManager; | 36 class DisplayManager; |
| 36 class FocusController; | 37 class FocusController; |
| 37 struct PlatformDisplayInitParams; | 38 struct PlatformDisplayInitParams; |
| 38 class WindowManagerDisplayRoot; | 39 class WindowManagerDisplayRoot; |
| 39 class WindowServer; | 40 class WindowServer; |
| 40 class WindowTree; | 41 class WindowTree; |
| 41 | 42 |
| 42 namespace test { | 43 namespace test { |
| 43 class DisplayTestApi; | 44 class DisplayTestApi; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Displays manages the state associated with a single display. Display has a | 47 // Displays manages the state associated with a single display. Display has a |
| 47 // single root window whose children are the roots for a per-user | 48 // single root window whose children are the roots for a per-user |
| 48 // WindowManager. Display is configured in two distinct | 49 // WindowManager. Display is configured in two distinct |
| 49 // ways: | 50 // ways: |
| 50 // . with a DisplayBinding. In this mode there is only ever one WindowManager | 51 // . with a DisplayBinding. In this mode there is only ever one WindowManager |
| 51 // for the display, which comes from the client that created the | 52 // for the display, which comes from the client that created the |
| 52 // Display. | 53 // Display. |
| 53 // . without a DisplayBinding. In this mode a WindowManager is automatically | 54 // . without a DisplayBinding. In this mode a WindowManager is automatically |
| 54 // created per user. | 55 // created per user. |
| 55 class Display : public PlatformDisplayDelegate, | 56 class Display : public ui::EventProcessor, |
| 57 public PlatformDisplayDelegate, |
| 56 public mojom::WindowTreeHost, | 58 public mojom::WindowTreeHost, |
| 57 public FocusControllerObserver, | 59 public FocusControllerObserver, |
| 58 public FocusControllerDelegate, | 60 public FocusControllerDelegate, |
| 59 public UserIdTrackerObserver, | 61 public UserIdTrackerObserver, |
| 60 public WindowManagerWindowTreeFactorySetObserver { | 62 public WindowManagerWindowTreeFactorySetObserver { |
| 61 public: | 63 public: |
| 62 explicit Display(WindowServer* window_server); | 64 explicit Display(WindowServer* window_server); |
| 63 ~Display() override; | 65 ~Display() override; |
| 64 | 66 |
| 65 // Initializes the display root ServerWindow and PlatformDisplay. Adds this to | 67 // Initializes the display root ServerWindow and PlatformDisplay. Adds this to |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // WindowManagerWindowTreeFactorySet. | 161 // WindowManagerWindowTreeFactorySet. |
| 160 void CreateWindowManagerDisplayRootsFromFactories(); | 162 void CreateWindowManagerDisplayRootsFromFactories(); |
| 161 | 163 |
| 162 void CreateWindowManagerDisplayRootFromFactory( | 164 void CreateWindowManagerDisplayRootFromFactory( |
| 163 WindowManagerWindowTreeFactory* factory); | 165 WindowManagerWindowTreeFactory* factory); |
| 164 | 166 |
| 165 // Creates the root ServerWindow for this display, where |size| is in physical | 167 // Creates the root ServerWindow for this display, where |size| is in physical |
| 166 // pixels. | 168 // pixels. |
| 167 void CreateRootWindow(const gfx::Size& size); | 169 void CreateRootWindow(const gfx::Size& size); |
| 168 | 170 |
| 171 // ui::EventProcessor: |
| 172 bool CanDispatchToTarget(ui::EventTarget* target) override; |
| 173 ui::EventTarget* GetRootForEvent(ui::Event* event) override; |
| 174 ui::EventTargeter* GetDefaultEventTargeter() override; |
| 175 ui::EventDispatchDetails OnEventFromSource(ui::Event* event) override; |
| 176 |
| 169 // PlatformDisplayDelegate: | 177 // PlatformDisplayDelegate: |
| 170 display::Display GetDisplay() override; | 178 display::Display GetDisplay() override; |
| 171 ServerWindow* GetRootWindow() override; | 179 ServerWindow* GetRootWindow() override; |
| 180 ui::EventProcessor* GetEventProcessor() override; |
| 172 void OnAcceleratedWidgetAvailable() override; | 181 void OnAcceleratedWidgetAvailable() override; |
| 173 bool IsInHighContrastMode() override; | 182 bool IsInHighContrastMode() override; |
| 174 void OnEvent(const ui::Event& event) override; | |
| 175 void OnNativeCaptureLost() override; | 183 void OnNativeCaptureLost() override; |
| 176 | 184 |
| 177 // FocusControllerDelegate: | 185 // FocusControllerDelegate: |
| 178 bool CanHaveActiveChildren(ServerWindow* window) const override; | 186 bool CanHaveActiveChildren(ServerWindow* window) const override; |
| 179 | 187 |
| 180 // FocusControllerObserver: | 188 // FocusControllerObserver: |
| 181 void OnActivationChanged(ServerWindow* old_active_window, | 189 void OnActivationChanged(ServerWindow* old_active_window, |
| 182 ServerWindow* new_active_window) override; | 190 ServerWindow* new_active_window) override; |
| 183 void OnFocusChanged(FocusControllerChangeSource change_source, | 191 void OnFocusChanged(FocusControllerChangeSource change_source, |
| 184 ServerWindow* old_focused_window, | 192 ServerWindow* old_focused_window, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 204 | 212 |
| 205 WindowManagerDisplayRootMap window_manager_display_root_map_; | 213 WindowManagerDisplayRootMap window_manager_display_root_map_; |
| 206 | 214 |
| 207 DISALLOW_COPY_AND_ASSIGN(Display); | 215 DISALLOW_COPY_AND_ASSIGN(Display); |
| 208 }; | 216 }; |
| 209 | 217 |
| 210 } // namespace ws | 218 } // namespace ws |
| 211 } // namespace ui | 219 } // namespace ui |
| 212 | 220 |
| 213 #endif // SERVICES_UI_WS_DISPLAY_H_ | 221 #endif // SERVICES_UI_WS_DISPLAY_H_ |
| OLD | NEW |