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