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