| 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 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 | 10 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 return mirroring_host_info_map_.begin() | 320 return mirroring_host_info_map_.begin() |
| 321 ->second->ash_host->AsWindowTreeHost() | 321 ->second->ash_host->AsWindowTreeHost() |
| 322 ->window(); | 322 ->window(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 gfx::Display MirrorWindowController::GetDisplayForRootWindow( | 325 gfx::Display MirrorWindowController::GetDisplayForRootWindow( |
| 326 const aura::Window* root) const { | 326 const aura::Window* root) const { |
| 327 for (const auto& pair : mirroring_host_info_map_) { | 327 for (const auto& pair : mirroring_host_info_map_) { |
| 328 if (pair.second->ash_host->AsWindowTreeHost()->window() == root) { | 328 if (pair.second->ash_host->AsWindowTreeHost()->window() == root) { |
| 329 // Sanity check to catch an error early. | 329 // Sanity check to catch an error early. |
| 330 int64 id = pair.first; | 330 int64_t id = pair.first; |
| 331 const DisplayManager::DisplayList& list = | 331 const DisplayManager::DisplayList& list = |
| 332 Shell::GetInstance() | 332 Shell::GetInstance() |
| 333 ->display_manager() | 333 ->display_manager() |
| 334 ->software_mirroring_display_list(); | 334 ->software_mirroring_display_list(); |
| 335 auto iter = std::find_if( | 335 auto iter = std::find_if( |
| 336 list.begin(), list.end(), | 336 list.begin(), list.end(), |
| 337 [id](const gfx::Display& display) { return display.id() == id; }); | 337 [id](const gfx::Display& display) { return display.id() == id; }); |
| 338 DCHECK(iter != list.end()); | 338 DCHECK(iter != list.end()); |
| 339 if (iter != list.end()) | 339 if (iter != list.end()) |
| 340 return *iter; | 340 return *iter; |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 return gfx::Display(); | 343 return gfx::Display(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 AshWindowTreeHost* MirrorWindowController::GetAshWindowTreeHostForDisplayId( | 346 AshWindowTreeHost* MirrorWindowController::GetAshWindowTreeHostForDisplayId( |
| 347 int64 id) { | 347 int64_t id) { |
| 348 CHECK_EQ(1u, mirroring_host_info_map_.count(id)); | 348 CHECK_EQ(1u, mirroring_host_info_map_.count(id)); |
| 349 return mirroring_host_info_map_[id]->ash_host.get(); | 349 return mirroring_host_info_map_[id]->ash_host.get(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 aura::Window::Windows MirrorWindowController::GetAllRootWindows() const { | 352 aura::Window::Windows MirrorWindowController::GetAllRootWindows() const { |
| 353 aura::Window::Windows root_windows; | 353 aura::Window::Windows root_windows; |
| 354 for (const auto& pair : mirroring_host_info_map_) | 354 for (const auto& pair : mirroring_host_info_map_) |
| 355 root_windows.push_back(pair.second->ash_host->AsWindowTreeHost()->window()); | 355 root_windows.push_back(pair.second->ash_host->AsWindowTreeHost()->window()); |
| 356 return root_windows; | 356 return root_windows; |
| 357 } | 357 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 375 // EventProcessor may be accessed after this call if the mirroring window | 375 // 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 | 376 // was deleted as a result of input event (e.g. shortcut), so don't delete |
| 377 // now. | 377 // now. |
| 378 if (delay_host_deletion) | 378 if (delay_host_deletion) |
| 379 base::MessageLoop::current()->DeleteSoon(FROM_HERE, host_info); | 379 base::MessageLoop::current()->DeleteSoon(FROM_HERE, host_info); |
| 380 else | 380 else |
| 381 delete host_info; | 381 delete host_info; |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace ash | 384 } // namespace ash |
| OLD | NEW |