Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: chrome/browser/ui/window_sizer/window_sizer_ash.cc

Issue 11072002: Combined window positioning and show state determiniation in the WindowSizer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f548c38729999825b61f5a4d3c15293ca01493e9 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash.cc
@@ -120,11 +120,13 @@ 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 {
*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 +135,22 @@ 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_ && 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();

Powered by Google App Engine
This is Rietveld 408576698