| Index: ash/root_window_controller.cc
|
| diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
|
| index cd246364601336c1fd821b6108aee89c0a5f5876..bbcbd1ff4a98de57948a472c0709afbb36c60a87 100644
|
| --- a/ash/root_window_controller.cc
|
| +++ b/ash/root_window_controller.cc
|
| @@ -32,6 +32,7 @@
|
| #include "ash/wm/always_on_top_controller.h"
|
| #include "ash/wm/base_layout_manager.h"
|
| #include "ash/wm/dock/docked_window_layout_manager.h"
|
| +#include "ash/wm/mru_window_tracker.h"
|
| #include "ash/wm/panels/panel_layout_manager.h"
|
| #include "ash/wm/panels/panel_window_event_handler.h"
|
| #include "ash/wm/root_window_layout_manager.h"
|
| @@ -570,18 +571,20 @@ void RootWindowController::UpdateShelfVisibility() {
|
| }
|
|
|
| const aura::Window* RootWindowController::GetWindowForFullscreenMode() const {
|
| - const aura::Window::Windows& windows =
|
| - GetContainer(kShellWindowId_DefaultContainer)->children();
|
| const aura::Window* topmost_window = NULL;
|
| - for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin();
|
| - iter != windows.rend(); ++iter) {
|
| - if (((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL ||
|
| - (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) &&
|
| - (*iter)->layer()->GetTargetVisibility()) {
|
| - topmost_window = *iter;
|
| - break;
|
| - }
|
| - }
|
| + // If the active window is on the current root window, prefer to use that as
|
| + // the most recently used window list does not include windows from all
|
| + // containers such as the laucher.
|
| + const aura::Window* active_window = ash::wm::GetActiveWindow();
|
| + if (active_window && active_window->GetRootWindow() == root_window()) {
|
| + topmost_window = active_window;
|
| + } else if (Shell::GetInstance()->mru_window_tracker()) {
|
| + topmost_window = Shell::GetInstance()->mru_window_tracker()->
|
| + GetMruWindowInRoot(root_window());
|
| + }
|
| +
|
| + // If any transient parent of the active window is fullscreen the root
|
| + // window should remain in fullscreen mode.
|
| while (topmost_window) {
|
| if (wm::GetWindowState(topmost_window)->IsFullscreen())
|
| return topmost_window;
|
|
|