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