| 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/cpp/config.h" | |
| 14 #include "ash/public/interfaces/wallpaper.mojom.h" | 13 #include "ash/public/interfaces/wallpaper.mojom.h" |
| 15 #include "ash/shell_delegate.h" | |
| 16 #include "base/macros.h" | 14 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 18 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 19 #include "services/service_manager/public/cpp/binder_registry.h" | 17 #include "services/service_manager/public/cpp/binder_registry.h" |
| 20 #include "services/service_manager/public/cpp/service.h" | 18 #include "services/service_manager/public/cpp/service.h" |
| 21 #include "services/tracing/public/cpp/provider.h" | 19 #include "services/tracing/public/cpp/provider.h" |
| 22 #include "services/ui/common/types.h" | 20 #include "services/ui/common/types.h" |
| 23 | 21 |
| 24 namespace aura { | 22 namespace aura { |
| 25 class WindowTreeClient; | 23 class WindowTreeClient; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace base { | 26 namespace base { |
| 29 class SequencedWorkerPool; | 27 class SequencedWorkerPool; |
| 30 } | 28 } |
| 31 | 29 |
| 32 namespace chromeos { | 30 namespace chromeos { |
| 33 namespace system { | 31 namespace system { |
| 34 class ScopedFakeStatisticsProvider; | 32 class ScopedFakeStatisticsProvider; |
| 35 } | 33 } |
| 36 } | 34 } |
| 37 | 35 |
| 38 namespace service_manager { | |
| 39 class Connector; | |
| 40 } | |
| 41 | |
| 42 namespace views { | 36 namespace views { |
| 43 class AuraInit; | 37 class AuraInit; |
| 44 } | 38 } |
| 45 | 39 |
| 46 namespace ash { | 40 namespace ash { |
| 47 | |
| 48 namespace test { | 41 namespace test { |
| 49 class AshTestHelper; | 42 class AshTestHelper; |
| 50 } | 43 } |
| 51 namespace mus { | 44 namespace mus { |
| 52 | 45 |
| 53 class NetworkConnectDelegateMus; | 46 class NetworkConnectDelegateMus; |
| 54 class WindowManager; | 47 class WindowManager; |
| 55 | 48 |
| 56 // Hosts the window manager and the ash system user interface for mash. | 49 // Hosts the window manager and the ash system user interface for mash. |
| 57 class WindowManagerApplication : public service_manager::Service { | 50 class WindowManagerApplication : public service_manager::Service { |
| 58 public: | 51 public: |
| 59 // If |observer| is non-null it is added to the WindowManager once created. | 52 WindowManagerApplication(); |
| 60 // See WindowManager's constructor for details of | |
| 61 // |show_primary_host_on_connect|. | |
| 62 explicit WindowManagerApplication( | |
| 63 bool show_primary_host_on_connect, | |
| 64 Config ash_config = Config::MASH, | |
| 65 std::unique_ptr<ash::ShellDelegate> shell_delegate = nullptr); | |
| 66 ~WindowManagerApplication() override; | 53 ~WindowManagerApplication() override; |
| 67 | 54 |
| 68 WindowManager* window_manager() { return window_manager_.get(); } | 55 WindowManager* window_manager() { return window_manager_.get(); } |
| 69 | 56 |
| 70 service_manager::Connector* GetConnector(); | |
| 71 | |
| 72 private: | 57 private: |
| 73 friend class ash::test::AshTestHelper; | 58 friend class ash::test::AshTestHelper; |
| 74 friend class WmTestBase; | 59 friend class WmTestBase; |
| 75 friend class WmTestHelper; | 60 friend class WmTestHelper; |
| 76 | 61 |
| 77 // If |init_network_handler| is true, chromeos::NetworkHandler is initialized. | 62 // If |init_network_handler| is true, chromeos::NetworkHandler is initialized. |
| 78 void InitWindowManager( | 63 void InitWindowManager( |
| 79 std::unique_ptr<aura::WindowTreeClient> window_tree_client, | 64 std::unique_ptr<aura::WindowTreeClient> window_tree_client, |
| 80 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool, | 65 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool, |
| 81 bool init_network_handler); | 66 bool init_network_handler); |
| 82 | 67 |
| 83 // Initializes lower-level OS-specific components (e.g. D-Bus services). | 68 // Initializes lower-level OS-specific components (e.g. D-Bus services). |
| 84 void InitializeComponents(bool init_network_handler); | 69 void InitializeComponents(bool init_network_handler); |
| 85 void ShutdownComponents(); | 70 void ShutdownComponents(); |
| 86 | 71 |
| 87 // service_manager::Service: | 72 // service_manager::Service: |
| 88 void OnStart() override; | 73 void OnStart() override; |
| 89 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 74 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
| 90 const std::string& interface_name, | 75 const std::string& interface_name, |
| 91 mojo::ScopedMessagePipeHandle interface_pipe) override; | 76 mojo::ScopedMessagePipeHandle interface_pipe) override; |
| 92 | 77 |
| 93 const bool show_primary_host_on_connect_; | |
| 94 | |
| 95 tracing::Provider tracing_; | 78 tracing::Provider tracing_; |
| 96 | 79 |
| 97 std::unique_ptr<views::AuraInit> aura_init_; | 80 std::unique_ptr<views::AuraInit> aura_init_; |
| 98 | 81 |
| 99 std::unique_ptr<WindowManager> window_manager_; | 82 std::unique_ptr<WindowManager> window_manager_; |
| 100 | 83 |
| 101 // A blocking pool used by the WindowManager's shell; not used in tests. | 84 // A blocking pool used by the WindowManager's shell; not used in tests. |
| 102 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 85 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 103 | 86 |
| 104 std::unique_ptr<NetworkConnectDelegateMus> network_connect_delegate_; | 87 std::unique_ptr<NetworkConnectDelegateMus> network_connect_delegate_; |
| 105 std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider> | 88 std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider> |
| 106 statistics_provider_; | 89 statistics_provider_; |
| 107 | 90 |
| 108 service_manager::BinderRegistry registry_; | 91 service_manager::BinderRegistry registry_; |
| 109 | 92 |
| 110 std::unique_ptr<ShellDelegate> shell_delegate_; | |
| 111 | |
| 112 const Config ash_config_; | |
| 113 | |
| 114 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 93 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
| 115 }; | 94 }; |
| 116 | 95 |
| 117 } // namespace mus | 96 } // namespace mus |
| 118 } // namespace ash | 97 } // namespace ash |
| 119 | 98 |
| 120 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 99 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
| OLD | NEW |