| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 AshWindowTreeHost* host = GetAshWindowTreeHostForDisplayId(id); | 349 AshWindowTreeHost* host = GetAshWindowTreeHostForDisplayId(id); |
| 350 return host ? GetWindow(host) : nullptr; | 350 return host ? GetWindow(host) : nullptr; |
| 351 } | 351 } |
| 352 | 352 |
| 353 AshWindowTreeHost* WindowTreeHostManager::GetAshWindowTreeHostForDisplayId( | 353 AshWindowTreeHost* WindowTreeHostManager::GetAshWindowTreeHostForDisplayId( |
| 354 int64_t display_id) { | 354 int64_t display_id) { |
| 355 const auto host = window_tree_hosts_.find(display_id); | 355 const auto host = window_tree_hosts_.find(display_id); |
| 356 return host == window_tree_hosts_.end() ? nullptr : host->second; | 356 return host == window_tree_hosts_.end() ? nullptr : host->second; |
| 357 } | 357 } |
| 358 | 358 |
| 359 void WindowTreeHostManager::CloseChildWindows() { | |
| 360 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); | |
| 361 it != window_tree_hosts_.end(); ++it) { | |
| 362 aura::Window* root_window = GetWindow(it->second); | |
| 363 RootWindowController* controller = GetRootWindowController(root_window); | |
| 364 if (controller) { | |
| 365 controller->CloseChildWindows(); | |
| 366 } else { | |
| 367 while (!root_window->children().empty()) { | |
| 368 aura::Window* child = root_window->children()[0]; | |
| 369 delete child; | |
| 370 } | |
| 371 } | |
| 372 } | |
| 373 } | |
| 374 | |
| 375 aura::Window::Windows WindowTreeHostManager::GetAllRootWindows() { | 359 aura::Window::Windows WindowTreeHostManager::GetAllRootWindows() { |
| 376 aura::Window::Windows windows; | 360 aura::Window::Windows windows; |
| 377 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); | 361 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); |
| 378 it != window_tree_hosts_.end(); ++it) { | 362 it != window_tree_hosts_.end(); ++it) { |
| 379 DCHECK(it->second); | 363 DCHECK(it->second); |
| 380 if (GetRootWindowController(GetWindow(it->second))) | 364 if (GetRootWindowController(GetWindow(it->second))) |
| 381 windows.push_back(GetWindow(it->second)); | 365 windows.push_back(GetWindow(it->second)); |
| 382 } | 366 } |
| 383 return windows; | 367 return windows; |
| 384 } | 368 } |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 870 |
| 887 window_tree_hosts_[display.id()] = ash_host; | 871 window_tree_hosts_[display.id()] = ash_host; |
| 888 SetDisplayPropertiesOnHost(ash_host, display); | 872 SetDisplayPropertiesOnHost(ash_host, display); |
| 889 | 873 |
| 890 if (switches::ConstrainPointerToRoot()) | 874 if (switches::ConstrainPointerToRoot()) |
| 891 ash_host->ConfineCursorToRootWindow(); | 875 ash_host->ConfineCursorToRootWindow(); |
| 892 return ash_host; | 876 return ash_host; |
| 893 } | 877 } |
| 894 | 878 |
| 895 } // namespace ash | 879 } // namespace ash |
| OLD | NEW |