OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 5 #ifndef ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 | 12 |
| 13 #include "ash/public/interfaces/shelf.mojom.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "mash/session/public/interfaces/session.mojom.h" | 15 #include "mash/session/public/interfaces/session.mojom.h" |
15 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
16 #include "mojo/public/cpp/bindings/binding_set.h" | 17 #include "mojo/public/cpp/bindings/binding_set.h" |
17 #include "services/shell/public/cpp/service.h" | 18 #include "services/shell/public/cpp/service.h" |
18 #include "services/tracing/public/cpp/provider.h" | 19 #include "services/tracing/public/cpp/provider.h" |
19 #include "services/ui/common/types.h" | 20 #include "services/ui/common/types.h" |
20 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h" | 21 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h" |
21 | 22 |
22 namespace views { | 23 namespace views { |
23 class AuraInit; | 24 class AuraInit; |
24 class SurfaceContextFactory; | 25 class SurfaceContextFactory; |
25 } | 26 } |
26 | 27 |
27 namespace ui { | 28 namespace ui { |
28 class Event; | 29 class Event; |
29 class GpuService; | 30 class GpuService; |
30 class WindowTreeClient; | 31 class WindowTreeClient; |
31 } | 32 } |
32 | 33 |
33 namespace ash { | 34 namespace ash { |
34 namespace mus { | 35 namespace mus { |
35 | 36 |
36 class AcceleratorRegistrarImpl; | 37 class AcceleratorRegistrarImpl; |
37 class WindowManager; | 38 class WindowManager; |
38 | 39 |
39 // Hosts the window manager and the ash system user interface for mash. | 40 // Hosts the window manager and the ash system user interface for mash. |
40 // TODO(mash): Port ash_sysui's ShelfController and WallpaperController here. | 41 // TODO(mash): Port ash_sysui's WallpaperController here. |
41 class WindowManagerApplication | 42 class WindowManagerApplication |
42 : public shell::Service, | 43 : public shell::Service, |
| 44 public shell::InterfaceFactory<ash::mojom::ShelfController>, |
43 public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>, | 45 public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>, |
44 public mash::session::mojom::ScreenlockStateListener { | 46 public mash::session::mojom::ScreenlockStateListener { |
45 public: | 47 public: |
46 WindowManagerApplication(); | 48 WindowManagerApplication(); |
47 ~WindowManagerApplication() override; | 49 ~WindowManagerApplication() override; |
48 | 50 |
49 WindowManager* window_manager() { return window_manager_.get(); } | 51 WindowManager* window_manager() { return window_manager_.get(); } |
50 | 52 |
51 mash::session::mojom::Session* session() { return session_.get(); } | 53 mash::session::mojom::Session* session() { return session_.get(); } |
52 | 54 |
53 private: | 55 private: |
54 friend class WmTestBase; | 56 friend class WmTestBase; |
55 friend class WmTestHelper; | 57 friend class WmTestHelper; |
56 | 58 |
57 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); | 59 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); |
58 | 60 |
59 void InitWindowManager(ui::WindowTreeClient* window_tree_client); | 61 void InitWindowManager(ui::WindowTreeClient* window_tree_client); |
60 | 62 |
61 // shell::Service: | 63 // shell::Service: |
62 void OnStart(const shell::Identity& identity) override; | 64 void OnStart(const shell::Identity& identity) override; |
63 bool OnConnect(const shell::Identity& remote_identity, | 65 bool OnConnect(const shell::Identity& remote_identity, |
64 shell::InterfaceRegistry* registry) override; | 66 shell::InterfaceRegistry* registry) override; |
65 | 67 |
| 68 // InterfaceFactory<ash::mojom::ShelfController>: |
| 69 void Create(const shell::Identity& remote_identity, |
| 70 ash::mojom::ShelfControllerRequest request) override; |
| 71 |
66 // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>: | 72 // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>: |
67 void Create( | 73 void Create(const shell::Identity& remote_identity, |
68 const shell::Identity& remote_identity, | 74 ui::mojom::AcceleratorRegistrarRequest request) override; |
69 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) override; | |
70 | 75 |
71 // session::mojom::ScreenlockStateListener: | 76 // session::mojom::ScreenlockStateListener: |
72 void ScreenlockStateChanged(bool locked) override; | 77 void ScreenlockStateChanged(bool locked) override; |
73 | 78 |
74 tracing::Provider tracing_; | 79 tracing::Provider tracing_; |
75 | 80 |
76 std::unique_ptr<views::AuraInit> aura_init_; | 81 std::unique_ptr<views::AuraInit> aura_init_; |
77 | 82 |
78 std::unique_ptr<ui::GpuService> gpu_service_; | 83 std::unique_ptr<ui::GpuService> gpu_service_; |
79 std::unique_ptr<views::SurfaceContextFactory> compositor_context_factory_; | 84 std::unique_ptr<views::SurfaceContextFactory> compositor_context_factory_; |
80 std::unique_ptr<WindowManager> window_manager_; | 85 std::unique_ptr<WindowManager> window_manager_; |
81 | 86 |
| 87 mojo::BindingSet<ash::mojom::ShelfController> shelf_controller_bindings_; |
| 88 |
82 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; | 89 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; |
83 | 90 |
84 mash::session::mojom::SessionPtr session_; | 91 mash::session::mojom::SessionPtr session_; |
85 | 92 |
86 mojo::Binding<mash::session::mojom::ScreenlockStateListener> | 93 mojo::Binding<mash::session::mojom::ScreenlockStateListener> |
87 screenlock_state_listener_binding_; | 94 screenlock_state_listener_binding_; |
88 | 95 |
89 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 96 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
90 }; | 97 }; |
91 | 98 |
92 } // namespace mus | 99 } // namespace mus |
93 } // namespace ash | 100 } // namespace ash |
94 | 101 |
95 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 102 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
OLD | NEW |