OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/display/mirror_window_controller.h" | 5 #include "ash/display/mirror_window_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #if defined(USE_X11) | 9 #if defined(USE_X11) |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 new aura::Window(nullptr); | 220 new aura::Window(nullptr); |
221 mirror_window->Init(ui::LAYER_SOLID_COLOR); | 221 mirror_window->Init(ui::LAYER_SOLID_COLOR); |
222 host->window()->AddChild(mirror_window); | 222 host->window()->AddChild(mirror_window); |
223 host_info->ash_host->SetRootWindowTransformer(std::move(transformer)); | 223 host_info->ash_host->SetRootWindowTransformer(std::move(transformer)); |
224 mirror_window->SetBounds(host->window()->bounds()); | 224 mirror_window->SetBounds(host->window()->bounds()); |
225 mirror_window->Show(); | 225 mirror_window->Show(); |
226 if (reflector_) { | 226 if (reflector_) { |
227 reflector_->AddMirroringLayer(mirror_window->layer()); | 227 reflector_->AddMirroringLayer(mirror_window->layer()); |
228 } else { | 228 } else { |
229 reflector_ = | 229 reflector_ = |
230 aura::Env::GetInstance()->context_factory()->CreateReflector( | 230 aura::Env::GetInstance() |
231 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), | 231 ->context_factory_private() |
232 mirror_window->layer()); | 232 ->CreateReflector( |
| 233 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), |
| 234 mirror_window->layer()); |
233 } | 235 } |
234 } else { | 236 } else { |
235 AshWindowTreeHost* ash_host = | 237 AshWindowTreeHost* ash_host = |
236 mirroring_host_info_map_[display_info.id()]->ash_host.get(); | 238 mirroring_host_info_map_[display_info.id()]->ash_host.get(); |
237 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 239 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
238 GetRootWindowSettings(host->window())->display_id = display_info.id(); | 240 GetRootWindowSettings(host->window())->display_id = display_info.id(); |
239 ash_host->SetRootWindowTransformer(std::move(transformer)); | 241 ash_host->SetRootWindowTransformer(std::move(transformer)); |
240 host->SetBoundsInPixels(display_info.bounds_in_native()); | 242 host->SetBoundsInPixels(display_info.bounds_in_native()); |
241 } | 243 } |
242 } | 244 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 Close(true); | 278 Close(true); |
277 multi_display_mode_ = new_mode; | 279 multi_display_mode_ = new_mode; |
278 } | 280 } |
279 | 281 |
280 void MirrorWindowController::Close(bool delay_host_deletion) { | 282 void MirrorWindowController::Close(bool delay_host_deletion) { |
281 for (auto& info : mirroring_host_info_map_) | 283 for (auto& info : mirroring_host_info_map_) |
282 CloseAndDeleteHost(info.second, delay_host_deletion); | 284 CloseAndDeleteHost(info.second, delay_host_deletion); |
283 | 285 |
284 mirroring_host_info_map_.clear(); | 286 mirroring_host_info_map_.clear(); |
285 if (reflector_) { | 287 if (reflector_) { |
286 aura::Env::GetInstance()->context_factory()->RemoveReflector( | 288 aura::Env::GetInstance()->context_factory_private()->RemoveReflector( |
287 reflector_.get()); | 289 reflector_.get()); |
288 reflector_.reset(); | 290 reflector_.reset(); |
289 } | 291 } |
290 } | 292 } |
291 | 293 |
292 void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) { | 294 void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) { |
293 for (auto& pair : mirroring_host_info_map_) { | 295 for (auto& pair : mirroring_host_info_map_) { |
294 MirroringHostInfo* info = pair.second; | 296 MirroringHostInfo* info = pair.second; |
295 if (info->ash_host->AsWindowTreeHost() == host) { | 297 if (info->ash_host->AsWindowTreeHost() == host) { |
296 if (info->mirror_window_host_size == host->GetBoundsInPixels().size()) | 298 if (info->mirror_window_host_size == host->GetBoundsInPixels().size()) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // EventProcessor may be accessed after this call if the mirroring window | 373 // EventProcessor may be accessed after this call if the mirroring window |
372 // was deleted as a result of input event (e.g. shortcut), so don't delete | 374 // was deleted as a result of input event (e.g. shortcut), so don't delete |
373 // now. | 375 // now. |
374 if (delay_host_deletion) | 376 if (delay_host_deletion) |
375 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); | 377 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); |
376 else | 378 else |
377 delete host_info; | 379 delete host_info; |
378 } | 380 } |
379 | 381 |
380 } // namespace ash | 382 } // namespace ash |
OLD | NEW |