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> |
| 8 |
7 #if defined(USE_X11) | 9 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
9 #include <X11/extensions/XInput2.h> | 11 #include <X11/extensions/XInput2.h> |
10 | 12 |
11 // Xlib.h defines RootWindow. | 13 // Xlib.h defines RootWindow. |
12 #undef RootWindow | 14 #undef RootWindow |
13 #endif | 15 #endif |
14 | 16 |
15 #include "ash/display/cursor_window_controller.h" | 17 #include "ash/display/cursor_window_controller.h" |
16 #include "ash/display/display_info.h" | 18 #include "ash/display/display_info.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 221 } |
220 #endif | 222 #endif |
221 | 223 |
222 aura::client::SetCaptureClient(host->window(), new NoneCaptureClient()); | 224 aura::client::SetCaptureClient(host->window(), new NoneCaptureClient()); |
223 host->Show(); | 225 host->Show(); |
224 | 226 |
225 aura::Window* mirror_window = host_info->mirror_window = | 227 aura::Window* mirror_window = host_info->mirror_window = |
226 new aura::Window(nullptr); | 228 new aura::Window(nullptr); |
227 mirror_window->Init(ui::LAYER_SOLID_COLOR); | 229 mirror_window->Init(ui::LAYER_SOLID_COLOR); |
228 host->window()->AddChild(mirror_window); | 230 host->window()->AddChild(mirror_window); |
229 host_info->ash_host->SetRootWindowTransformer(transformer.Pass()); | 231 host_info->ash_host->SetRootWindowTransformer(std::move(transformer)); |
230 mirror_window->SetBounds(host->window()->bounds()); | 232 mirror_window->SetBounds(host->window()->bounds()); |
231 mirror_window->Show(); | 233 mirror_window->Show(); |
232 if (reflector_) { | 234 if (reflector_) { |
233 reflector_->AddMirroringLayer(mirror_window->layer()); | 235 reflector_->AddMirroringLayer(mirror_window->layer()); |
234 } else { | 236 } else { |
235 reflector_ = | 237 reflector_ = |
236 aura::Env::GetInstance()->context_factory()->CreateReflector( | 238 aura::Env::GetInstance()->context_factory()->CreateReflector( |
237 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), | 239 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), |
238 mirror_window->layer()); | 240 mirror_window->layer()); |
239 } | 241 } |
240 } else { | 242 } else { |
241 AshWindowTreeHost* ash_host = | 243 AshWindowTreeHost* ash_host = |
242 mirroring_host_info_map_[display_info.id()]->ash_host.get(); | 244 mirroring_host_info_map_[display_info.id()]->ash_host.get(); |
243 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 245 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
244 GetRootWindowSettings(host->window())->display_id = display_info.id(); | 246 GetRootWindowSettings(host->window())->display_id = display_info.id(); |
245 ash_host->SetRootWindowTransformer(transformer.Pass()); | 247 ash_host->SetRootWindowTransformer(std::move(transformer)); |
246 host->SetBounds(display_info.bounds_in_native()); | 248 host->SetBounds(display_info.bounds_in_native()); |
247 } | 249 } |
248 } | 250 } |
249 | 251 |
250 // Deleting WTHs for disconnected displays. | 252 // Deleting WTHs for disconnected displays. |
251 if (mirroring_host_info_map_.size() > display_info_list.size()) { | 253 if (mirroring_host_info_map_.size() > display_info_list.size()) { |
252 for (MirroringHostInfoMap::iterator iter = mirroring_host_info_map_.begin(); | 254 for (MirroringHostInfoMap::iterator iter = mirroring_host_info_map_.begin(); |
253 iter != mirroring_host_info_map_.end();) { | 255 iter != mirroring_host_info_map_.end();) { |
254 if (std::find_if(display_info_list.begin(), display_info_list.end(), | 256 if (std::find_if(display_info_list.begin(), display_info_list.end(), |
255 [iter](const DisplayInfo& info) { | 257 [iter](const DisplayInfo& info) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // EventProcessor may be accessed after this call if the mirroring window | 377 // EventProcessor may be accessed after this call if the mirroring window |
376 // was deleted as a result of input event (e.g. shortcut), so don't delete | 378 // was deleted as a result of input event (e.g. shortcut), so don't delete |
377 // now. | 379 // now. |
378 if (delay_host_deletion) | 380 if (delay_host_deletion) |
379 base::MessageLoop::current()->DeleteSoon(FROM_HERE, host_info); | 381 base::MessageLoop::current()->DeleteSoon(FROM_HERE, host_info); |
380 else | 382 else |
381 delete host_info; | 383 delete host_info; |
382 } | 384 } |
383 | 385 |
384 } // namespace ash | 386 } // namespace ash |
OLD | NEW |