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

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

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_
6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11 #include <vector>
12
13 #include "base/macros.h"
14 #include "base/observer_list.h"
15 #include "components/mus/public/interfaces/window_manager_factory.mojom.h"
16 #include "components/mus/ws/user_id_tracker_observer.h"
17
18 namespace mus {
19 namespace ws {
20
21 class UserIdTracker;
22 class WindowManagerFactoryRegistryObserver;
23 class WindowManagerFactoryService;
24 class WindowServer;
25
26 namespace test {
27 class WindowManagerFactoryRegistryTestApi;
28 }
29
30 // WindowManagerFactoryRegistry tracks the set of registered
31 // WindowManagerFactoryServices.
32 class WindowManagerFactoryRegistry : public UserIdTrackerObserver {
33 public:
34 WindowManagerFactoryRegistry(WindowServer* window_server,
35 UserIdTracker* tracker);
36 ~WindowManagerFactoryRegistry() override;
37
38 void Register(
39 const UserId& user_id,
40 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request);
41
42 std::vector<WindowManagerFactoryService*> GetServices();
43
44 void AddObserver(WindowManagerFactoryRegistryObserver* observer);
45 void RemoveObserver(WindowManagerFactoryRegistryObserver* observer);
46
47 private:
48 friend class WindowManagerFactoryService;
49 friend class test::WindowManagerFactoryRegistryTestApi;
50
51 void AddServiceImpl(std::unique_ptr<WindowManagerFactoryService> service);
52
53 bool ContainsServiceForUser(const UserId& user_id) const;
54 void OnWindowManagerFactoryConnectionLost(
55 WindowManagerFactoryService* service);
56 void OnWindowManagerFactorySet(WindowManagerFactoryService* service);
57
58 // UserIdTrackerObserver:
59 void OnActiveUserIdChanged(const UserId& previously_active_id,
60 const UserId& active_id) override;
61 void OnUserIdAdded(const UserId& id) override;
62 void OnUserIdRemoved(const UserId& id) override;
63
64 // Set to true the first time a valid factory has been found.
65 bool got_valid_factory_ = false;
66 UserIdTracker* id_tracker_;
67 WindowServer* window_server_;
68
69 std::vector<std::unique_ptr<WindowManagerFactoryService>> services_;
70
71 base::ObserverList<WindowManagerFactoryRegistryObserver> observers_;
72
73 DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryRegistry);
74 };
75
76 } // namespace ws
77 } // namespace mus
78
79 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_client_unittest.cc ('k') | components/mus/ws/window_manager_factory_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698