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 // 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); |
53 ~WindowManagerApplication() override; | 66 ~WindowManagerApplication() override; |
54 | 67 |
55 WindowManager* window_manager() { return window_manager_.get(); } | 68 WindowManager* window_manager() { return window_manager_.get(); } |
56 | 69 |
| 70 service_manager::Connector* GetConnector(); |
| 71 |
57 private: | 72 private: |
58 friend class ash::test::AshTestHelper; | 73 friend class ash::test::AshTestHelper; |
59 friend class WmTestBase; | 74 friend class WmTestBase; |
60 friend class WmTestHelper; | 75 friend class WmTestHelper; |
61 | 76 |
62 // If |init_network_handler| is true, chromeos::NetworkHandler is initialized. | 77 // If |init_network_handler| is true, chromeos::NetworkHandler is initialized. |
63 void InitWindowManager( | 78 void InitWindowManager( |
64 std::unique_ptr<aura::WindowTreeClient> window_tree_client, | 79 std::unique_ptr<aura::WindowTreeClient> window_tree_client, |
65 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool, | 80 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool, |
66 bool init_network_handler); | 81 bool init_network_handler); |
67 | 82 |
68 // Initializes lower-level OS-specific components (e.g. D-Bus services). | 83 // Initializes lower-level OS-specific components (e.g. D-Bus services). |
69 void InitializeComponents(bool init_network_handler); | 84 void InitializeComponents(bool init_network_handler); |
70 void ShutdownComponents(); | 85 void ShutdownComponents(); |
71 | 86 |
72 // service_manager::Service: | 87 // service_manager::Service: |
73 void OnStart() override; | 88 void OnStart() override; |
74 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 89 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
75 const std::string& interface_name, | 90 const std::string& interface_name, |
76 mojo::ScopedMessagePipeHandle interface_pipe) override; | 91 mojo::ScopedMessagePipeHandle interface_pipe) override; |
77 | 92 |
| 93 const bool show_primary_host_on_connect_; |
| 94 |
78 tracing::Provider tracing_; | 95 tracing::Provider tracing_; |
79 | 96 |
80 std::unique_ptr<views::AuraInit> aura_init_; | 97 std::unique_ptr<views::AuraInit> aura_init_; |
81 | 98 |
82 std::unique_ptr<WindowManager> window_manager_; | 99 std::unique_ptr<WindowManager> window_manager_; |
83 | 100 |
84 // A blocking pool used by the WindowManager's shell; not used in tests. | 101 // A blocking pool used by the WindowManager's shell; not used in tests. |
85 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 102 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
86 | 103 |
87 std::unique_ptr<NetworkConnectDelegateMus> network_connect_delegate_; | 104 std::unique_ptr<NetworkConnectDelegateMus> network_connect_delegate_; |
88 std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider> | 105 std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider> |
89 statistics_provider_; | 106 statistics_provider_; |
90 | 107 |
91 service_manager::BinderRegistry registry_; | 108 service_manager::BinderRegistry registry_; |
92 | 109 |
| 110 std::unique_ptr<ShellDelegate> shell_delegate_; |
| 111 |
| 112 const Config ash_config_; |
| 113 |
93 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 114 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
94 }; | 115 }; |
95 | 116 |
96 } // namespace mus | 117 } // namespace mus |
97 } // namespace ash | 118 } // namespace ash |
98 | 119 |
99 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 120 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
OLD | NEW |