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

Unified Diff: components/mus/ws/window_manager_factory_registry.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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/ws/user_id_tracker_observer.h ('k') | components/mus/ws/window_manager_factory_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/window_manager_factory_registry.h
diff --git a/components/mus/ws/window_manager_factory_registry.h b/components/mus/ws/window_manager_factory_registry.h
index 519257deee3267f974fb8ba376a93b89c3d00043..0bb721b77444ed0412d3af7d78116d520fa5fc72 100644
--- a/components/mus/ws/window_manager_factory_registry.h
+++ b/components/mus/ws/window_manager_factory_registry.h
@@ -11,38 +11,64 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/observer_list.h"
#include "components/mus/public/interfaces/window_manager_factory.mojom.h"
+#include "components/mus/ws/user_id_tracker_observer.h"
namespace mus {
namespace ws {
class ConnectionManager;
+class UserIdTracker;
+class WindowManagerFactoryRegistryObserver;
class WindowManagerFactoryService;
+namespace test {
+class WindowManagerFactoryRegistryTestApi;
+}
+
// WindowManagerFactoryRegistry tracks the set of registered
// WindowManagerFactoryServices.
-class WindowManagerFactoryRegistry {
+class WindowManagerFactoryRegistry : public UserIdTrackerObserver {
public:
- explicit WindowManagerFactoryRegistry(ConnectionManager* connection_manager);
- ~WindowManagerFactoryRegistry();
+ explicit WindowManagerFactoryRegistry(ConnectionManager* connection_manager,
+ UserIdTracker* tracker);
+ ~WindowManagerFactoryRegistry() override;
void Register(
- uint32_t user_id,
+ UserId user_id,
mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request);
std::vector<WindowManagerFactoryService*> GetServices();
+ void AddObserver(WindowManagerFactoryRegistryObserver* observer);
+ void RemoveObserver(WindowManagerFactoryRegistryObserver* observer);
+
private:
friend class WindowManagerFactoryService;
+ friend class test::WindowManagerFactoryRegistryTestApi;
+
+ void AddServiceImpl(scoped_ptr<WindowManagerFactoryService> service);
+ bool ContainsServiceForUser(UserId user_id) const;
void OnWindowManagerFactoryConnectionLost(
WindowManagerFactoryService* service);
- void OnWindowManagerFactorySet();
+ void OnWindowManagerFactorySet(WindowManagerFactoryService* service);
+ // UserIdTrackerObserver:
+ void OnActiveUserIdChanged(UserId id) override;
+ void OnUserIdAdded(UserId id) override;
+ void OnUserIdRemoved(UserId id) override;
+
+ // Set to true the first time a valid factory has been found.
+ bool got_valid_factory_ = false;
+ UserIdTracker* id_tracker_;
ConnectionManager* connection_manager_;
std::vector<scoped_ptr<WindowManagerFactoryService>> services_;
+ base::ObserverList<WindowManagerFactoryRegistryObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryRegistry);
};
« no previous file with comments | « components/mus/ws/user_id_tracker_observer.h ('k') | components/mus/ws/window_manager_factory_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698