| 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::NetworkConnect::Shutdown(); | 123 chromeos::NetworkConnect::Shutdown(); |
| 124 network_connect_delegate_.reset(); | 124 network_connect_delegate_.reset(); |
| 125 chromeos::NetworkHandler::Shutdown(); | 125 chromeos::NetworkHandler::Shutdown(); |
| 126 bluez::BluezDBusManager::Shutdown(); | 126 bluez::BluezDBusManager::Shutdown(); |
| 127 chromeos::DBusThreadManager::Shutdown(); | 127 chromeos::DBusThreadManager::Shutdown(); |
| 128 #endif | 128 #endif |
| 129 message_center::MessageCenter::Shutdown(); | 129 message_center::MessageCenter::Shutdown(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void WindowManagerApplication::OnStart( | 132 void WindowManagerApplication::OnStart( |
| 133 const service_manager::Identity& identity) { | 133 const service_manager::ServiceInfo& info) { |
| 134 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak", | 134 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak", |
| 135 "ash_mus_resources_200.pak")); | 135 "ash_mus_resources_200.pak")); |
| 136 gpu_service_ = ui::GpuService::Create(connector()); | 136 gpu_service_ = ui::GpuService::Create(connector()); |
| 137 compositor_context_factory_.reset( | 137 compositor_context_factory_.reset( |
| 138 new views::SurfaceContextFactory(gpu_service_.get())); | 138 new views::SurfaceContextFactory(gpu_service_.get())); |
| 139 aura::Env::GetInstance()->set_context_factory( | 139 aura::Env::GetInstance()->set_context_factory( |
| 140 compositor_context_factory_.get()); | 140 compositor_context_factory_.get()); |
| 141 window_manager_.reset(new WindowManager(connector())); | 141 window_manager_.reset(new WindowManager(connector())); |
| 142 | 142 |
| 143 MaterialDesignController::Initialize(); | 143 MaterialDesignController::Initialize(); |
| 144 | 144 |
| 145 tracing_.Initialize(connector(), identity.name()); | 145 tracing_.Initialize(connector(), info.identity.name()); |
| 146 | 146 |
| 147 std::unique_ptr<ui::WindowTreeClient> window_tree_client = | 147 std::unique_ptr<ui::WindowTreeClient> window_tree_client = |
| 148 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), | 148 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), |
| 149 window_manager_.get()); | 149 window_manager_.get()); |
| 150 window_tree_client->ConnectAsWindowManager(connector()); | 150 window_tree_client->ConnectAsWindowManager(connector()); |
| 151 | 151 |
| 152 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 152 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
| 153 const char kThreadNamePrefix[] = "MashBlocking"; | 153 const char kThreadNamePrefix[] = "MashBlocking"; |
| 154 blocking_pool_ = new base::SequencedWorkerPool( | 154 blocking_pool_ = new base::SequencedWorkerPool( |
| 155 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 155 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 156 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 156 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool WindowManagerApplication::OnConnect( | 159 bool WindowManagerApplication::OnConnect( |
| 160 const service_manager::Identity& remote_identity, | 160 const service_manager::ServiceInfo& remote_info, |
| 161 service_manager::InterfaceRegistry* registry) { | 161 service_manager::InterfaceRegistry* registry) { |
| 162 // Register services used in both classic ash and mash. | 162 // Register services used in both classic ash and mash. |
| 163 mojo_interface_factory::RegisterInterfaces( | 163 mojo_interface_factory::RegisterInterfaces( |
| 164 registry, base::ThreadTaskRunnerHandle::Get()); | 164 registry, base::ThreadTaskRunnerHandle::Get()); |
| 165 | 165 |
| 166 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 166 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 167 if (remote_identity.name() == "service:mash_session") { | 167 if (remote_info.identity.name() == "service:mash_session") { |
| 168 connector()->ConnectToInterface(remote_identity, &session_); | 168 connector()->ConnectToInterface(remote_info.identity, &session_); |
| 169 session_->AddScreenlockStateListener( | 169 session_->AddScreenlockStateListener( |
| 170 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 170 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| 171 } | 171 } |
| 172 return true; | 172 return true; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void WindowManagerApplication::Create( | 175 void WindowManagerApplication::Create( |
| 176 const service_manager::Identity& remote_identity, | 176 const service_manager::Identity& remote_identity, |
| 177 ui::mojom::AcceleratorRegistrarRequest request) { | 177 ui::mojom::AcceleratorRegistrarRequest request) { |
| 178 if (!window_manager_->window_manager_client()) | 178 if (!window_manager_->window_manager_client()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 190 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 190 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 191 base::Unretained(this)))); | 191 base::Unretained(this)))); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 194 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 195 window_manager_->SetScreenLocked(locked); | 195 window_manager_->SetScreenLocked(locked); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace mus | 198 } // namespace mus |
| 199 } // namespace ash | 199 } // namespace ash |
| OLD | NEW |