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/wallpaper.mojom.h" | 13 #include "ash/public/interfaces/wallpaper.mojom.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "mash/session/public/interfaces/session.mojom.h" | 16 #include "mash/session/public/interfaces/session.mojom.h" |
17 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
18 #include "mojo/public/cpp/bindings/binding_set.h" | |
19 #include "services/shell/public/cpp/service.h" | 18 #include "services/shell/public/cpp/service.h" |
20 #include "services/tracing/public/cpp/provider.h" | 19 #include "services/tracing/public/cpp/provider.h" |
21 #include "services/ui/common/types.h" | 20 #include "services/ui/common/types.h" |
22 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h" | 21 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h" |
23 | 22 |
24 namespace base { | 23 namespace base { |
25 class SequencedWorkerPool; | 24 class SequencedWorkerPool; |
26 } | 25 } |
27 | 26 |
28 namespace chromeos { | 27 namespace chromeos { |
(...skipping 16 matching lines...) Expand all Loading... |
45 namespace ash { | 44 namespace ash { |
46 namespace mus { | 45 namespace mus { |
47 | 46 |
48 class AcceleratorRegistrarImpl; | 47 class AcceleratorRegistrarImpl; |
49 class NativeWidgetFactoryMus; | 48 class NativeWidgetFactoryMus; |
50 class WindowManager; | 49 class WindowManager; |
51 | 50 |
52 // Hosts the window manager and the ash system user interface for mash. | 51 // Hosts the window manager and the ash system user interface for mash. |
53 class WindowManagerApplication | 52 class WindowManagerApplication |
54 : public shell::Service, | 53 : public shell::Service, |
55 public shell::InterfaceFactory<mojom::WallpaperController>, | |
56 public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>, | 54 public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>, |
57 public mash::session::mojom::ScreenlockStateListener { | 55 public mash::session::mojom::ScreenlockStateListener { |
58 public: | 56 public: |
59 WindowManagerApplication(); | 57 WindowManagerApplication(); |
60 ~WindowManagerApplication() override; | 58 ~WindowManagerApplication() override; |
61 | 59 |
62 WindowManager* window_manager() { return window_manager_.get(); } | 60 WindowManager* window_manager() { return window_manager_.get(); } |
63 | 61 |
64 mash::session::mojom::Session* session() { return session_.get(); } | 62 mash::session::mojom::Session* session() { return session_.get(); } |
65 | 63 |
66 private: | 64 private: |
67 friend class WmTestBase; | 65 friend class WmTestBase; |
68 friend class WmTestHelper; | 66 friend class WmTestHelper; |
69 | 67 |
70 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); | 68 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); |
71 | 69 |
72 void InitWindowManager( | 70 void InitWindowManager( |
73 std::unique_ptr<ui::WindowTreeClient> window_tree_client, | 71 std::unique_ptr<ui::WindowTreeClient> window_tree_client, |
74 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool); | 72 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool); |
75 | 73 |
76 // Initializes lower-level OS-specific components (e.g. D-Bus services). | 74 // Initializes lower-level OS-specific components (e.g. D-Bus services). |
77 void InitializeComponents(); | 75 void InitializeComponents(); |
78 void ShutdownComponents(); | 76 void ShutdownComponents(); |
79 | 77 |
80 // shell::Service: | 78 // shell::Service: |
81 void OnStart(const shell::Identity& identity) override; | 79 void OnStart(const shell::Identity& identity) override; |
82 bool OnConnect(const shell::Identity& remote_identity, | 80 bool OnConnect(const shell::Identity& remote_identity, |
83 shell::InterfaceRegistry* registry) override; | 81 shell::InterfaceRegistry* registry) override; |
84 | 82 |
85 // InterfaceFactory<mojom::WallpaperController>: | |
86 void Create(const shell::Identity& remote_identity, | |
87 mojom::WallpaperControllerRequest request) override; | |
88 | |
89 // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>: | 83 // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>: |
90 void Create(const shell::Identity& remote_identity, | 84 void Create(const shell::Identity& remote_identity, |
91 ui::mojom::AcceleratorRegistrarRequest request) override; | 85 ui::mojom::AcceleratorRegistrarRequest request) override; |
92 | 86 |
93 // session::mojom::ScreenlockStateListener: | 87 // session::mojom::ScreenlockStateListener: |
94 void ScreenlockStateChanged(bool locked) override; | 88 void ScreenlockStateChanged(bool locked) override; |
95 | 89 |
96 tracing::Provider tracing_; | 90 tracing::Provider tracing_; |
97 | 91 |
98 std::unique_ptr<views::AuraInit> aura_init_; | 92 std::unique_ptr<views::AuraInit> aura_init_; |
99 std::unique_ptr<NativeWidgetFactoryMus> native_widget_factory_mus_; | 93 std::unique_ptr<NativeWidgetFactoryMus> native_widget_factory_mus_; |
100 | 94 |
101 std::unique_ptr<ui::GpuService> gpu_service_; | 95 std::unique_ptr<ui::GpuService> gpu_service_; |
102 std::unique_ptr<views::SurfaceContextFactory> compositor_context_factory_; | 96 std::unique_ptr<views::SurfaceContextFactory> compositor_context_factory_; |
103 std::unique_ptr<WindowManager> window_manager_; | 97 std::unique_ptr<WindowManager> window_manager_; |
104 | 98 |
105 // A blocking pool used by the WindowManager's shell; not used in tests. | 99 // A blocking pool used by the WindowManager's shell; not used in tests. |
106 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 100 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
107 | 101 |
108 mojo::BindingSet<mojom::WallpaperController> wallpaper_controller_bindings_; | |
109 | |
110 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; | 102 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; |
111 | 103 |
112 mash::session::mojom::SessionPtr session_; | 104 mash::session::mojom::SessionPtr session_; |
113 | 105 |
114 mojo::Binding<mash::session::mojom::ScreenlockStateListener> | 106 mojo::Binding<mash::session::mojom::ScreenlockStateListener> |
115 screenlock_state_listener_binding_; | 107 screenlock_state_listener_binding_; |
116 | 108 |
117 #if defined(OS_CHROMEOS) | 109 #if defined(OS_CHROMEOS) |
118 class StubNetworkConnectDelegate; | 110 class StubNetworkConnectDelegate; |
119 std::unique_ptr<StubNetworkConnectDelegate> network_connect_delegate_; | 111 std::unique_ptr<StubNetworkConnectDelegate> network_connect_delegate_; |
120 std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider> | 112 std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider> |
121 statistics_provider_; | 113 statistics_provider_; |
122 #endif | 114 #endif |
123 | 115 |
124 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 116 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
125 }; | 117 }; |
126 | 118 |
127 } // namespace mus | 119 } // namespace mus |
128 } // namespace ash | 120 } // namespace ash |
129 | 121 |
130 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 122 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
OLD | NEW |