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

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

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