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