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 <utility> | 10 #include <utility> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "ash/screen_util.h" | 26 #include "ash/screen_util.h" |
27 #include "ash/shell.h" | 27 #include "ash/shell.h" |
28 #include "ash/shell_delegate.h" | 28 #include "ash/shell_delegate.h" |
29 #include "ash/system/tray/system_tray.h" | 29 #include "ash/system/tray/system_tray.h" |
30 #include "ash/wm/coordinate_conversion.h" | 30 #include "ash/wm/coordinate_conversion.h" |
31 #include "ash/wm/window_util.h" | 31 #include "ash/wm/window_util.h" |
32 #include "base/command_line.h" | 32 #include "base/command_line.h" |
33 #include "base/stl_util.h" | 33 #include "base/stl_util.h" |
34 #include "base/strings/stringprintf.h" | 34 #include "base/strings/stringprintf.h" |
35 #include "base/strings/utf_string_conversions.h" | 35 #include "base/strings/utf_string_conversions.h" |
| 36 #include "base/thread_task_runner_handle.h" |
36 #include "ui/aura/client/capture_client.h" | 37 #include "ui/aura/client/capture_client.h" |
37 #include "ui/aura/client/focus_client.h" | 38 #include "ui/aura/client/focus_client.h" |
38 #include "ui/aura/client/screen_position_client.h" | 39 #include "ui/aura/client/screen_position_client.h" |
39 #include "ui/aura/window.h" | 40 #include "ui/aura/window.h" |
40 #include "ui/aura/window_event_dispatcher.h" | 41 #include "ui/aura/window_event_dispatcher.h" |
41 #include "ui/aura/window_property.h" | 42 #include "ui/aura/window_property.h" |
42 #include "ui/aura/window_tracker.h" | 43 #include "ui/aura/window_tracker.h" |
43 #include "ui/aura/window_tree_host.h" | 44 #include "ui/aura/window_tree_host.h" |
44 #include "ui/base/ime/input_method_factory.h" | 45 #include "ui/base/ime/input_method_factory.h" |
45 #include "ui/compositor/compositor.h" | 46 #include "ui/compositor/compositor.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 636 |
636 void WindowTreeHostManager::DeleteHost(AshWindowTreeHost* host_to_delete) { | 637 void WindowTreeHostManager::DeleteHost(AshWindowTreeHost* host_to_delete) { |
637 ClearDisplayPropertiesOnHost(host_to_delete); | 638 ClearDisplayPropertiesOnHost(host_to_delete); |
638 RootWindowController* controller = | 639 RootWindowController* controller = |
639 GetRootWindowController(GetWindow(host_to_delete)); | 640 GetRootWindowController(GetWindow(host_to_delete)); |
640 DCHECK(controller); | 641 DCHECK(controller); |
641 controller->MoveWindowsTo(GetPrimaryRootWindow()); | 642 controller->MoveWindowsTo(GetPrimaryRootWindow()); |
642 // Delete most of root window related objects, but don't delete | 643 // Delete most of root window related objects, but don't delete |
643 // root window itself yet because the stack may be using it. | 644 // root window itself yet because the stack may be using it. |
644 controller->Shutdown(); | 645 controller->Shutdown(); |
645 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); | 646 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, controller); |
646 } | 647 } |
647 | 648 |
648 void WindowTreeHostManager::OnDisplayRemoved(const gfx::Display& display) { | 649 void WindowTreeHostManager::OnDisplayRemoved(const gfx::Display& display) { |
649 AshWindowTreeHost* host_to_delete = window_tree_hosts_[display.id()]; | 650 AshWindowTreeHost* host_to_delete = window_tree_hosts_[display.id()]; |
650 CHECK(host_to_delete) << display.ToString(); | 651 CHECK(host_to_delete) << display.ToString(); |
651 | 652 |
652 // When the primary root window's display is removed, move the primary | 653 // When the primary root window's display is removed, move the primary |
653 // root to the other display. | 654 // root to the other display. |
654 if (primary_display_id == display.id()) { | 655 if (primary_display_id == display.id()) { |
655 // Temporarily store the primary root window in | 656 // Temporarily store the primary root window in |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 SetDisplayPropertiesOnHost(ash_host, display); | 834 SetDisplayPropertiesOnHost(ash_host, display); |
834 | 835 |
835 #if defined(OS_CHROMEOS) | 836 #if defined(OS_CHROMEOS) |
836 if (switches::ConstrainPointerToRoot()) | 837 if (switches::ConstrainPointerToRoot()) |
837 ash_host->ConfineCursorToRootWindow(); | 838 ash_host->ConfineCursorToRootWindow(); |
838 #endif | 839 #endif |
839 return ash_host; | 840 return ash_host; |
840 } | 841 } |
841 | 842 |
842 } // namespace ash | 843 } // namespace ash |
OLD | NEW |