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" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 563 } |
564 | 564 |
565 Shell::GetInstance()->UpdateShelfVisibility(); | 565 Shell::GetInstance()->UpdateShelfVisibility(); |
566 } | 566 } |
567 | 567 |
568 void RootWindowController::UpdateShelfVisibility() { | 568 void RootWindowController::UpdateShelfVisibility() { |
569 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 569 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
570 } | 570 } |
571 | 571 |
572 const aura::Window* RootWindowController::GetWindowForFullscreenMode() const { | 572 const aura::Window* RootWindowController::GetWindowForFullscreenMode() const { |
573 const aura::Window::Windows& windows = | |
574 GetContainer(kShellWindowId_DefaultContainer)->children(); | |
575 const aura::Window* topmost_window = NULL; | 573 const aura::Window* topmost_window = NULL; |
576 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); | 574 const aura::Window* active_window = wm::GetActiveWindow(); |
577 iter != windows.rend(); ++iter) { | 575 if (active_window && active_window->GetRootWindow() == root_window()) { |
578 if (((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL || | 576 // Use the active window when it is on the current root window to determine |
579 (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) && | 577 // the fullscreen state to allow temporarily using a panel or docked window |
580 (*iter)->layer()->GetTargetVisibility()) { | 578 // (which are always above the default container) while a fullscreen |
581 topmost_window = *iter; | 579 // window is open. |
582 break; | 580 topmost_window = active_window; |
| 581 } else { |
| 582 // Otherwise, use the topmost window on the root window's default container |
| 583 // when there is no active window on this root window. |
| 584 const aura::Window::Windows& windows = |
| 585 GetContainer(kShellWindowId_DefaultContainer)->children(); |
| 586 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); |
| 587 iter != windows.rend(); ++iter) { |
| 588 if (((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL || |
| 589 (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) && |
| 590 (*iter)->layer()->GetTargetVisibility()) { |
| 591 topmost_window = *iter; |
| 592 break; |
| 593 } |
583 } | 594 } |
584 } | 595 } |
585 while (topmost_window) { | 596 while (topmost_window) { |
586 if (wm::GetWindowState(topmost_window)->IsFullscreen()) | 597 if (wm::GetWindowState(topmost_window)->IsFullscreen()) |
587 return topmost_window; | 598 return topmost_window; |
588 topmost_window = views::corewm::GetTransientParent(topmost_window); | 599 topmost_window = views::corewm::GetTransientParent(topmost_window); |
589 } | 600 } |
590 return NULL; | 601 return NULL; |
591 } | 602 } |
592 | 603 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 DisableTouchHudProjection(); | 991 DisableTouchHudProjection(); |
981 } | 992 } |
982 | 993 |
983 RootWindowController* GetRootWindowController( | 994 RootWindowController* GetRootWindowController( |
984 const aura::Window* root_window) { | 995 const aura::Window* root_window) { |
985 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 996 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
986 } | 997 } |
987 | 998 |
988 } // namespace internal | 999 } // namespace internal |
989 } // namespace ash | 1000 } // namespace ash |
OLD | NEW |