summaryrefslogtreecommitdiffstats
path: root/ash/wm/overview
diff options
context:
space:
mode:
authorflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-13 22:05:56 +0000
committerflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-13 22:05:56 +0000
commitb2b46ac85b0fca2481e715a6181d3b448ed2da6c (patch)
tree15228bccd19f9115e0a3b00708db7c228b2a650d /ash/wm/overview
parentc0f759b1863f24bbcdd5679623a33380874cbb69 (diff)
downloadchromium_src-b2b46ac85b0fca2481e715a6181d3b448ed2da6c.zip
chromium_src-b2b46ac85b0fca2481e715a6181d3b448ed2da6c.tar.gz
chromium_src-b2b46ac85b0fca2481e715a6181d3b448ed2da6c.tar.bz2
Minimize panels on entering fullscreen and exit fullscreen on selecting another window.
BUG=313919 TEST=WindowSelectorTest.FullscreenWindow, PanelLayoutManagerTest.PanelsHideAndRestoreWithShelf TEST=Navigate to a page using the fullscreen API (i.e. http://blogs.sitepointstatic.com/examples/tech/full-screen/index.html) and alt tab from the fullscreen window. You should be able to switch to another window or a panel which was previously open. Review URL: https://codereview.chromium.org/64853007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/overview')
-rw-r--r--ash/wm/overview/window_selector.cc2
-rw-r--r--ash/wm/overview/window_selector_controller.cc15
-rw-r--r--ash/wm/overview/window_selector_unittest.cc33
3 files changed, 49 insertions, 1 deletions
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index a7818f5..8015f77 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -347,11 +347,11 @@ void WindowSelector::Step(WindowSelector::Direction direction) {
}
void WindowSelector::SelectWindow() {
- ResetFocusRestoreWindow(false);
SelectWindow(windows_[selected_window_]->SelectionWindow());
}
void WindowSelector::SelectWindow(aura::Window* window) {
+ ResetFocusRestoreWindow(false);
if (showing_window_ && showing_window_->window() == window)
showing_window_->CancelRestore();
ScopedVector<WindowSelectorItem>::iterator iter =
diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc
index d56c463..e5ca77d 100644
--- a/ash/wm/overview/window_selector_controller.cc
+++ b/ash/wm/overview/window_selector_controller.cc
@@ -4,13 +4,16 @@
#include "ash/wm/overview/window_selector_controller.h"
+#include "ash/root_window_controller.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector.h"
+#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "base/metrics/histogram.h"
+#include "ui/aura/window.h"
namespace ash {
@@ -69,6 +72,18 @@ bool WindowSelectorController::IsSelecting() {
void WindowSelectorController::OnWindowSelected(aura::Window* window) {
window_selector_.reset();
+
+ // If there is a fullscreen window on this display and it was not selected
+ // it should exit fullscreen mode.
+ internal::RootWindowController* controller =
+ internal::GetRootWindowController(window->GetRootWindow());
+ aura::Window* fullscreen_window = NULL;
+ if (controller)
+ fullscreen_window = controller->GetTopmostFullscreenWindow();
+ if (fullscreen_window && fullscreen_window != window) {
+ wm::GetWindowState(fullscreen_window)->ToggleFullscreen();
+ }
+
wm::ActivateWindow(window);
last_selection_time_ = base::Time::Now();
}
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index 38916fd..29c8cc7 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -259,6 +259,39 @@ TEST_F(WindowSelectorTest, Basic) {
EXPECT_FALSE(aura::client::GetCursorClient(root_window)->IsCursorLocked());
}
+// Tests entering overview mode with two windows and selecting one.
+TEST_F(WindowSelectorTest, FullscreenWindow) {
+ gfx::Rect bounds(0, 0, 400, 400);
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds));
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds));
+ wm::ActivateWindow(window1.get());
+
+ wm::GetWindowState(window1.get())->ToggleFullscreen();
+ // The panel is hidden in fullscreen mode.
+ EXPECT_FALSE(panel1->IsVisible());
+ EXPECT_TRUE(wm::GetWindowState(window1.get())->IsFullscreen());
+
+ // Enter overview and select the fullscreen window.
+ ToggleOverview();
+
+ // The panel becomes temporarily visible for the overview.
+ EXPECT_TRUE(panel1->IsVisible());
+ ClickWindow(window1.get());
+
+ // The window is still fullscreen as it was selected. The panel should again
+ // be hidden.
+ EXPECT_TRUE(wm::GetWindowState(window1.get())->IsFullscreen());
+ EXPECT_FALSE(panel1->IsVisible());
+
+ // Entering overview and selecting another window should exit fullscreen.
+ // TODO(flackr): Currently the panel remains hidden, but should become visible
+ // again.
+ ToggleOverview();
+ ClickWindow(window2.get());
+ EXPECT_FALSE(wm::GetWindowState(window1.get())->IsFullscreen());
+}
+
// Tests that the shelf dimming state is removed while in overview and restored
// on exiting overview.
TEST_F(WindowSelectorTest, OverviewUndimsShelf) {