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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 chromeos::CrasAudioHandler::Shutdown(); | 110 chromeos::CrasAudioHandler::Shutdown(); |
111 chromeos::NetworkConnect::Shutdown(); | 111 chromeos::NetworkConnect::Shutdown(); |
112 network_connect_delegate_.reset(); | 112 network_connect_delegate_.reset(); |
113 chromeos::NetworkHandler::Shutdown(); | 113 chromeos::NetworkHandler::Shutdown(); |
114 bluez::BluezDBusManager::Shutdown(); | 114 bluez::BluezDBusManager::Shutdown(); |
115 chromeos::DBusThreadManager::Shutdown(); | 115 chromeos::DBusThreadManager::Shutdown(); |
116 #endif | 116 #endif |
117 message_center::MessageCenter::Shutdown(); | 117 message_center::MessageCenter::Shutdown(); |
118 } | 118 } |
119 | 119 |
120 void WindowManagerApplication::OnStart() { | 120 void WindowManagerApplication::OnStart( |
| 121 service_manager::ServiceContext* context) { |
| 122 context_ = context; |
121 aura_init_ = base::MakeUnique<views::AuraInit>( | 123 aura_init_ = base::MakeUnique<views::AuraInit>( |
122 context()->connector(), context()->identity(), "ash_mus_resources.pak", | 124 context->connector(), context->identity(), "ash_mus_resources.pak", |
123 "ash_mus_resources_200.pak"); | 125 "ash_mus_resources_200.pak"); |
124 gpu_service_ = ui::GpuService::Create(context()->connector()); | 126 gpu_service_ = ui::GpuService::Create(context->connector()); |
125 compositor_context_factory_.reset( | 127 compositor_context_factory_.reset( |
126 new views::SurfaceContextFactory(gpu_service_.get())); | 128 new views::SurfaceContextFactory(gpu_service_.get())); |
127 aura::Env::GetInstance()->set_context_factory( | 129 aura::Env::GetInstance()->set_context_factory( |
128 compositor_context_factory_.get()); | 130 compositor_context_factory_.get()); |
129 window_manager_.reset(new WindowManager(context()->connector())); | 131 window_manager_.reset(new WindowManager(context->connector())); |
130 | 132 |
131 MaterialDesignController::Initialize(); | 133 MaterialDesignController::Initialize(); |
132 | 134 |
133 tracing_.Initialize(context()->connector(), context()->identity().name()); | 135 tracing_.Initialize(context->connector(), context->identity().name()); |
134 | 136 |
135 std::unique_ptr<ui::WindowTreeClient> window_tree_client = | 137 std::unique_ptr<ui::WindowTreeClient> window_tree_client = |
136 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), | 138 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), |
137 window_manager_.get()); | 139 window_manager_.get()); |
138 window_tree_client->ConnectAsWindowManager(context()->connector()); | 140 window_tree_client->ConnectAsWindowManager(context->connector()); |
139 | 141 |
140 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 142 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
141 const char kThreadNamePrefix[] = "MashBlocking"; | 143 const char kThreadNamePrefix[] = "MashBlocking"; |
142 blocking_pool_ = new base::SequencedWorkerPool( | 144 blocking_pool_ = new base::SequencedWorkerPool( |
143 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 145 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
144 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 146 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
145 } | 147 } |
146 | 148 |
147 bool WindowManagerApplication::OnConnect( | 149 bool WindowManagerApplication::OnConnect( |
148 const service_manager::ServiceInfo& remote_info, | 150 const service_manager::ServiceInfo& remote_info, |
149 service_manager::InterfaceRegistry* registry) { | 151 service_manager::InterfaceRegistry* registry) { |
150 // Register services used in both classic ash and mash. | 152 // Register services used in both classic ash and mash. |
151 mojo_interface_factory::RegisterInterfaces( | 153 mojo_interface_factory::RegisterInterfaces( |
152 registry, base::ThreadTaskRunnerHandle::Get()); | 154 registry, base::ThreadTaskRunnerHandle::Get()); |
153 | 155 |
154 if (remote_info.identity.name() == "service:mash_session") { | 156 if (remote_info.identity.name() == "service:mash_session") { |
155 context()->connector()->ConnectToInterface(remote_info.identity, &session_); | 157 context_->connector()->ConnectToInterface(remote_info.identity, &session_); |
156 session_->AddScreenlockStateListener( | 158 session_->AddScreenlockStateListener( |
157 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 159 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
158 } | 160 } |
159 return true; | 161 return true; |
160 } | 162 } |
161 | 163 |
162 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 164 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
163 window_manager_->SetScreenLocked(locked); | 165 window_manager_->SetScreenLocked(locked); |
164 } | 166 } |
165 | 167 |
166 } // namespace mus | 168 } // namespace mus |
167 } // namespace ash | 169 } // namespace ash |
OLD | NEW |