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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
13 #include "ash/desktop_background/desktop_background_widget_controller.h" | 13 #include "ash/desktop_background/desktop_background_widget_controller.h" |
14 #include "ash/desktop_background/user_wallpaper_delegate.h" | 14 #include "ash/desktop_background/user_wallpaper_delegate.h" |
15 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
16 #include "ash/focus_cycler.h" | 16 #include "ash/focus_cycler.h" |
17 #include "ash/high_contrast/high_contrast_controller.h" | 17 #include "ash/high_contrast/high_contrast_controller.h" |
18 #include "ash/host/ash_window_tree_host.h" | 18 #include "ash/host/ash_window_tree_host.h" |
19 #include "ash/root_window_settings.h" | 19 #include "ash/root_window_settings.h" |
20 #include "ash/session/session_state_delegate.h" | 20 #include "ash/session/session_state_delegate.h" |
21 #include "ash/shelf/shelf_layout_manager.h" | 21 #include "ash/shelf/shelf_layout_manager.h" |
22 #include "ash/shelf/shelf_types.h" | 22 #include "ash/shelf/shelf_types.h" |
23 #include "ash/shelf/shelf_widget.h" | 23 #include "ash/shelf/shelf_widget.h" |
24 #include "ash/shell.h" | 24 #include "ash/shell.h" |
25 #include "ash/shell_delegate.h" | 25 #include "ash/shell_delegate.h" |
26 #include "ash/shell_factory.h" | 26 #include "ash/shell_factory.h" |
27 #include "ash/shell_window_ids.h" | 27 #include "ash/shell_window_ids.h" |
28 #include "ash/switchable_windows.h" | |
29 #include "ash/system/status_area_widget.h" | 28 #include "ash/system/status_area_widget.h" |
30 #include "ash/system/tray/system_tray_delegate.h" | 29 #include "ash/system/tray/system_tray_delegate.h" |
31 #include "ash/system/tray/system_tray_notifier.h" | 30 #include "ash/system/tray/system_tray_notifier.h" |
32 #include "ash/touch/touch_hud_debug.h" | 31 #include "ash/touch/touch_hud_debug.h" |
33 #include "ash/touch/touch_hud_projection.h" | 32 #include "ash/touch/touch_hud_projection.h" |
34 #include "ash/touch/touch_observer_hud.h" | 33 #include "ash/touch/touch_observer_hud.h" |
35 #include "ash/wm/always_on_top_controller.h" | 34 #include "ash/wm/always_on_top_controller.h" |
36 #include "ash/wm/aura/aura_layout_manager_adapter.h" | 35 #include "ash/wm/aura/aura_layout_manager_adapter.h" |
37 #include "ash/wm/aura/wm_shelf_aura.h" | 36 #include "ash/wm/aura/wm_shelf_aura.h" |
38 #include "ash/wm/aura/wm_window_aura.h" | 37 #include "ash/wm/aura/wm_window_aura.h" |
39 #include "ash/wm/common/dock/docked_window_layout_manager.h" | 38 #include "ash/wm/common/dock/docked_window_layout_manager.h" |
| 39 #include "ash/wm/common/fullscreen_window_finder.h" |
| 40 #include "ash/wm/common/switchable_windows.h" |
40 #include "ash/wm/common/window_state.h" | 41 #include "ash/wm/common/window_state.h" |
41 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h" | 42 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h" |
42 #include "ash/wm/lock_layout_manager.h" | 43 #include "ash/wm/lock_layout_manager.h" |
43 #include "ash/wm/panels/attached_panel_window_targeter.h" | 44 #include "ash/wm/panels/attached_panel_window_targeter.h" |
44 #include "ash/wm/panels/panel_layout_manager.h" | 45 #include "ash/wm/panels/panel_layout_manager.h" |
45 #include "ash/wm/panels/panel_window_event_handler.h" | 46 #include "ash/wm/panels/panel_window_event_handler.h" |
46 #include "ash/wm/root_window_layout_manager.h" | 47 #include "ash/wm/root_window_layout_manager.h" |
47 #include "ash/wm/stacking_controller.h" | 48 #include "ash/wm/stacking_controller.h" |
48 #include "ash/wm/status_area_layout_manager.h" | 49 #include "ash/wm/status_area_layout_manager.h" |
49 #include "ash/wm/system_background_controller.h" | 50 #include "ash/wm/system_background_controller.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 } | 617 } |
617 | 618 |
618 Shell::GetInstance()->UpdateShelfVisibility(); | 619 Shell::GetInstance()->UpdateShelfVisibility(); |
619 } | 620 } |
620 | 621 |
621 void RootWindowController::UpdateShelfVisibility() { | 622 void RootWindowController::UpdateShelfVisibility() { |
622 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 623 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
623 } | 624 } |
624 | 625 |
625 aura::Window* RootWindowController::GetWindowForFullscreenMode() { | 626 aura::Window* RootWindowController::GetWindowForFullscreenMode() { |
626 aura::Window* topmost_window = NULL; | 627 return wm::WmWindowAura::GetAuraWindow( |
627 aura::Window* active_window = wm::GetActiveWindow(); | 628 wm::GetWindowForFullscreenMode(wm::WmWindowAura::Get(GetRootWindow()))); |
628 if (active_window && active_window->GetRootWindow() == GetRootWindow() && | |
629 IsSwitchableContainer(active_window->parent())) { | |
630 // Use the active window when it is on the current root window to determine | |
631 // the fullscreen state to allow temporarily using a panel or docked window | |
632 // (which are always above the default container) while a fullscreen | |
633 // window is open. We only use the active window when in a switchable | |
634 // container as the launcher should not exit fullscreen mode. | |
635 topmost_window = active_window; | |
636 } else { | |
637 // Otherwise, use the topmost window on the root window's default container | |
638 // when there is no active window on this root window. | |
639 const aura::Window::Windows& windows = | |
640 GetContainer(kShellWindowId_DefaultContainer)->children(); | |
641 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); | |
642 iter != windows.rend(); ++iter) { | |
643 if (wm::IsWindowUserPositionable(*iter) && | |
644 (*iter)->layer()->GetTargetVisibility()) { | |
645 topmost_window = *iter; | |
646 break; | |
647 } | |
648 } | |
649 } | |
650 while (topmost_window) { | |
651 if (wm::GetWindowState(topmost_window)->IsFullscreen()) | |
652 return topmost_window; | |
653 topmost_window = ::wm::GetTransientParent(topmost_window); | |
654 } | |
655 return NULL; | |
656 } | 629 } |
657 | 630 |
658 void RootWindowController::ActivateKeyboard( | 631 void RootWindowController::ActivateKeyboard( |
659 keyboard::KeyboardController* keyboard_controller) { | 632 keyboard::KeyboardController* keyboard_controller) { |
660 if (!keyboard::IsKeyboardEnabled() || | 633 if (!keyboard::IsKeyboardEnabled() || |
661 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 634 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
662 return; | 635 return; |
663 } | 636 } |
664 DCHECK(keyboard_controller); | 637 DCHECK(keyboard_controller); |
665 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 638 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 750 |
778 aura::Window* default_container = | 751 aura::Window* default_container = |
779 GetContainer(kShellWindowId_DefaultContainer); | 752 GetContainer(kShellWindowId_DefaultContainer); |
780 // Workspace manager has its own layout managers. | 753 // Workspace manager has its own layout managers. |
781 | 754 |
782 WorkspaceLayoutManagerDelegateImpl* workspace_layout_manager_delegate = | 755 WorkspaceLayoutManagerDelegateImpl* workspace_layout_manager_delegate = |
783 new WorkspaceLayoutManagerDelegateImpl(root_window); | 756 new WorkspaceLayoutManagerDelegateImpl(root_window); |
784 workspace_controller_.reset(new WorkspaceController( | 757 workspace_controller_.reset(new WorkspaceController( |
785 default_container, base::WrapUnique(workspace_layout_manager_delegate))); | 758 default_container, base::WrapUnique(workspace_layout_manager_delegate))); |
786 | 759 |
787 aura::Window* always_on_top_container = | 760 wm::WmWindow* always_on_top_container = |
788 GetContainer(kShellWindowId_AlwaysOnTopContainer); | 761 wm::WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer)); |
789 always_on_top_controller_.reset( | 762 always_on_top_controller_.reset( |
790 new AlwaysOnTopController(always_on_top_container)); | 763 new AlwaysOnTopController(always_on_top_container)); |
791 | 764 |
792 DCHECK(!shelf_.get()); | 765 DCHECK(!shelf_.get()); |
793 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); | 766 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); |
794 // TODO(harrym): Remove when status area is view. | 767 // TODO(harrym): Remove when status area is view. |
795 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); | 768 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); |
796 shelf_.reset(new ShelfWidget( | 769 shelf_.reset(new ShelfWidget( |
797 shelf_container, status_container, workspace_controller())); | 770 shelf_container, status_container, workspace_controller())); |
798 workspace_layout_manager_delegate->set_shelf(shelf_->shelf_layout_manager()); | 771 workspace_layout_manager_delegate->set_shelf(shelf_->shelf_layout_manager()); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 else | 1060 else |
1088 DisableTouchHudProjection(); | 1061 DisableTouchHudProjection(); |
1089 } | 1062 } |
1090 | 1063 |
1091 RootWindowController* GetRootWindowController( | 1064 RootWindowController* GetRootWindowController( |
1092 const aura::Window* root_window) { | 1065 const aura::Window* root_window) { |
1093 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1066 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
1094 } | 1067 } |
1095 | 1068 |
1096 } // namespace ash | 1069 } // namespace ash |
OLD | NEW |