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

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

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include Created 4 years, 6 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/cursor_unittest.cc ('k') | components/mus/ws/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_MUS_WS_DISPLAY_H_ 5 #ifndef COMPONENTS_MUS_WS_DISPLAY_H_
6 #define COMPONENTS_MUS_WS_DISPLAY_H_ 6 #define COMPONENTS_MUS_WS_DISPLAY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <queue> 12 #include <queue>
13 #include <set> 13 #include <set>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "components/mus/common/types.h" 17 #include "components/mus/common/types.h"
18 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" 18 #include "components/mus/public/interfaces/window_manager_constants.mojom.h"
19 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 19 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
20 #include "components/mus/ws/focus_controller_delegate.h" 20 #include "components/mus/ws/focus_controller_delegate.h"
21 #include "components/mus/ws/focus_controller_observer.h" 21 #include "components/mus/ws/focus_controller_observer.h"
22 #include "components/mus/ws/platform_display.h" 22 #include "components/mus/ws/platform_display.h"
23 #include "components/mus/ws/server_window.h" 23 #include "components/mus/ws/server_window.h"
24 #include "components/mus/ws/server_window_observer.h" 24 #include "components/mus/ws/server_window_observer.h"
25 #include "components/mus/ws/server_window_tracker.h" 25 #include "components/mus/ws/server_window_tracker.h"
26 #include "components/mus/ws/user_id_tracker_observer.h" 26 #include "components/mus/ws/user_id_tracker_observer.h"
27 #include "components/mus/ws/window_manager_factory_registry_observer.h" 27 #include "components/mus/ws/window_manager_window_tree_factory_set_observer.h"
28 28
29 namespace mus { 29 namespace mus {
30 namespace ws { 30 namespace ws {
31 31
32 class DisplayBinding; 32 class DisplayBinding;
33 class DisplayManager; 33 class DisplayManager;
34 class FocusController; 34 class FocusController;
35 struct PlatformDisplayInitParams; 35 struct PlatformDisplayInitParams;
36 class WindowManagerState; 36 class WindowManagerState;
37 class WindowServer; 37 class WindowServer;
(...skipping 11 matching lines...) Expand all
49 // for the display, which comes from the client that created the 49 // for the display, which comes from the client that created the
50 // Display. 50 // Display.
51 // . without a DisplayBinding. In this mode a WindowManager is automatically 51 // . without a DisplayBinding. In this mode a WindowManager is automatically
52 // created per user. 52 // created per user.
53 class Display : public PlatformDisplayDelegate, 53 class Display : public PlatformDisplayDelegate,
54 public mojom::WindowTreeHost, 54 public mojom::WindowTreeHost,
55 public FocusControllerObserver, 55 public FocusControllerObserver,
56 public FocusControllerDelegate, 56 public FocusControllerDelegate,
57 public ServerWindowObserver, 57 public ServerWindowObserver,
58 public UserIdTrackerObserver, 58 public UserIdTrackerObserver,
59 public WindowManagerFactoryRegistryObserver { 59 public WindowManagerWindowTreeFactorySetObserver {
60 public: 60 public:
61 Display(WindowServer* window_server, 61 Display(WindowServer* window_server,
62 const PlatformDisplayInitParams& platform_display_init_params); 62 const PlatformDisplayInitParams& platform_display_init_params);
63 ~Display() override; 63 ~Display() override;
64 64
65 // Initializes state that depends on the existence of a Display. 65 // Initializes state that depends on the existence of a Display.
66 void Init(std::unique_ptr<DisplayBinding> binding); 66 void Init(std::unique_ptr<DisplayBinding> binding);
67 67
68 uint32_t id() const { return id_; } 68 uint32_t id() const { return id_; }
69 69
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 private: 141 private:
142 friend class test::DisplayTestApi; 142 friend class test::DisplayTestApi;
143 143
144 using WindowManagerStateMap = 144 using WindowManagerStateMap =
145 std::map<UserId, std::unique_ptr<WindowManagerState>>; 145 std::map<UserId, std::unique_ptr<WindowManagerState>>;
146 146
147 // Inits the necessary state once the display is ready. 147 // Inits the necessary state once the display is ready.
148 void InitWindowManagersIfNecessary(); 148 void InitWindowManagersIfNecessary();
149 149
150 // Creates the set of WindowManagerStates from the 150 // Creates the set of WindowManagerStates from the
151 // WindowManagerFactoryRegistry. 151 // WindowManagerWindowTreeFactorySet.
152 void CreateWindowManagerStatesFromRegistry(); 152 void CreateWindowManagerStatesFromFactories();
153 153
154 void CreateWindowManagerStateFromService( 154 void CreateWindowManagerStateFromFactory(
155 WindowManagerFactoryService* service); 155 WindowManagerWindowTreeFactory* factory);
156 156
157 // PlatformDisplayDelegate: 157 // PlatformDisplayDelegate:
158 ServerWindow* GetRootWindow() override; 158 ServerWindow* GetRootWindow() override;
159 void OnEvent(const ui::Event& event) override; 159 void OnEvent(const ui::Event& event) override;
160 void OnNativeCaptureLost() override; 160 void OnNativeCaptureLost() override;
161 void OnDisplayClosed() override; 161 void OnDisplayClosed() override;
162 void OnViewportMetricsChanged(const ViewportMetrics& old_metrics, 162 void OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
163 const ViewportMetrics& new_metrics) override; 163 const ViewportMetrics& new_metrics) override;
164 void OnCompositorFrameDrawn() override; 164 void OnCompositorFrameDrawn() override;
165 165
166 // FocusControllerDelegate: 166 // FocusControllerDelegate:
167 bool CanHaveActiveChildren(ServerWindow* window) const override; 167 bool CanHaveActiveChildren(ServerWindow* window) const override;
168 168
169 // FocusControllerObserver: 169 // FocusControllerObserver:
170 void OnActivationChanged(ServerWindow* old_active_window, 170 void OnActivationChanged(ServerWindow* old_active_window,
171 ServerWindow* new_active_window) override; 171 ServerWindow* new_active_window) override;
172 void OnFocusChanged(FocusControllerChangeSource change_source, 172 void OnFocusChanged(FocusControllerChangeSource change_source,
173 ServerWindow* old_focused_window, 173 ServerWindow* old_focused_window,
174 ServerWindow* new_focused_window) override; 174 ServerWindow* new_focused_window) override;
175 175
176 // ServerWindowObserver: 176 // ServerWindowObserver:
177 void OnWindowDestroyed(ServerWindow* window) override; 177 void OnWindowDestroyed(ServerWindow* window) override;
178 178
179 // UserIdTrackerObserver: 179 // UserIdTrackerObserver:
180 void OnActiveUserIdChanged(const UserId& previously_active_id, 180 void OnActiveUserIdChanged(const UserId& previously_active_id,
181 const UserId& active_id) override; 181 const UserId& active_id) override;
182 void OnUserIdAdded(const UserId& id) override; 182 void OnUserIdAdded(const UserId& id) override;
183 void OnUserIdRemoved(const UserId& id) override; 183 void OnUserIdRemoved(const UserId& id) override;
184 184
185 // WindowManagerFactoryRegistryObserver: 185 // WindowManagerWindowTreeFactorySetObserver:
186 void OnWindowManagerFactorySet(WindowManagerFactoryService* service) override; 186 void OnWindowManagerWindowTreeFactoryReady(
187 WindowManagerWindowTreeFactory* factory) override;
187 188
188 const uint32_t id_; 189 const uint32_t id_;
189 std::unique_ptr<DisplayBinding> binding_; 190 std::unique_ptr<DisplayBinding> binding_;
190 // Set once Init() has been called. 191 // Set once Init() has been called.
191 bool init_called_ = false; 192 bool init_called_ = false;
192 WindowServer* const window_server_; 193 WindowServer* const window_server_;
193 std::unique_ptr<ServerWindow> root_; 194 std::unique_ptr<ServerWindow> root_;
194 std::unique_ptr<PlatformDisplay> platform_display_; 195 std::unique_ptr<PlatformDisplay> platform_display_;
195 std::unique_ptr<FocusController> focus_controller_; 196 std::unique_ptr<FocusController> focus_controller_;
196 197
197 // The last cursor set. Used to track whether we need to change the cursor. 198 // The last cursor set. Used to track whether we need to change the cursor.
198 int32_t last_cursor_; 199 int32_t last_cursor_;
199 200
200 ServerWindowTracker activation_parents_; 201 ServerWindowTracker activation_parents_;
201 202
202 // Set of windows with surfaces that need to be destroyed once the frame 203 // Set of windows with surfaces that need to be destroyed once the frame
203 // draws. 204 // draws.
204 std::set<ServerWindow*> windows_needing_frame_destruction_; 205 std::set<ServerWindow*> windows_needing_frame_destruction_;
205 206
206 WindowManagerStateMap window_manager_state_map_; 207 WindowManagerStateMap window_manager_state_map_;
207 208
208 DISALLOW_COPY_AND_ASSIGN(Display); 209 DISALLOW_COPY_AND_ASSIGN(Display);
209 }; 210 };
210 211
211 } // namespace ws 212 } // namespace ws
212 } // namespace mus 213 } // namespace mus
213 214
214 #endif // COMPONENTS_MUS_WS_DISPLAY_H_ 215 #endif // COMPONENTS_MUS_WS_DISPLAY_H_
OLDNEW
« no previous file with comments | « components/mus/ws/cursor_unittest.cc ('k') | components/mus/ws/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698