From b19b09acc83a0384520764570f643dda129f804a Mon Sep 17 00:00:00 2001 From: "skuhne@chromium.org" Date: Wed, 26 Feb 2014 05:34:34 +0000 Subject: Adding hotkey behind a commandline to allow testing the TouchView maximizing mode. The flag and the hotkey is only temporary since there is no other way to test the TouchView functionality at this time. BUG=337563 TEST=visual Review URL: https://codereview.chromium.org/179063002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253369 0039d316-1c4b-4281-b951-d872f2087c98 --- .../maximize_mode/maximize_mode_window_manager.cc | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'ash/wm/maximize_mode/maximize_mode_window_manager.cc') diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/wm/maximize_mode/maximize_mode_window_manager.cc index 6360450..a265bdb 100644 --- a/ash/wm/maximize_mode/maximize_mode_window_manager.cc +++ b/ash/wm/maximize_mode/maximize_mode_window_manager.cc @@ -58,13 +58,11 @@ void MaximizeModeWindowManager::OnDisplayBoundsChanged( } void MaximizeModeWindowManager::OnDisplayAdded(const gfx::Display& display) { - RemoveWindowCreationObservers(); - AddWindowCreationObservers(); - + DisplayConfigurationChanged(); } + void MaximizeModeWindowManager::OnDisplayRemoved(const gfx::Display& display) { - RemoveWindowCreationObservers(); - AddWindowCreationObservers(); + DisplayConfigurationChanged(); } MaximizeModeWindowManager::MaximizeModeWindowManager() { @@ -133,14 +131,15 @@ void MaximizeModeWindowManager::RestoreAndForgetWindow( if (!CanMaximize(window)) { // TODO(skuhne): Remove the background cover layer. ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); - DCHECK(window_state->HasRestoreBounds()); - gfx::Rect initial_bounds = - window->parent() ? window_state->GetRestoreBoundsInParent() : - window_state->GetRestoreBoundsInScreen(); - window_state->ClearRestoreBounds(); - // TODO(skuhne): The screen might have changed and we should make it - // visible area again. - window->SetBounds(initial_bounds); + if (window_state->HasRestoreBounds()) { + gfx::Rect initial_bounds = + window->parent() ? window_state->GetRestoreBoundsInParent() : + window_state->GetRestoreBoundsInScreen(); + window_state->ClearRestoreBounds(); + // TODO(skuhne): The screen might have changed and we should make sure + // that the bounds are in a visible area. + window->SetBounds(initial_bounds); + } } else { // If the window neither was minimized or maximized and it is currently // not minimized, we restore it. @@ -213,6 +212,11 @@ void MaximizeModeWindowManager::RemoveWindowCreationObservers() { observed_container_windows_.clear(); } +void MaximizeModeWindowManager::DisplayConfigurationChanged() { + RemoveWindowCreationObservers(); + AddWindowCreationObservers(); +} + bool MaximizeModeWindowManager::IsContainerWindow(aura::Window* window) { return observed_container_windows_.find(window) != observed_container_windows_.end(); -- cgit v1.1