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

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

Issue 2094933003: mus: Add UserActivityMonitor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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/user_activity_monitor_unittest.cc ('k') | components/mus/ws/window_server.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_WINDOW_SERVER_H_ 5 #ifndef COMPONENTS_MUS_WS_WINDOW_SERVER_H_
6 #define COMPONENTS_MUS_WS_WINDOW_SERVER_H_ 6 #define COMPONENTS_MUS_WS_WINDOW_SERVER_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 <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo jom.h" 16 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo jom.h"
17 #include "components/mus/public/interfaces/window_tree.mojom.h" 17 #include "components/mus/public/interfaces/window_tree.mojom.h"
18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
19 #include "components/mus/surfaces/surfaces_state.h" 19 #include "components/mus/surfaces/surfaces_state.h"
20 #include "components/mus/ws/display.h" 20 #include "components/mus/ws/display.h"
21 #include "components/mus/ws/display_manager_delegate.h" 21 #include "components/mus/ws/display_manager_delegate.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/user_id_tracker.h"
27 #include "components/mus/ws/user_id_tracker_observer.h"
27 #include "components/mus/ws/window_manager_window_tree_factory_set.h" 28 #include "components/mus/ws/window_manager_window_tree_factory_set.h"
28 #include "mojo/public/cpp/bindings/array.h" 29 #include "mojo/public/cpp/bindings/array.h"
29 #include "mojo/public/cpp/bindings/binding.h" 30 #include "mojo/public/cpp/bindings/binding.h"
30 31
31 namespace mus { 32 namespace mus {
32 namespace ws { 33 namespace ws {
33 34
34 class AccessPolicy; 35 class AccessPolicy;
35 class DisplayManager; 36 class DisplayManager;
36 class ServerWindow; 37 class ServerWindow;
38 class UserActivityMonitor;
37 class WindowManagerState; 39 class WindowManagerState;
38 class WindowServerDelegate; 40 class WindowServerDelegate;
39 class WindowTree; 41 class WindowTree;
40 class WindowTreeBinding; 42 class WindowTreeBinding;
41 43
42 // WindowServer manages the set of clients of the window server (all the 44 // WindowServer manages the set of clients of the window server (all the
43 // WindowTrees) as well as providing the root of the hierarchy. 45 // WindowTrees) as well as providing the root of the hierarchy.
44 class WindowServer : public ServerWindowDelegate, 46 class WindowServer : public ServerWindowDelegate,
45 public ServerWindowObserver, 47 public ServerWindowObserver,
46 public DisplayManagerDelegate { 48 public DisplayManagerDelegate,
49 public UserIdTrackerObserver {
47 public: 50 public:
48 WindowServer(WindowServerDelegate* delegate, 51 WindowServer(WindowServerDelegate* delegate,
49 const scoped_refptr<mus::SurfacesState>& surfaces_state); 52 const scoped_refptr<mus::SurfacesState>& surfaces_state);
50 ~WindowServer() override; 53 ~WindowServer() override;
51 54
52 WindowServerDelegate* delegate() { return delegate_; } 55 WindowServerDelegate* delegate() { return delegate_; }
53 56
54 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } 57 UserIdTracker* user_id_tracker() { return &user_id_tracker_; }
55 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; } 58 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; }
56 59
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 124
122 // Returns the WindowTree that has |id| as a root. 125 // Returns the WindowTree that has |id| as a root.
123 WindowTree* GetTreeWithRoot(const ServerWindow* window) { 126 WindowTree* GetTreeWithRoot(const ServerWindow* window) {
124 return const_cast<WindowTree*>( 127 return const_cast<WindowTree*>(
125 const_cast<const WindowServer*>(this)->GetTreeWithRoot(window)); 128 const_cast<const WindowServer*>(this)->GetTreeWithRoot(window));
126 } 129 }
127 const WindowTree* GetTreeWithRoot(const ServerWindow* window) const; 130 const WindowTree* GetTreeWithRoot(const ServerWindow* window) const;
128 131
129 void OnFirstWindowManagerWindowTreeFactoryReady(); 132 void OnFirstWindowManagerWindowTreeFactoryReady();
130 133
134 UserActivityMonitor* GetUserActivityMonitorForUser(const UserId& user_id);
135
131 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set() { 136 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set() {
132 return &window_manager_window_tree_factory_set_; 137 return &window_manager_window_tree_factory_set_;
133 } 138 }
134 139
135 // Sets focus to |window|. Returns true if |window| already has focus, or 140 // Sets focus to |window|. Returns true if |window| already has focus, or
136 // focus was successfully changed. Returns |false| if |window| is not a valid 141 // focus was successfully changed. Returns |false| if |window| is not a valid
137 // window to receive focus. 142 // window to receive focus.
138 bool SetFocusedWindow(ServerWindow* window); 143 bool SetFocusedWindow(ServerWindow* window);
139 ServerWindow* GetFocusedWindow(); 144 ServerWindow* GetFocusedWindow();
140 145
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 194
190 // Sets a callback to be called whenever a ServerWindow is scheduled for 195 // Sets a callback to be called whenever a ServerWindow is scheduled for
191 // a [re]paint. This should only be called in a test configuration. 196 // a [re]paint. This should only be called in a test configuration.
192 void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback); 197 void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback);
193 198
194 private: 199 private:
195 friend class Operation; 200 friend class Operation;
196 201
197 using WindowTreeMap = 202 using WindowTreeMap =
198 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>; 203 std::map<ClientSpecificId, std::unique_ptr<WindowTree>>;
204 using UserActivityMonitorMap =
205 std::map<UserId, std::unique_ptr<UserActivityMonitor>>;
199 206
200 struct InFlightWindowManagerChange { 207 struct InFlightWindowManagerChange {
201 // Identifies the client that initiated the change. 208 // Identifies the client that initiated the change.
202 ClientSpecificId client_id; 209 ClientSpecificId client_id;
203 210
204 // Change id supplied by the client. 211 // Change id supplied by the client.
205 uint32_t client_change_id; 212 uint32_t client_change_id;
206 }; 213 };
207 214
208 using InFlightWindowManagerChangeMap = 215 using InFlightWindowManagerChangeMap =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 286
280 // DisplayManagerDelegate: 287 // DisplayManagerDelegate:
281 void OnFirstDisplayReady() override; 288 void OnFirstDisplayReady() override;
282 void OnNoMoreDisplays() override; 289 void OnNoMoreDisplays() override;
283 bool GetFrameDecorationsForUser( 290 bool GetFrameDecorationsForUser(
284 const UserId& user_id, 291 const UserId& user_id,
285 mojom::FrameDecorationValuesPtr* values) override; 292 mojom::FrameDecorationValuesPtr* values) override;
286 WindowManagerState* GetWindowManagerStateForUser( 293 WindowManagerState* GetWindowManagerStateForUser(
287 const UserId& user_id) override; 294 const UserId& user_id) override;
288 295
296 // UserIdTrackerObserver:
297 void OnActiveUserIdChanged(const UserId& previously_active_id,
298 const UserId& active_id) override;
299 void OnUserIdAdded(const UserId& id) override;
300 void OnUserIdRemoved(const UserId& id) override;
301
289 UserIdTracker user_id_tracker_; 302 UserIdTracker user_id_tracker_;
290 303
291 WindowServerDelegate* delegate_; 304 WindowServerDelegate* delegate_;
292 305
293 // State for rendering into a Surface. 306 // State for rendering into a Surface.
294 scoped_refptr<mus::SurfacesState> surfaces_state_; 307 scoped_refptr<mus::SurfacesState> surfaces_state_;
295 308
296 // ID to use for next WindowTree. 309 // ID to use for next WindowTree.
297 ClientSpecificId next_client_id_; 310 ClientSpecificId next_client_id_;
298 311
(...skipping 10 matching lines...) Expand all
309 322
310 // Maps from window manager change id to the client that initiated the 323 // Maps from window manager change id to the client that initiated the
311 // request. 324 // request.
312 InFlightWindowManagerChangeMap in_flight_wm_change_map_; 325 InFlightWindowManagerChangeMap in_flight_wm_change_map_;
313 326
314 // Next id supplied to the window manager. 327 // Next id supplied to the window manager.
315 uint32_t next_wm_change_id_; 328 uint32_t next_wm_change_id_;
316 329
317 base::Callback<void(ServerWindow*)> window_paint_callback_; 330 base::Callback<void(ServerWindow*)> window_paint_callback_;
318 331
332 UserActivityMonitorMap activity_monitor_map_;
333
319 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_; 334 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_;
320 335
321 DISALLOW_COPY_AND_ASSIGN(WindowServer); 336 DISALLOW_COPY_AND_ASSIGN(WindowServer);
322 }; 337 };
323 338
324 } // namespace ws 339 } // namespace ws
325 } // namespace mus 340 } // namespace mus
326 341
327 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_ 342 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/user_activity_monitor_unittest.cc ('k') | components/mus/ws/window_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698