Chromium Code Reviews| Index: chrome/browser/ui/window_sizer/window_sizer_ash.cc |
| diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash.cc b/chrome/browser/ui/window_sizer/window_sizer_ash.cc |
| index 3b0ac138fcd905227989112182d9eecf0ba1cb0e..7dd6f869eb65ceba46ddfde72a77e07c0e868b9a 100644 |
| --- a/chrome/browser/ui/window_sizer/window_sizer_ash.cc |
| +++ b/chrome/browser/ui/window_sizer/window_sizer_ash.cc |
| @@ -120,11 +120,15 @@ bool MoveRect(const gfx::Rect& work_area, |
| } // namespace |
| bool WindowSizer::GetBoundsOverrideAsh(const gfx::Rect& specified_bounds, |
| - gfx::Rect* bounds_in_screen) const { |
| + gfx::Rect* bounds_in_screen, |
| + ui::WindowShowState* show_state) const { |
| + DCHECK(show_state); |
| + DCHECK(bounds_in_screen); |
| *bounds_in_screen = specified_bounds; |
| DCHECK(bounds_in_screen->IsEmpty()); |
| - if (!GetSavedWindowBounds(bounds_in_screen)) |
| + ui::WindowShowState passed_show_state = *show_state; |
| + if (!GetSavedWindowBounds(bounds_in_screen, show_state)) |
| GetDefaultWindowBounds(bounds_in_screen); |
| if (browser_ && browser_->is_type_tabbed()) { |
| @@ -133,9 +137,23 @@ bool WindowSizer::GetBoundsOverrideAsh(const gfx::Rect& specified_bounds, |
| // This is a window / app. See if there is no window and try to place it. |
| int count = GetNumberOfValidTopLevelBrowserWindows(work_area); |
| aura::Window* top_window = GetTopWindow(work_area); |
| - |
| + // The window should not be able to reflect on itself. |
| + if (browser_ && browser_->window() && |
|
sky
2012/10/08 21:01:25
browser_ check is handled on 134.
Mr4D (OOO till 08-26)
2012/10/08 23:04:27
Done.
|
| + top_window == browser_->window()->GetNativeWindow()) |
| + return true; |
| // If there is no valid other window we take the coordinates as is. |
| - if (!count || !top_window || ash::wm::IsWindowMaximized(top_window)) |
| + if (!count || !top_window) |
| + return true; |
| + |
| + bool maximized = ash::wm::IsWindowMaximized(top_window); |
| + // We ignore the saved show state, but look instead for the top level |
| + // window's show state. |
| + if (passed_show_state == ui::SHOW_STATE_DEFAULT) { |
| + *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED : |
| + ui::SHOW_STATE_DEFAULT; |
| + } |
| + |
| + if (maximized) |
| return true; |
| gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen(); |