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

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

Issue 1766943002: Refators display related functionality into own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 9 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.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 <set>
9
10 #include "base/macros.h"
11 #include "components/mus/ws/ids.h"
12
13 namespace mus {
14 namespace ws {
15
16 class Display;
17 class DisplayManagerDelegate;
18 class ServerWindow;
19 class WindowManagerState;
20
21 struct WindowManagerAndDisplay {
22 WindowManagerAndDisplay() : window_manager_state(nullptr), display(nullptr) {}
23
24 WindowManagerState* window_manager_state;
25 Display* display;
26 };
27
28 struct WindowManagerAndDisplayConst {
29 WindowManagerAndDisplayConst()
30 : window_manager_state(nullptr), display(nullptr) {}
31 const WindowManagerState* window_manager_state;
32 const Display* display;
33 };
34
35 class DisplayManager {
36 public:
37 explicit DisplayManager(DisplayManagerDelegate* delegate);
38 ~DisplayManager();
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 // Returns the Display that contains |window|, or null if |window| is not
49 // attached to a display.
50 Display* GetDisplayContaining(ServerWindow* window);
51 const Display* GetDisplayContaining(const ServerWindow* window) const;
52
53 Display* GetActiveDisplay();
54
55 WindowManagerAndDisplayConst GetWindowManagerAndDisplay(
56 const ServerWindow* window) const;
57 WindowManagerAndDisplay GetWindowManagerAndDisplay(
58 const ServerWindow* window);
59
60 bool has_displays() const { return !displays_.empty(); }
61 bool has_active_or_pending_displays() const {
62 return !displays_.empty() || !pending_displays_.empty();
63 }
64
65 // Returns the id for the next root window (both for the root of a Display
66 // as well as the root of WindowManagers).
67 WindowId GetAndAdvanceNextRootId();
68
69 // Called when the AcceleratedWidget is available for |display|.
70 void OnDisplayAcceleratedWidgetAvailable(Display* display);
71
72 private:
73 DisplayManagerDelegate* delegate_;
74
75 // Displays are initially added to |pending_displays_|. When the display is
76 // initialized it is moved to |displays_|. ConnectionManager owns the
77 // Displays.
78 std::set<Display*> pending_displays_;
79 std::set<Display*> displays_;
80
81 // ID to use for next root node.
82 ConnectionSpecificId next_root_id_;
83
84 DISALLOW_COPY_AND_ASSIGN(DisplayManager);
85 };
86
87 } // namespace ws
88 } // namespace mus
89
90 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/display.cc ('k') | components/mus/ws/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698