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/platform_screen_delegate.h" | 13 #include "services/ui/display/screen_manager_delegate.h" |
14 #include "services/ui/ws/ids.h" | 14 #include "services/ui/ws/ids.h" |
15 #include "services/ui/ws/user_id.h" | 15 #include "services/ui/ws/user_id.h" |
16 #include "services/ui/ws/user_id_tracker_observer.h" | 16 #include "services/ui/ws/user_id_tracker_observer.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 namespace ws { | 19 namespace ws { |
20 | 20 |
21 class Display; | 21 class Display; |
22 class ServerWindow; | 22 class ServerWindow; |
23 class UserDisplayManager; | 23 class UserDisplayManager; |
24 class UserIdTracker; | 24 class UserIdTracker; |
25 class WindowManagerDisplayRoot; | 25 class WindowManagerDisplayRoot; |
26 class WindowServer; | 26 class WindowServer; |
27 | 27 |
28 // DisplayManager manages the set of Displays. DisplayManager distinguishes | 28 // DisplayManager manages the set of Displays. DisplayManager distinguishes |
29 // between displays that do yet have an accelerated widget (pending), vs | 29 // between displays that do yet have an accelerated widget (pending), vs |
30 // those that do. | 30 // those that do. |
31 class DisplayManager : public UserIdTrackerObserver, | 31 class DisplayManager : public UserIdTrackerObserver, |
32 public display::PlatformScreenDelegate { | 32 public display::ScreenManagerDelegate { |
33 public: | 33 public: |
34 DisplayManager(WindowServer* window_server, UserIdTracker* user_id_tracker); | 34 DisplayManager(WindowServer* window_server, UserIdTracker* user_id_tracker); |
35 ~DisplayManager() override; | 35 ~DisplayManager() override; |
36 | 36 |
37 // Returns the UserDisplayManager for |user_id|. DisplayManager owns the | 37 // Returns the UserDisplayManager for |user_id|. DisplayManager owns the |
38 // return value. | 38 // return value. |
39 UserDisplayManager* GetUserDisplayManager(const UserId& user_id); | 39 UserDisplayManager* GetUserDisplayManager(const UserId& user_id); |
40 | 40 |
41 // Adds/removes a Display. DisplayManager owns the Displays. | 41 // Adds/removes a Display. DisplayManager owns the Displays. |
42 // TODO(sky): make add take a scoped_ptr. | 42 // TODO(sky): make add take a scoped_ptr. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 WindowId GetAndAdvanceNextRootId(); | 74 WindowId GetAndAdvanceNextRootId(); |
75 | 75 |
76 // Called when the AcceleratedWidget is available for |display|. | 76 // Called when the AcceleratedWidget is available for |display|. |
77 void OnDisplayAcceleratedWidgetAvailable(Display* display); | 77 void OnDisplayAcceleratedWidgetAvailable(Display* display); |
78 | 78 |
79 private: | 79 private: |
80 // UserIdTrackerObserver: | 80 // UserIdTrackerObserver: |
81 void OnActiveUserIdChanged(const UserId& previously_active_id, | 81 void OnActiveUserIdChanged(const UserId& previously_active_id, |
82 const UserId& active_id) override; | 82 const UserId& active_id) override; |
83 | 83 |
84 // display::PlatformScreenDelegate: | 84 // display::ScreenManagerDelegate: |
85 void OnDisplayAdded(int64_t id, | 85 void OnDisplayAdded(int64_t id, |
86 const display::ViewportMetrics& metrics) override; | 86 const display::ViewportMetrics& metrics) override; |
87 void OnDisplayRemoved(int64_t id) override; | 87 void OnDisplayRemoved(int64_t id) override; |
88 void OnDisplayModified(int64_t id, | 88 void OnDisplayModified(int64_t id, |
89 const display::ViewportMetrics& metrics) override; | 89 const display::ViewportMetrics& metrics) override; |
90 void OnPrimaryDisplayChanged(int64_t primary_display_id) override; | 90 void OnPrimaryDisplayChanged(int64_t primary_display_id) override; |
91 | 91 |
92 WindowServer* window_server_; | 92 WindowServer* window_server_; |
93 UserIdTracker* user_id_tracker_; | 93 UserIdTracker* user_id_tracker_; |
94 | 94 |
95 // Displays are initially added to |pending_displays_|. When the display is | 95 // Displays are initially added to |pending_displays_|. When the display is |
96 // initialized it is moved to |displays_|. WindowServer owns the Displays. | 96 // initialized it is moved to |displays_|. WindowServer owns the Displays. |
97 std::set<Display*> pending_displays_; | 97 std::set<Display*> pending_displays_; |
98 std::set<Display*> displays_; | 98 std::set<Display*> displays_; |
99 | 99 |
100 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; | 100 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; |
101 | 101 |
102 // ID to use for next root node. | 102 // ID to use for next root node. |
103 ClientSpecificId next_root_id_; | 103 ClientSpecificId next_root_id_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 105 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace ws | 108 } // namespace ws |
109 } // namespace ui | 109 } // namespace ui |
110 | 110 |
111 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ | 111 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ |
OLD | NEW |