| 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_SERVICE_H_ | 5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_SERVICE_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_SERVICE_H_ | 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" | 10 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" |
| 11 #include "components/mus/ws/user_id.h" |
| 11 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
| 12 | 13 |
| 13 namespace mus { | 14 namespace mus { |
| 14 namespace ws { | 15 namespace ws { |
| 15 | 16 |
| 16 class ServerWindow; | 17 class ServerWindow; |
| 17 class WindowManagerFactoryRegistry; | 18 class WindowManagerFactoryRegistry; |
| 18 | 19 |
| 20 namespace test { |
| 21 class WindowManagerFactoryRegistryTestApi; |
| 22 } |
| 23 |
| 19 class WindowManagerFactoryService : public mojom::WindowManagerFactoryService { | 24 class WindowManagerFactoryService : public mojom::WindowManagerFactoryService { |
| 20 public: | 25 public: |
| 21 WindowManagerFactoryService( | 26 WindowManagerFactoryService( |
| 22 WindowManagerFactoryRegistry* registry, | 27 WindowManagerFactoryRegistry* registry, |
| 23 uint32_t user_id, | 28 UserId user_id, |
| 24 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request); | 29 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request); |
| 25 ~WindowManagerFactoryService() override; | 30 ~WindowManagerFactoryService() override; |
| 26 | 31 |
| 27 uint32_t user_id() const { return user_id_; } | 32 UserId user_id() const { return user_id_; } |
| 28 | 33 |
| 29 mojom::WindowManagerFactory* window_manager_factory() { | 34 mojom::WindowManagerFactory* window_manager_factory() { |
| 30 return window_manager_factory_.get(); | 35 return window_manager_factory_; |
| 31 } | 36 } |
| 32 | 37 |
| 33 // mojom::WindowManagerFactoryService: | 38 // mojom::WindowManagerFactoryService: |
| 34 void SetWindowManagerFactory(mojom::WindowManagerFactoryPtr factory) override; | 39 void SetWindowManagerFactory(mojom::WindowManagerFactoryPtr factory) override; |
| 35 | 40 |
| 36 private: | 41 private: |
| 42 friend class test::WindowManagerFactoryRegistryTestApi; |
| 43 |
| 44 // Used by tests. |
| 45 WindowManagerFactoryService(WindowManagerFactoryRegistry* registry, |
| 46 UserId user_id); |
| 47 |
| 48 void SetWindowManagerFactoryImpl(mojom::WindowManagerFactory* factory); |
| 37 void OnConnectionLost(); | 49 void OnConnectionLost(); |
| 38 | 50 |
| 39 WindowManagerFactoryRegistry* registry_; | 51 WindowManagerFactoryRegistry* registry_; |
| 40 const uint32_t user_id_; | 52 const UserId user_id_; |
| 41 mojo::Binding<mojom::WindowManagerFactoryService> binding_; | 53 mojo::Binding<mojom::WindowManagerFactoryService> binding_; |
| 42 mojom::WindowManagerFactoryPtr window_manager_factory_; | 54 mojom::WindowManagerFactoryPtr window_manager_factory_ptr_; |
| 55 // Typically the same as |window_manager_factory_ptr_|, but differs for |
| 56 // tests that don't create bindings. |
| 57 mojom::WindowManagerFactory* window_manager_factory_; |
| 43 | 58 |
| 44 DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryService); | 59 DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryService); |
| 45 }; | 60 }; |
| 46 | 61 |
| 47 } // namespace ws | 62 } // namespace ws |
| 48 } // namespace mus | 63 } // namespace mus |
| 49 | 64 |
| 50 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_SERVICE_H_ | 65 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_FACTORY_SERVICE_H_ |
| OLD | NEW |