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

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

Issue 2089023002: Promotes remaining global window manager state into WindowManagerState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_MANAGER_WINDOW_TREE_FACTORY_SET_H_ 5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_
6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_ 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo jom.h" 15 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo jom.h"
16 #include "components/mus/ws/user_id_tracker_observer.h" 16 #include "components/mus/ws/user_id_tracker_observer.h"
17 17
18 namespace mus { 18 namespace mus {
19 namespace ws { 19 namespace ws {
20 20
21 class GlobalWindowManagerState;
22 class UserIdTracker; 21 class UserIdTracker;
22 class WindowManagerState;
23 class WindowManagerWindowTreeFactory; 23 class WindowManagerWindowTreeFactory;
24 class WindowManagerWindowTreeFactorySetObserver; 24 class WindowManagerWindowTreeFactorySetObserver;
25 class WindowServer; 25 class WindowServer;
26 class WindowTree; 26 class WindowTree;
27 27
28 namespace test { 28 namespace test {
29 class WindowManagerWindowTreeFactorySetTestApi; 29 class WindowManagerWindowTreeFactorySetTestApi;
30 } 30 }
31 31
32 // WindowManagerWindowTreeFactorySet tracks the set of registered 32 // WindowManagerWindowTreeFactorySet tracks the set of registered
33 // WindowManagerWindowTreeHostFactories. 33 // WindowManagerWindowTreeHostFactories.
34 class WindowManagerWindowTreeFactorySet : public UserIdTrackerObserver { 34 class WindowManagerWindowTreeFactorySet : public UserIdTrackerObserver {
35 public: 35 public:
36 WindowManagerWindowTreeFactorySet(WindowServer* window_server, 36 WindowManagerWindowTreeFactorySet(WindowServer* window_server,
37 UserIdTracker* tracker); 37 UserIdTracker* tracker);
38 ~WindowManagerWindowTreeFactorySet() override; 38 ~WindowManagerWindowTreeFactorySet() override;
39 39
40 WindowServer* window_server() { return window_server_; } 40 WindowServer* window_server() { return window_server_; }
41 41
42 // Creates a new WindowManagerWindowTreeFactory for the specified user, 42 // Creates a new WindowManagerWindowTreeFactory for the specified user,
43 // unless one has been set, in which case the call is ignored. The newly 43 // unless one has been set, in which case the call is ignored. The newly
44 // created WindowManagerWindowTreeFactory does not immediately have a 44 // created WindowManagerWindowTreeFactory does not immediately have a
45 // WindowTree associated with it. 45 // WindowTree associated with it.
46 WindowManagerWindowTreeFactory* Add( 46 WindowManagerWindowTreeFactory* Add(
47 const UserId& user_id, 47 const UserId& user_id,
48 mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request); 48 mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request);
49 49
50 // Returns the GlobalWindowManagerState for the specified user, or null if 50 // Returns the WindowManagerState for the specified user, or null if
51 // not yet set. 51 // not yet set.
52 GlobalWindowManagerState* GetGlobalWindowManagerStateForUser( 52 WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id);
53 const UserId& user_id);
54 53
55 // Deletes the WindowManagerWindowTreeFactory associated with |tree|. Does 54 // Deletes the WindowManagerWindowTreeFactory associated with |tree|. Does
56 // nothing if there is no WindowManagerWindowTreeFactory associated with 55 // nothing if there is no WindowManagerWindowTreeFactory associated with
57 // |tree|. 56 // |tree|.
58 void DeleteFactoryAssociatedWithTree(WindowTree* tree); 57 void DeleteFactoryAssociatedWithTree(WindowTree* tree);
59 58
60 // Returns all the factories, even those that may not have a WindowTree 59 // Returns all the factories, even those that may not have a WindowTree
61 // associated with them. 60 // associated with them.
62 std::vector<WindowManagerWindowTreeFactory*> GetFactories(); 61 std::vector<WindowManagerWindowTreeFactory*> GetFactories();
63 62
64 void AddObserver(WindowManagerWindowTreeFactorySetObserver* observer); 63 void AddObserver(WindowManagerWindowTreeFactorySetObserver* observer);
65 void RemoveObserver(WindowManagerWindowTreeFactorySetObserver* observer); 64 void RemoveObserver(WindowManagerWindowTreeFactorySetObserver* observer);
66 65
67 private: 66 private:
68 friend class WindowManagerWindowTreeFactory; 67 friend class WindowManagerWindowTreeFactory;
69 friend class test::WindowManagerWindowTreeFactorySetTestApi; 68 friend class test::WindowManagerWindowTreeFactorySetTestApi;
70 69
71 // Called by WindowManagerWindowTreeFactory when CreateWindowTree() has 70 // Called by WindowManagerWindowTreeFactory when CreateWindowTree() has
72 // been called. 71 // been called.
73 void OnWindowManagerWindowTreeFactoryReady( 72 void OnWindowManagerWindowTreeFactoryReady(
74 WindowManagerWindowTreeFactory* factory); 73 WindowManagerWindowTreeFactory* factory);
75 74
76 // UserIdTrackerObserver: 75 // UserIdTrackerObserver:
77 void OnActiveUserIdChanged(const UserId& previously_active_id,
78 const UserId& active_id) override;
79 void OnUserIdAdded(const UserId& id) override;
80 void OnUserIdRemoved(const UserId& id) override; 76 void OnUserIdRemoved(const UserId& id) override;
81 77
82 // Set to true the first time a valid factory has been found. 78 // Set to true the first time a valid factory has been found.
83 bool got_valid_factory_ = false; 79 bool got_valid_factory_ = false;
84 UserIdTracker* id_tracker_; 80 UserIdTracker* id_tracker_;
85 WindowServer* window_server_; 81 WindowServer* window_server_;
86 82
87 std::map<UserId, std::unique_ptr<WindowManagerWindowTreeFactory>> factories_; 83 std::map<UserId, std::unique_ptr<WindowManagerWindowTreeFactory>> factories_;
88 84
89 base::ObserverList<WindowManagerWindowTreeFactorySetObserver> observers_; 85 base::ObserverList<WindowManagerWindowTreeFactorySetObserver> observers_;
90 86
91 DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactorySet); 87 DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactorySet);
92 }; 88 };
93 89
94 } // namespace ws 90 } // namespace ws
95 } // namespace mus 91 } // namespace mus
96 92
97 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_ 93 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_window_tree_factory.cc ('k') | components/mus/ws/window_manager_window_tree_factory_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698