Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MANAGER_H_ | 5 #ifndef SERVICES_UI_WS_DISPLAY_MANAGER_H_ |
| 6 #define SERVICES_UI_WS_DISPLAY_MANAGER_H_ | 6 #define SERVICES_UI_WS_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "services/ui/display/screen_manager_delegate.h" | 13 #include "services/ui/display/screen_manager_delegate.h" |
| 14 #include "services/ui/ws/cursor_location_manager.h" | |
|
msw
2017/02/16 21:19:49
nit: use a fwd decl instead
kylechar
2017/02/16 22:06:56
Done.
| |
| 14 #include "services/ui/ws/ids.h" | 15 #include "services/ui/ws/ids.h" |
| 15 #include "services/ui/ws/user_id.h" | 16 #include "services/ui/ws/user_id.h" |
| 16 #include "services/ui/ws/user_id_tracker_observer.h" | 17 #include "services/ui/ws/user_id_tracker_observer.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 namespace ws { | 20 namespace ws { |
| 20 | 21 |
| 21 class Display; | 22 class Display; |
| 22 class ServerWindow; | 23 class ServerWindow; |
| 23 class UserDisplayManager; | 24 class UserDisplayManager; |
| 24 class UserIdTracker; | 25 class UserIdTracker; |
| 25 class WindowManagerDisplayRoot; | 26 class WindowManagerDisplayRoot; |
| 26 class WindowServer; | 27 class WindowServer; |
| 27 | 28 |
| 28 // DisplayManager manages the set of Displays. DisplayManager distinguishes | 29 // DisplayManager manages the set of Displays. DisplayManager distinguishes |
| 29 // between displays that do yet have an accelerated widget (pending), vs | 30 // between displays that do yet have an accelerated widget (pending), vs |
| 30 // those that do. | 31 // those that do. |
| 31 class DisplayManager : public UserIdTrackerObserver, | 32 class DisplayManager : public UserIdTrackerObserver, |
| 32 public display::ScreenManagerDelegate { | 33 public display::ScreenManagerDelegate { |
| 33 public: | 34 public: |
| 34 DisplayManager(WindowServer* window_server, UserIdTracker* user_id_tracker); | 35 DisplayManager(WindowServer* window_server, UserIdTracker* user_id_tracker); |
| 35 ~DisplayManager() override; | 36 ~DisplayManager() override; |
| 36 | 37 |
| 37 // Returns the UserDisplayManager for |user_id|. DisplayManager owns the | 38 // Returns the UserDisplayManager for |user_id|. DisplayManager owns the |
| 38 // return value. | 39 // return value. |
| 39 UserDisplayManager* GetUserDisplayManager(const UserId& user_id); | 40 UserDisplayManager* GetUserDisplayManager(const UserId& user_id); |
| 40 | 41 |
| 42 // Returns the CursorLocationManager for |user_id|. | |
| 43 CursorLocationManager* GetCursorLocationManager(const UserId& user_id); | |
| 44 | |
| 41 // Adds/removes a Display. DisplayManager owns the Displays. | 45 // Adds/removes a Display. DisplayManager owns the Displays. |
| 42 // TODO(sky): make add take a scoped_ptr. | 46 // TODO(sky): make add take a scoped_ptr. |
| 43 void AddDisplay(Display* display); | 47 void AddDisplay(Display* display); |
| 44 void DestroyDisplay(Display* display); | 48 void DestroyDisplay(Display* display); |
| 45 void DestroyAllDisplays(); | 49 void DestroyAllDisplays(); |
| 46 const std::set<Display*>& displays() { return displays_; } | 50 const std::set<Display*>& displays() { return displays_; } |
| 47 std::set<const Display*> displays() const; | 51 std::set<const Display*> displays() const; |
| 48 | 52 |
| 49 // Notifies when something about the Display changes. | 53 // Notifies when something about the Display changes. |
| 50 void OnDisplayUpdate(Display* display); | 54 void OnDisplayUpdate(Display* display); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 WindowServer* window_server_; | 96 WindowServer* window_server_; |
| 93 UserIdTracker* user_id_tracker_; | 97 UserIdTracker* user_id_tracker_; |
| 94 | 98 |
| 95 // Displays are initially added to |pending_displays_|. When the display is | 99 // Displays are initially added to |pending_displays_|. When the display is |
| 96 // initialized it is moved to |displays_|. WindowServer owns the Displays. | 100 // initialized it is moved to |displays_|. WindowServer owns the Displays. |
| 97 std::set<Display*> pending_displays_; | 101 std::set<Display*> pending_displays_; |
| 98 std::set<Display*> displays_; | 102 std::set<Display*> displays_; |
| 99 | 103 |
| 100 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; | 104 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; |
| 101 | 105 |
| 106 std::map<UserId, std::unique_ptr<CursorLocationManager>> | |
| 107 cursor_location_managers_; | |
| 108 | |
| 102 // ID to use for next root node. | 109 // ID to use for next root node. |
| 103 ClientSpecificId next_root_id_; | 110 ClientSpecificId next_root_id_; |
| 104 | 111 |
| 105 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 112 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 106 }; | 113 }; |
| 107 | 114 |
| 108 } // namespace ws | 115 } // namespace ws |
| 109 } // namespace ui | 116 } // namespace ui |
| 110 | 117 |
| 111 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ | 118 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ |
| OLD | NEW |