views: Support configuration of initial window show state

Known issues:
- Exiting full-screen mode currently crashes with the Chrome runtime
  (see issue #3182).
This commit is contained in:
Marshall Greenblatt
2021-09-07 17:04:55 +03:00
parent 2b40cab3fe
commit dc1f934865
16 changed files with 147 additions and 17 deletions

View File

@ -287,7 +287,7 @@ index db1299089169f..a9c331c37b210 100644
// a reference.
corewm::TooltipWin* tooltip_;
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
index 892f47b000354..e17a309bd4174 100644
index 892f47b000354..03efc840206d5 100644
--- ui/views/widget/widget.cc
+++ ui/views/widget/widget.cc
@@ -359,7 +359,8 @@ void Widget::Init(InitParams params) {
@ -300,7 +300,16 @@ index 892f47b000354..e17a309bd4174 100644
if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred &&
params.type != views::Widget::InitParams::TYPE_WINDOW) {
@@ -441,7 +442,12 @@ void Widget::Init(InitParams params) {
@@ -435,13 +436,21 @@ void Widget::Init(InitParams params) {
if (show_state == ui::SHOW_STATE_MAXIMIZED) {
Maximize();
+ saved_show_state_ = ui::SHOW_STATE_MAXIMIZED;
} else if (show_state == ui::SHOW_STATE_MINIMIZED) {
Minimize();
saved_show_state_ = ui::SHOW_STATE_MINIMIZED;
+ } else if (show_state == ui::SHOW_STATE_FULLSCREEN) {
+ SetFullscreen(true);
}
} else if (delegate) {
SetContentsView(delegate->TransferOwnershipOfContentsView());
@ -314,7 +323,7 @@ index 892f47b000354..e17a309bd4174 100644
}
native_theme_observation_.Observe(GetNativeTheme());
@@ -1421,10 +1427,16 @@ void Widget::OnNativeWidgetDestroyed() {
@@ -1421,10 +1430,16 @@ void Widget::OnNativeWidgetDestroyed() {
}
gfx::Size Widget::GetMinimumSize() const {