| OLD | NEW |
| 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_FACTORY_REGISTRY_H_ | 5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_ | 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // WindowManagerFactoryRegistry tracks the set of registered | 30 // WindowManagerFactoryRegistry tracks the set of registered |
| 31 // WindowManagerFactoryServices. | 31 // WindowManagerFactoryServices. |
| 32 class WindowManagerFactoryRegistry : public UserIdTrackerObserver { | 32 class WindowManagerFactoryRegistry : public UserIdTrackerObserver { |
| 33 public: | 33 public: |
| 34 explicit WindowManagerFactoryRegistry(ConnectionManager* connection_manager, | 34 explicit WindowManagerFactoryRegistry(ConnectionManager* connection_manager, |
| 35 UserIdTracker* tracker); | 35 UserIdTracker* tracker); |
| 36 ~WindowManagerFactoryRegistry() override; | 36 ~WindowManagerFactoryRegistry() override; |
| 37 | 37 |
| 38 void Register( | 38 void Register( |
| 39 UserId user_id, | 39 const UserId& user_id, |
| 40 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request); | 40 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request); |
| 41 | 41 |
| 42 std::vector<WindowManagerFactoryService*> GetServices(); | 42 std::vector<WindowManagerFactoryService*> GetServices(); |
| 43 | 43 |
| 44 void AddObserver(WindowManagerFactoryRegistryObserver* observer); | 44 void AddObserver(WindowManagerFactoryRegistryObserver* observer); |
| 45 void RemoveObserver(WindowManagerFactoryRegistryObserver* observer); | 45 void RemoveObserver(WindowManagerFactoryRegistryObserver* observer); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend class WindowManagerFactoryService; | 48 friend class WindowManagerFactoryService; |
| 49 friend class test::WindowManagerFactoryRegistryTestApi; | 49 friend class test::WindowManagerFactoryRegistryTestApi; |
| 50 | 50 |
| 51 void AddServiceImpl(scoped_ptr<WindowManagerFactoryService> service); | 51 void AddServiceImpl(scoped_ptr<WindowManagerFactoryService> service); |
| 52 | 52 |
| 53 bool ContainsServiceForUser(UserId user_id) const; | 53 bool ContainsServiceForUser(const UserId& user_id) const; |
| 54 void OnWindowManagerFactoryConnectionLost( | 54 void OnWindowManagerFactoryConnectionLost( |
| 55 WindowManagerFactoryService* service); | 55 WindowManagerFactoryService* service); |
| 56 void OnWindowManagerFactorySet(WindowManagerFactoryService* service); | 56 void OnWindowManagerFactorySet(WindowManagerFactoryService* service); |
| 57 | 57 |
| 58 // UserIdTrackerObserver: | 58 // UserIdTrackerObserver: |
| 59 void OnActiveUserIdChanged(UserId id) override; | 59 void OnActiveUserIdChanged(const UserId& id) override; |
| 60 void OnUserIdAdded(UserId id) override; | 60 void OnUserIdAdded(const UserId& id) override; |
| 61 void OnUserIdRemoved(UserId id) override; | 61 void OnUserIdRemoved(const UserId& id) override; |
| 62 | 62 |
| 63 // Set to true the first time a valid factory has been found. | 63 // Set to true the first time a valid factory has been found. |
| 64 bool got_valid_factory_ = false; | 64 bool got_valid_factory_ = false; |
| 65 UserIdTracker* id_tracker_; | 65 UserIdTracker* id_tracker_; |
| 66 ConnectionManager* connection_manager_; | 66 ConnectionManager* connection_manager_; |
| 67 | 67 |
| 68 std::vector<scoped_ptr<WindowManagerFactoryService>> services_; | 68 std::vector<scoped_ptr<WindowManagerFactoryService>> services_; |
| 69 | 69 |
| 70 base::ObserverList<WindowManagerFactoryRegistryObserver> observers_; | 70 base::ObserverList<WindowManagerFactoryRegistryObserver> observers_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryRegistry); | 72 DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryRegistry); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace ws | 75 } // namespace ws |
| 76 } // namespace mus | 76 } // namespace mus |
| 77 | 77 |
| 78 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_ | 78 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_REGISTRY_H_ |
| OLD | NEW |