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

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

Issue 1757403002: More user id tracking for mus: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks 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/access_policy.h ('k') | components/mus/ws/connection_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
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/display.mojom.h"
18 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" 18 #include "components/mus/public/interfaces/window_manager_factory.mojom.h"
19 #include "components/mus/public/interfaces/window_tree.mojom.h" 19 #include "components/mus/public/interfaces/window_tree.mojom.h"
20 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 20 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
21 #include "components/mus/surfaces/surfaces_state.h" 21 #include "components/mus/surfaces/surfaces_state.h"
22 #include "components/mus/ws/ids.h" 22 #include "components/mus/ws/ids.h"
23 #include "components/mus/ws/operation.h" 23 #include "components/mus/ws/operation.h"
24 #include "components/mus/ws/server_window_delegate.h" 24 #include "components/mus/ws/server_window_delegate.h"
25 #include "components/mus/ws/server_window_observer.h" 25 #include "components/mus/ws/server_window_observer.h"
26 #include "components/mus/ws/user_id_tracker.h"
26 #include "components/mus/ws/window_manager_factory_registry.h" 27 #include "components/mus/ws/window_manager_factory_registry.h"
27 #include "components/mus/ws/window_tree_host_impl.h" 28 #include "components/mus/ws/window_tree_host_impl.h"
28 #include "mojo/converters/surfaces/custom_surface_converter.h" 29 #include "mojo/converters/surfaces/custom_surface_converter.h"
29 #include "mojo/public/cpp/bindings/array.h" 30 #include "mojo/public/cpp/bindings/array.h"
30 #include "mojo/public/cpp/bindings/binding.h" 31 #include "mojo/public/cpp/bindings/binding.h"
31 #include "mojo/public/cpp/bindings/binding_set.h" 32 #include "mojo/public/cpp/bindings/binding_set.h"
32 #include "mojo/public/cpp/bindings/interface_ptr_set.h" 33 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
33 34
34 namespace mus { 35 namespace mus {
35 namespace ws { 36 namespace ws {
(...skipping 28 matching lines...) Expand all
64 class ConnectionManager : public ServerWindowDelegate, 65 class ConnectionManager : public ServerWindowDelegate,
65 public ServerWindowObserver, 66 public ServerWindowObserver,
66 public mojom::DisplayManager { 67 public mojom::DisplayManager {
67 public: 68 public:
68 ConnectionManager(ConnectionManagerDelegate* delegate, 69 ConnectionManager(ConnectionManagerDelegate* delegate,
69 const scoped_refptr<mus::SurfacesState>& surfaces_state); 70 const scoped_refptr<mus::SurfacesState>& surfaces_state);
70 ~ConnectionManager() override; 71 ~ConnectionManager() override;
71 72
72 ConnectionManagerDelegate* delegate() { return delegate_; } 73 ConnectionManagerDelegate* delegate() { return delegate_; }
73 74
75 UserIdTracker* user_id_tracker() { return &user_id_tracker_; }
76
74 // Adds/removes a WindowTreeHost. ConnectionManager owns the 77 // Adds/removes a WindowTreeHost. ConnectionManager owns the
75 // WindowTreeHostImpls. 78 // WindowTreeHostImpls.
76 void AddHost(WindowTreeHostImpl* host); 79 void AddHost(WindowTreeHostImpl* host);
77 void DestroyHost(WindowTreeHostImpl* host); 80 void DestroyHost(WindowTreeHostImpl* host);
81 std::set<WindowTreeHostImpl*> hosts() { return hosts_; }
78 82
79 // Creates a new ServerWindow. The return value is owned by the caller, but 83 // Creates a new ServerWindow. The return value is owned by the caller, but
80 // must be destroyed before ConnectionManager. 84 // must be destroyed before ConnectionManager.
81 ServerWindow* CreateServerWindow( 85 ServerWindow* CreateServerWindow(
82 const WindowId& id, 86 const WindowId& id,
83 const std::map<std::string, std::vector<uint8_t>>& properties); 87 const std::map<std::string, std::vector<uint8_t>>& properties);
84 88
85 // Returns the id for the next WindowTreeImpl. 89 // Returns the id for the next WindowTreeImpl.
86 ConnectionSpecificId GetAndAdvanceNextConnectionId(); 90 ConnectionSpecificId GetAndAdvanceNextConnectionId();
87 91
(...skipping 14 matching lines...) Expand all
102 WindowTreeImpl* CreateTreeForWindowManager( 106 WindowTreeImpl* CreateTreeForWindowManager(
103 WindowTreeHostImpl* host, 107 WindowTreeHostImpl* host,
104 mojom::WindowManagerFactory* factory, 108 mojom::WindowManagerFactory* factory,
105 ServerWindow* root); 109 ServerWindow* root);
106 // Invoked when a WindowTreeImpl's connection encounters an error. 110 // Invoked when a WindowTreeImpl's connection encounters an error.
107 void DestroyTree(WindowTreeImpl* tree); 111 void DestroyTree(WindowTreeImpl* tree);
108 112
109 // Returns the connection by id. 113 // Returns the connection by id.
110 WindowTreeImpl* GetConnection(ConnectionSpecificId connection_id); 114 WindowTreeImpl* GetConnection(ConnectionSpecificId connection_id);
111 115
116 size_t num_trees() const { return tree_map_.size(); }
117
112 // Returns the Window identified by |id|. 118 // Returns the Window identified by |id|.
113 ServerWindow* GetWindow(const WindowId& id); 119 ServerWindow* GetWindow(const WindowId& id);
114 120
115 // Schedules a paint for the specified region in the coordinates of |window|. 121 // Schedules a paint for the specified region in the coordinates of |window|.
116 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds); 122 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds);
117 123
118 OperationType current_operation_type() const { 124 OperationType current_operation_type() const {
119 return current_operation_ ? current_operation_->type() 125 return current_operation_ ? current_operation_->type()
120 : OperationType::NONE; 126 : OperationType::NONE;
121 } 127 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 const ServerWindow* window) const; 160 const ServerWindow* window) const;
155 WindowManagerAndHost GetWindowManagerAndHost(const ServerWindow* window); 161 WindowManagerAndHost GetWindowManagerAndHost(const ServerWindow* window);
156 162
157 WindowTreeHostImpl* GetActiveWindowTreeHost(); 163 WindowTreeHostImpl* GetActiveWindowTreeHost();
158 164
159 bool has_tree_host_connections() const { return !hosts_.empty(); } 165 bool has_tree_host_connections() const { return !hosts_.empty(); }
160 166
161 void AddDisplayManagerBinding( 167 void AddDisplayManagerBinding(
162 mojo::InterfaceRequest<mojom::DisplayManager> request); 168 mojo::InterfaceRequest<mojom::DisplayManager> request);
163 169
164 void CreateWindowManagerFactoryService( 170 void OnFirstWindowManagerFactorySet();
165 const uint32_t user_id,
166 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request);
167 void OnWindowManagerFactorySet();
168 171
169 WindowManagerFactoryRegistry* window_manager_factory_registry() { 172 WindowManagerFactoryRegistry* window_manager_factory_registry() {
170 return &window_manager_factory_registry_; 173 return &window_manager_factory_registry_;
171 } 174 }
172 175
173 // Returns a change id for the window manager that is associated with 176 // Returns a change id for the window manager that is associated with
174 // |source| and |client_change_id|. When the window manager replies 177 // |source| and |client_change_id|. When the window manager replies
175 // WindowManagerChangeCompleted() is called to obtain the original source 178 // WindowManagerChangeCompleted() is called to obtain the original source
176 // and client supplied change_id that initiated the called. 179 // and client supplied change_id that initiated the called.
177 uint32_t GenerateWindowManagerChangeId(WindowTreeImpl* source, 180 uint32_t GenerateWindowManagerChangeId(WindowTreeImpl* source,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 void OnWindowTextInputStateChanged(ServerWindow* window, 311 void OnWindowTextInputStateChanged(ServerWindow* window,
309 const ui::TextInputState& state) override; 312 const ui::TextInputState& state) override;
310 void OnTransientWindowAdded(ServerWindow* window, 313 void OnTransientWindowAdded(ServerWindow* window,
311 ServerWindow* transient_child) override; 314 ServerWindow* transient_child) override;
312 void OnTransientWindowRemoved(ServerWindow* window, 315 void OnTransientWindowRemoved(ServerWindow* window,
313 ServerWindow* transient_child) override; 316 ServerWindow* transient_child) override;
314 317
315 // Overriden from mojom::DisplayManager: 318 // Overriden from mojom::DisplayManager:
316 void AddObserver(mojom::DisplayManagerObserverPtr observer) override; 319 void AddObserver(mojom::DisplayManagerObserverPtr observer) override;
317 320
321 UserIdTracker user_id_tracker_;
322
318 ConnectionManagerDelegate* delegate_; 323 ConnectionManagerDelegate* delegate_;
319 324
320 // State for rendering into a Surface. 325 // State for rendering into a Surface.
321 scoped_refptr<mus::SurfacesState> surfaces_state_; 326 scoped_refptr<mus::SurfacesState> surfaces_state_;
322 327
323 // ID to use for next WindowTreeImpl. 328 // ID to use for next WindowTreeImpl.
324 ConnectionSpecificId next_connection_id_; 329 ConnectionSpecificId next_connection_id_;
325 330
326 // ID to use for next WindowTreeHostImpl. 331 // ID to use for next WindowTreeHostImpl.
327 uint16_t next_host_id_; 332 uint16_t next_host_id_;
(...skipping 30 matching lines...) Expand all
358 363
359 WindowManagerFactoryRegistry window_manager_factory_registry_; 364 WindowManagerFactoryRegistry window_manager_factory_registry_;
360 365
361 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); 366 DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
362 }; 367 };
363 368
364 } // namespace ws 369 } // namespace ws
365 } // namespace mus 370 } // namespace mus
366 371
367 #endif // COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_ 372 #endif // COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/access_policy.h ('k') | components/mus/ws/connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698