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

Unified Diff: ui/views/widget/widget.cc

Issue 1483083003: Set the window state consistently Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 6873cdef533fd482cec2b6a5d2a34a1692fb5bcb..26e407ae8d386c57e5b2f43305a49ddd6143821f 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -631,14 +631,17 @@ void Widget::Show() {
// While initializing, the kiosk mode will go to full screen before the
// widget gets shown. In that case we stay in full screen mode, regardless
// of the |saved_show_state_| member.
- if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED &&
- !initial_restored_bounds_.IsEmpty() &&
- !IsFullscreen()) {
+ if (((saved_show_state_ == ui::SHOW_STATE_MAXIMIZED && !IsFullscreen()) ||
+ IsMaximized()) &&
+ !initial_restored_bounds_.IsEmpty()) {
native_widget_->ShowMaximizedWithBounds(initial_restored_bounds_);
} else {
ui::WindowShowState show_state =
- IsFullscreen() ? ui::SHOW_STATE_FULLSCREEN :
- IsMinimized() ? ui::SHOW_STATE_MINIMIZED : saved_show_state_;
+ IsFullscreen()
+ ? ui::SHOW_STATE_FULLSCREEN
+ : (IsMaximized() ? ui::SHOW_STATE_MAXIMIZED
+ : (IsMinimized() ? ui::SHOW_STATE_MINIMIZED
+ : saved_show_state_));
native_widget_->ShowWithWindowState(show_state);
}
// |saved_show_state_| only applies the first time the window is shown.
@@ -1453,6 +1456,8 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) {
native_widget_->CenterWindow(non_client_view_->GetPreferredSize());
} else {
// Use the supplied initial bounds.
+ if (IsMaximized())
+ initial_restored_bounds_ = bounds;
SetBoundsConstrained(bounds);
}
}
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698