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/root_window_settings.h" | 18 #include "ash/root_window_settings.h" |
19 #include "ash/session_state_delegate.h" | 19 #include "ash/session_state_delegate.h" |
20 #include "ash/shelf/shelf_layout_manager.h" | 20 #include "ash/shelf/shelf_layout_manager.h" |
21 #include "ash/shelf/shelf_types.h" | 21 #include "ash/shelf/shelf_types.h" |
22 #include "ash/shelf/shelf_widget.h" | 22 #include "ash/shelf/shelf_widget.h" |
23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
24 #include "ash/shell_delegate.h" | 24 #include "ash/shell_delegate.h" |
25 #include "ash/shell_factory.h" | 25 #include "ash/shell_factory.h" |
26 #include "ash/shell_window_ids.h" | 26 #include "ash/shell_window_ids.h" |
| 27 #include "ash/switchable_windows.h" |
27 #include "ash/system/status_area_widget.h" | 28 #include "ash/system/status_area_widget.h" |
28 #include "ash/system/tray/system_tray_delegate.h" | 29 #include "ash/system/tray/system_tray_delegate.h" |
29 #include "ash/touch/touch_hud_debug.h" | 30 #include "ash/touch/touch_hud_debug.h" |
30 #include "ash/touch/touch_hud_projection.h" | 31 #include "ash/touch/touch_hud_projection.h" |
31 #include "ash/touch/touch_observer_hud.h" | 32 #include "ash/touch/touch_observer_hud.h" |
32 #include "ash/wm/always_on_top_controller.h" | 33 #include "ash/wm/always_on_top_controller.h" |
33 #include "ash/wm/dock/docked_window_layout_manager.h" | 34 #include "ash/wm/dock/docked_window_layout_manager.h" |
34 #include "ash/wm/panels/panel_layout_manager.h" | 35 #include "ash/wm/panels/panel_layout_manager.h" |
35 #include "ash/wm/panels/panel_window_event_handler.h" | 36 #include "ash/wm/panels/panel_window_event_handler.h" |
36 #include "ash/wm/root_window_layout_manager.h" | 37 #include "ash/wm/root_window_layout_manager.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 564 } |
564 | 565 |
565 Shell::GetInstance()->UpdateShelfVisibility(); | 566 Shell::GetInstance()->UpdateShelfVisibility(); |
566 } | 567 } |
567 | 568 |
568 void RootWindowController::UpdateShelfVisibility() { | 569 void RootWindowController::UpdateShelfVisibility() { |
569 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 570 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
570 } | 571 } |
571 | 572 |
572 const aura::Window* RootWindowController::GetWindowForFullscreenMode() const { | 573 const aura::Window* RootWindowController::GetWindowForFullscreenMode() const { |
573 const aura::Window::Windows& windows = | |
574 GetContainer(kShellWindowId_DefaultContainer)->children(); | |
575 const aura::Window* topmost_window = NULL; | 574 const aura::Window* topmost_window = NULL; |
576 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); | 575 const aura::Window* active_window = wm::GetActiveWindow(); |
577 iter != windows.rend(); ++iter) { | 576 if (active_window && active_window->GetRootWindow() == root_window() && |
578 if (((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL || | 577 IsSwitchableContainer(active_window->parent())) { |
579 (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) && | 578 // Use the active window when it is on the current root window to determine |
580 (*iter)->layer()->GetTargetVisibility()) { | 579 // the fullscreen state to allow temporarily using a panel or docked window |
581 topmost_window = *iter; | 580 // (which are always above the default container) while a fullscreen |
582 break; | 581 // window is open. We only use the active window when in a switchable |
| 582 // container as the launcher should not exit fullscreen mode. |
| 583 topmost_window = active_window; |
| 584 } else { |
| 585 // Otherwise, use the topmost window on the root window's default container |
| 586 // when there is no active window on this root window. |
| 587 const aura::Window::Windows& windows = |
| 588 GetContainer(kShellWindowId_DefaultContainer)->children(); |
| 589 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); |
| 590 iter != windows.rend(); ++iter) { |
| 591 if (((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL || |
| 592 (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) && |
| 593 (*iter)->layer()->GetTargetVisibility()) { |
| 594 topmost_window = *iter; |
| 595 break; |
| 596 } |
583 } | 597 } |
584 } | 598 } |
585 while (topmost_window) { | 599 while (topmost_window) { |
586 if (wm::GetWindowState(topmost_window)->IsFullscreen()) | 600 if (wm::GetWindowState(topmost_window)->IsFullscreen()) |
587 return topmost_window; | 601 return topmost_window; |
588 topmost_window = views::corewm::GetTransientParent(topmost_window); | 602 topmost_window = views::corewm::GetTransientParent(topmost_window); |
589 } | 603 } |
590 return NULL; | 604 return NULL; |
591 } | 605 } |
592 | 606 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 DisableTouchHudProjection(); | 994 DisableTouchHudProjection(); |
981 } | 995 } |
982 | 996 |
983 RootWindowController* GetRootWindowController( | 997 RootWindowController* GetRootWindowController( |
984 const aura::Window* root_window) { | 998 const aura::Window* root_window) { |
985 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 999 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
986 } | 1000 } |
987 | 1001 |
988 } // namespace internal | 1002 } // namespace internal |
989 } // namespace ash | 1003 } // namespace ash |
OLD | NEW |