Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: components/mus/ws/display_manager.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/display_binding.cc ('k') | components/mus/ws/display_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
6 #define COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
7
8 #include <map>
9 #include <memory>
10 #include <set>
11
12 #include "base/macros.h"
13 #include "components/mus/ws/ids.h"
14 #include "components/mus/ws/user_id.h"
15 #include "components/mus/ws/user_id_tracker_observer.h"
16
17 namespace mus {
18 namespace ws {
19
20 class Display;
21 class DisplayManagerDelegate;
22 class ServerWindow;
23 class UserDisplayManager;
24 class UserIdTracker;
25 class WindowManagerDisplayRoot;
26
27 // DisplayManager manages the set of Displays. DisplayManager distinguishes
28 // between displays that do yet have an accelerated widget (pending), vs
29 // those that do.
30 class DisplayManager : public UserIdTrackerObserver {
31 public:
32 DisplayManager(DisplayManagerDelegate* delegate,
33 UserIdTracker* user_id_tracker);
34 ~DisplayManager() override;
35
36 // Returns the UserDisplayManager for |user_id|. DisplayManager owns the
37 // return value.
38 UserDisplayManager* GetUserDisplayManager(const UserId& user_id);
39
40 // Adds/removes a Display. DisplayManager owns the Displays.
41 // TODO(sky): make add take a scoped_ptr.
42 void AddDisplay(Display* display);
43 void DestroyDisplay(Display* display);
44 void DestroyAllDisplays();
45 const std::set<Display*>& displays() { return displays_; }
46 std::set<const Display*> displays() const;
47
48 // Notifies when something about the Display changes.
49 void OnDisplayUpdate(Display* display);
50
51 // Returns the Display that contains |window|, or null if |window| is not
52 // attached to a display.
53 Display* GetDisplayContaining(ServerWindow* window);
54 const Display* GetDisplayContaining(const ServerWindow* window) const;
55
56 const WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
57 const ServerWindow* window) const;
58 // TODO(sky): constness here is wrong! fix!
59 WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
60 const ServerWindow* window);
61
62 bool has_displays() const { return !displays_.empty(); }
63 bool has_active_or_pending_displays() const {
64 return !displays_.empty() || !pending_displays_.empty();
65 }
66
67 // Returns the id for the next root window (both for the root of a Display
68 // as well as the root of WindowManagers).
69 WindowId GetAndAdvanceNextRootId();
70
71 uint32_t GetAndAdvanceNextDisplayId();
72
73 // Called when the AcceleratedWidget is available for |display|.
74 void OnDisplayAcceleratedWidgetAvailable(Display* display);
75
76 private:
77 // UserIdTrackerObserver:
78 void OnActiveUserIdChanged(const UserId& previously_active_id,
79 const UserId& active_id) override;
80
81 DisplayManagerDelegate* delegate_;
82 UserIdTracker* user_id_tracker_;
83
84 // Displays are initially added to |pending_displays_|. When the display is
85 // initialized it is moved to |displays_|. WindowServer owns the Displays.
86 std::set<Display*> pending_displays_;
87 std::set<Display*> displays_;
88
89 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_;
90
91 // ID to use for next root node.
92 ClientSpecificId next_root_id_;
93
94 uint32_t next_display_id_;
95
96 DISALLOW_COPY_AND_ASSIGN(DisplayManager);
97 };
98
99 } // namespace ws
100 } // namespace mus
101
102 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/display_binding.cc ('k') | components/mus/ws/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698