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 #include "ash/mus/window_manager_application.h" | 5 #include "ash/mus/window_manager_application.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/mojo_interface_factory.h" | 10 #include "ash/common/mojo_interface_factory.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 chromeos::CrasAudioHandler::Shutdown(); | 123 chromeos::CrasAudioHandler::Shutdown(); |
124 ui::NetworkConnect::Shutdown(); | 124 ui::NetworkConnect::Shutdown(); |
125 network_connect_delegate_.reset(); | 125 network_connect_delegate_.reset(); |
126 chromeos::NetworkHandler::Shutdown(); | 126 chromeos::NetworkHandler::Shutdown(); |
127 bluez::BluezDBusManager::Shutdown(); | 127 bluez::BluezDBusManager::Shutdown(); |
128 chromeos::DBusThreadManager::Shutdown(); | 128 chromeos::DBusThreadManager::Shutdown(); |
129 #endif | 129 #endif |
130 message_center::MessageCenter::Shutdown(); | 130 message_center::MessageCenter::Shutdown(); |
131 } | 131 } |
132 | 132 |
133 void WindowManagerApplication::OnStart(const shell::Identity& identity) { | 133 void WindowManagerApplication::OnStart( |
| 134 const service_manager::Identity& identity) { |
134 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak", | 135 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak", |
135 "ash_mus_resources_200.pak")); | 136 "ash_mus_resources_200.pak")); |
136 gpu_service_ = ui::GpuService::Create(connector()); | 137 gpu_service_ = ui::GpuService::Create(connector()); |
137 compositor_context_factory_.reset( | 138 compositor_context_factory_.reset( |
138 new views::SurfaceContextFactory(gpu_service_.get())); | 139 new views::SurfaceContextFactory(gpu_service_.get())); |
139 aura::Env::GetInstance()->set_context_factory( | 140 aura::Env::GetInstance()->set_context_factory( |
140 compositor_context_factory_.get()); | 141 compositor_context_factory_.get()); |
141 window_manager_.reset(new WindowManager(connector())); | 142 window_manager_.reset(new WindowManager(connector())); |
142 | 143 |
143 MaterialDesignController::Initialize(); | 144 MaterialDesignController::Initialize(); |
144 | 145 |
145 tracing_.Initialize(connector(), identity.name()); | 146 tracing_.Initialize(connector(), identity.name()); |
146 | 147 |
147 std::unique_ptr<ui::WindowTreeClient> window_tree_client = | 148 std::unique_ptr<ui::WindowTreeClient> window_tree_client = |
148 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), | 149 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), |
149 window_manager_.get()); | 150 window_manager_.get()); |
150 window_tree_client->ConnectAsWindowManager(connector()); | 151 window_tree_client->ConnectAsWindowManager(connector()); |
151 | 152 |
152 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 153 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
153 const char kThreadNamePrefix[] = "MashBlocking"; | 154 const char kThreadNamePrefix[] = "MashBlocking"; |
154 blocking_pool_ = new base::SequencedWorkerPool( | 155 blocking_pool_ = new base::SequencedWorkerPool( |
155 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 156 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
156 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 157 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
157 } | 158 } |
158 | 159 |
159 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, | 160 bool WindowManagerApplication::OnConnect( |
160 shell::InterfaceRegistry* registry) { | 161 const service_manager::Identity& remote_identity, |
| 162 service_manager::InterfaceRegistry* registry) { |
161 // Register services used in both classic ash and mash. | 163 // Register services used in both classic ash and mash. |
162 mojo_interface_factory::RegisterInterfaces( | 164 mojo_interface_factory::RegisterInterfaces( |
163 registry, base::ThreadTaskRunnerHandle::Get()); | 165 registry, base::ThreadTaskRunnerHandle::Get()); |
164 | 166 |
165 registry->AddInterface<mojom::WallpaperController>(this); | 167 registry->AddInterface<mojom::WallpaperController>(this); |
166 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 168 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
167 if (remote_identity.name() == "service:mash_session") { | 169 if (remote_identity.name() == "service:mash_session") { |
168 connector()->ConnectToInterface(remote_identity, &session_); | 170 connector()->ConnectToInterface(remote_identity, &session_); |
169 session_->AddScreenlockStateListener( | 171 session_->AddScreenlockStateListener( |
170 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 172 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
171 } | 173 } |
172 return true; | 174 return true; |
173 } | 175 } |
174 | 176 |
175 void WindowManagerApplication::Create( | 177 void WindowManagerApplication::Create( |
176 const ::shell::Identity& remote_identity, | 178 const ::service_manager::Identity& remote_identity, |
177 mojom::WallpaperControllerRequest request) { | 179 mojom::WallpaperControllerRequest request) { |
178 mojom::WallpaperController* wallpaper_controller = | 180 mojom::WallpaperController* wallpaper_controller = |
179 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); | 181 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); |
180 DCHECK(wallpaper_controller); | 182 DCHECK(wallpaper_controller); |
181 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 183 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
182 std::move(request)); | 184 std::move(request)); |
183 } | 185 } |
184 | 186 |
185 void WindowManagerApplication::Create( | 187 void WindowManagerApplication::Create( |
186 const shell::Identity& remote_identity, | 188 const service_manager::Identity& remote_identity, |
187 ui::mojom::AcceleratorRegistrarRequest request) { | 189 ui::mojom::AcceleratorRegistrarRequest request) { |
188 if (!window_manager_->window_manager_client()) | 190 if (!window_manager_->window_manager_client()) |
189 return; // Can happen during shutdown. | 191 return; // Can happen during shutdown. |
190 | 192 |
191 uint16_t accelerator_namespace_id; | 193 uint16_t accelerator_namespace_id; |
192 if (!window_manager_->GetNextAcceleratorNamespaceId( | 194 if (!window_manager_->GetNextAcceleratorNamespaceId( |
193 &accelerator_namespace_id)) { | 195 &accelerator_namespace_id)) { |
194 DVLOG(1) << "Max number of accelerators registered, ignoring request."; | 196 DVLOG(1) << "Max number of accelerators registered, ignoring request."; |
195 // All ids are used. Normally shouldn't happen, so we close the connection. | 197 // All ids are used. Normally shouldn't happen, so we close the connection. |
196 return; | 198 return; |
197 } | 199 } |
198 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( | 200 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( |
199 window_manager_.get(), accelerator_namespace_id, std::move(request), | 201 window_manager_.get(), accelerator_namespace_id, std::move(request), |
200 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 202 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
201 base::Unretained(this)))); | 203 base::Unretained(this)))); |
202 } | 204 } |
203 | 205 |
204 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 206 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
205 window_manager_->SetScreenLocked(locked); | 207 window_manager_->SetScreenLocked(locked); |
206 } | 208 } |
207 | 209 |
208 } // namespace mus | 210 } // namespace mus |
209 } // namespace ash | 211 } // namespace ash |
OLD | NEW |