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