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/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 #include "ui/display/display.h" |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 namespace ws { | 20 namespace ws { |
20 | 21 |
21 class CursorLocationManager; | 22 class CursorLocationManager; |
22 class Display; | 23 class Display; |
23 class ServerWindow; | 24 class ServerWindow; |
24 class UserDisplayManager; | 25 class UserDisplayManager; |
25 class UserIdTracker; | 26 class UserIdTracker; |
26 class WindowManagerDisplayRoot; | 27 class WindowManagerDisplayRoot; |
(...skipping 17 matching lines...) Expand all Loading... |
44 | 45 |
45 // Adds/removes a Display. DisplayManager owns the Displays. | 46 // Adds/removes a Display. DisplayManager owns the Displays. |
46 // TODO(sky): make add take a scoped_ptr. | 47 // TODO(sky): make add take a scoped_ptr. |
47 void AddDisplay(Display* display); | 48 void AddDisplay(Display* display); |
48 void DestroyDisplay(Display* display); | 49 void DestroyDisplay(Display* display); |
49 void DestroyAllDisplays(); | 50 void DestroyAllDisplays(); |
50 const std::set<Display*>& displays() { return displays_; } | 51 const std::set<Display*>& displays() { return displays_; } |
51 std::set<const Display*> displays() const; | 52 std::set<const Display*> displays() const; |
52 | 53 |
53 // Notifies when something about the Display changes. | 54 // Notifies when something about the Display changes. |
54 void OnDisplayUpdate(Display* display); | 55 void OnDisplayUpdate(const display::Display& display); |
55 | 56 |
56 // Returns the Display that contains |window|, or null if |window| is not | 57 // Returns the Display that contains |window|, or null if |window| is not |
57 // attached to a display. | 58 // attached to a display. |
58 Display* GetDisplayContaining(const ServerWindow* window); | 59 Display* GetDisplayContaining(const ServerWindow* window); |
59 const Display* GetDisplayContaining(const ServerWindow* window) const; | 60 const Display* GetDisplayContaining(const ServerWindow* window) const; |
60 | 61 |
61 // Returns the display with the specified display id, or null if there is no | 62 // Returns the display with the specified display id, or null if there is no |
62 // display with that id. | 63 // display with that id. |
63 Display* GetDisplayById(int64_t display_id); | 64 Display* GetDisplayById(int64_t display_id); |
64 | 65 |
(...skipping 14 matching lines...) Expand all Loading... |
79 | 80 |
80 // Called when the AcceleratedWidget is available for |display|. | 81 // Called when the AcceleratedWidget is available for |display|. |
81 void OnDisplayAcceleratedWidgetAvailable(Display* display); | 82 void OnDisplayAcceleratedWidgetAvailable(Display* display); |
82 | 83 |
83 private: | 84 private: |
84 // UserIdTrackerObserver: | 85 // UserIdTrackerObserver: |
85 void OnActiveUserIdChanged(const UserId& previously_active_id, | 86 void OnActiveUserIdChanged(const UserId& previously_active_id, |
86 const UserId& active_id) override; | 87 const UserId& active_id) override; |
87 | 88 |
88 // display::ScreenManagerDelegate: | 89 // display::ScreenManagerDelegate: |
89 void OnDisplayAdded(int64_t id, | 90 void OnDisplayAdded(const display::Display& display, |
90 const display::ViewportMetrics& metrics) override; | 91 const display::ViewportMetrics& metrics) override; |
91 void OnDisplayRemoved(int64_t id) override; | 92 void OnDisplayRemoved(int64_t id) override; |
92 void OnDisplayModified(int64_t id, | 93 void OnDisplayModified(const display::Display& display, |
93 const display::ViewportMetrics& metrics) override; | 94 const display::ViewportMetrics& metrics) override; |
94 void OnPrimaryDisplayChanged(int64_t primary_display_id) override; | 95 void OnPrimaryDisplayChanged(int64_t primary_display_id) override; |
95 | 96 |
96 WindowServer* window_server_; | 97 WindowServer* window_server_; |
97 UserIdTracker* user_id_tracker_; | 98 UserIdTracker* user_id_tracker_; |
98 | 99 |
99 // Displays are initially added to |pending_displays_|. When the display is | 100 // Displays are initially added to |pending_displays_|. When the display is |
100 // initialized it is moved to |displays_|. WindowServer owns the Displays. | 101 // initialized it is moved to |displays_|. WindowServer owns the Displays. |
101 std::set<Display*> pending_displays_; | 102 std::set<Display*> pending_displays_; |
102 std::set<Display*> displays_; | 103 std::set<Display*> displays_; |
103 | 104 |
104 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; | 105 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; |
105 | 106 |
106 std::map<UserId, std::unique_ptr<CursorLocationManager>> | 107 std::map<UserId, std::unique_ptr<CursorLocationManager>> |
107 cursor_location_managers_; | 108 cursor_location_managers_; |
108 | 109 |
109 // ID to use for next root node. | 110 // ID to use for next root node. |
110 ClientSpecificId next_root_id_; | 111 ClientSpecificId next_root_id_; |
111 | 112 |
112 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 113 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
113 }; | 114 }; |
114 | 115 |
115 } // namespace ws | 116 } // namespace ws |
116 } // namespace ui | 117 } // namespace ui |
117 | 118 |
118 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ | 119 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ |
OLD | NEW |