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

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

Issue 1615023004: Start of display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash and add back getting constants Created 4 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CONNECTION_MANAGER_H_ 5 #ifndef COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
6 #define COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_ 6 #define COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "components/mus/public/interfaces/display.mojom.h"
17 #include "components/mus/public/interfaces/window_tree.mojom.h" 18 #include "components/mus/public/interfaces/window_tree.mojom.h"
18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 19 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
19 #include "components/mus/surfaces/surfaces_state.h" 20 #include "components/mus/surfaces/surfaces_state.h"
20 #include "components/mus/ws/ids.h" 21 #include "components/mus/ws/ids.h"
21 #include "components/mus/ws/operation.h" 22 #include "components/mus/ws/operation.h"
22 #include "components/mus/ws/server_window_delegate.h" 23 #include "components/mus/ws/server_window_delegate.h"
23 #include "components/mus/ws/server_window_observer.h" 24 #include "components/mus/ws/server_window_observer.h"
24 #include "components/mus/ws/window_tree_host_impl.h" 25 #include "components/mus/ws/window_tree_host_impl.h"
26 #include "mojo/common/weak_binding_set.h"
27 #include "mojo/common/weak_interface_ptr_set.h"
25 #include "mojo/converters/surfaces/custom_surface_converter.h" 28 #include "mojo/converters/surfaces/custom_surface_converter.h"
26 #include "mojo/public/cpp/bindings/array.h" 29 #include "mojo/public/cpp/bindings/array.h"
27 #include "mojo/public/cpp/bindings/binding.h" 30 #include "mojo/public/cpp/bindings/binding.h"
28 31
29 namespace mus { 32 namespace mus {
30 namespace ws { 33 namespace ws {
31 34
32 class ClientConnection; 35 class ClientConnection;
33 class ConnectionManagerDelegate; 36 class ConnectionManagerDelegate;
34 class ServerWindow; 37 class ServerWindow;
35 class WindowTreeHostConnection; 38 class WindowTreeHostConnection;
36 class WindowTreeImpl; 39 class WindowTreeImpl;
37 40
38 // ConnectionManager manages the set of connections to the window server (all 41 // ConnectionManager manages the set of connections to the window server (all
39 // the WindowTreeImpls) as well as providing the root of the hierarchy. 42 // the WindowTreeImpls) as well as providing the root of the hierarchy.
43 //
44 // TODO(sky): this class is doing too much. Refactor to make responsibilities
45 // clearer.
40 class ConnectionManager : public ServerWindowDelegate, 46 class ConnectionManager : public ServerWindowDelegate,
41 public ServerWindowObserver { 47 public ServerWindowObserver,
48 public mojom::DisplayManager {
42 public: 49 public:
43 ConnectionManager(ConnectionManagerDelegate* delegate, 50 ConnectionManager(ConnectionManagerDelegate* delegate,
44 const scoped_refptr<mus::SurfacesState>& surfaces_state); 51 const scoped_refptr<mus::SurfacesState>& surfaces_state);
45 ~ConnectionManager() override; 52 ~ConnectionManager() override;
46 53
47 // Adds a WindowTreeHost. 54 // Adds a WindowTreeHost.
48 void AddHost(WindowTreeHostConnection* connection); 55 void AddHost(WindowTreeHostConnection* connection);
49 56
50 // Creates a new ServerWindow. The return value is owned by the caller, but 57 // Creates a new ServerWindow. The return value is owned by the caller, but
51 // must be destroyed before ConnectionManager. 58 // must be destroyed before ConnectionManager.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 WindowTreeHostImpl* GetWindowTreeHostByWindow(const ServerWindow* window); 125 WindowTreeHostImpl* GetWindowTreeHostByWindow(const ServerWindow* window);
119 const WindowTreeHostImpl* GetWindowTreeHostByWindow( 126 const WindowTreeHostImpl* GetWindowTreeHostByWindow(
120 const ServerWindow* window) const; 127 const ServerWindow* window) const;
121 128
122 WindowTreeHostImpl* GetActiveWindowTreeHost(); 129 WindowTreeHostImpl* GetActiveWindowTreeHost();
123 130
124 bool has_tree_host_connections() const { 131 bool has_tree_host_connections() const {
125 return !host_connection_map_.empty(); 132 return !host_connection_map_.empty();
126 } 133 }
127 134
135 void AddDisplayManagerBinding(
136 mojo::InterfaceRequest<mojom::DisplayManager> request);
137
128 // Returns a change id for the window manager that is associated with 138 // Returns a change id for the window manager that is associated with
129 // |source| and |client_change_id|. When the window manager replies 139 // |source| and |client_change_id|. When the window manager replies
130 // WindowManagerChangeCompleted() is called to obtain the original source 140 // WindowManagerChangeCompleted() is called to obtain the original source
131 // and client supplied change_id that initiated the called. 141 // and client supplied change_id that initiated the called.
132 uint32_t GenerateWindowManagerChangeId(WindowTreeImpl* source, 142 uint32_t GenerateWindowManagerChangeId(WindowTreeImpl* source,
133 uint32_t client_change_id); 143 uint32_t client_change_id);
134 144
135 // Called when a response from the window manager is obtained. Calls to 145 // Called when a response from the window manager is obtained. Calls to
136 // the client that initiated the change with the change id originally 146 // the client that initiated the change with the change id originally
137 // supplied by the client. 147 // supplied by the client.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 const std::vector<uint8_t>* new_data) override; 257 const std::vector<uint8_t>* new_data) override;
248 void OnWindowPredefinedCursorChanged(ServerWindow* window, 258 void OnWindowPredefinedCursorChanged(ServerWindow* window,
249 int32_t cursor_id) override; 259 int32_t cursor_id) override;
250 void OnWindowTextInputStateChanged(ServerWindow* window, 260 void OnWindowTextInputStateChanged(ServerWindow* window,
251 const ui::TextInputState& state) override; 261 const ui::TextInputState& state) override;
252 void OnTransientWindowAdded(ServerWindow* window, 262 void OnTransientWindowAdded(ServerWindow* window,
253 ServerWindow* transient_child) override; 263 ServerWindow* transient_child) override;
254 void OnTransientWindowRemoved(ServerWindow* window, 264 void OnTransientWindowRemoved(ServerWindow* window,
255 ServerWindow* transient_child) override; 265 ServerWindow* transient_child) override;
256 266
267 // Overriden from mojom::DisplayManager:
268 void AddObserver(mojom::DisplayManagerObserverPtr observer) override;
269
257 ConnectionManagerDelegate* delegate_; 270 ConnectionManagerDelegate* delegate_;
258 271
259 // State for rendering into a Surface. 272 // State for rendering into a Surface.
260 scoped_refptr<mus::SurfacesState> surfaces_state_; 273 scoped_refptr<mus::SurfacesState> surfaces_state_;
261 274
262 // ID to use for next WindowTreeImpl. 275 // ID to use for next WindowTreeImpl.
263 ConnectionSpecificId next_connection_id_; 276 ConnectionSpecificId next_connection_id_;
264 277
265 // ID to use for next WindowTreeHostImpl. 278 // ID to use for next WindowTreeHostImpl.
266 uint16_t next_host_id_; 279 uint16_t next_host_id_;
(...skipping 10 matching lines...) Expand all
277 290
278 bool in_destructor_; 291 bool in_destructor_;
279 292
280 // Maps from window manager change id to the client that initiated the 293 // Maps from window manager change id to the client that initiated the
281 // request. 294 // request.
282 InFlightWindowManagerChangeMap in_flight_wm_change_map_; 295 InFlightWindowManagerChangeMap in_flight_wm_change_map_;
283 296
284 // Next id supplied to the window manager. 297 // Next id supplied to the window manager.
285 uint32_t next_wm_change_id_; 298 uint32_t next_wm_change_id_;
286 299
300 mojo::WeakBindingSet<mojom::DisplayManager> display_manager_bindings_;
301 mojo::WeakInterfacePtrSet<mojom::DisplayManagerObserver>
302 display_manager_observers_;
303
287 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); 304 DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
288 }; 305 };
289 306
290 } // namespace ws 307 } // namespace ws
291 } // namespace mus 308 } // namespace mus
292 309
293 #endif // COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_ 310 #endif // COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « components/mus/public/interfaces/window_manager_constants.mojom ('k') | components/mus/ws/connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698