AddChildView(web_view_);
#if defined(OS_WIN)
- // Save initial window state.
- if (fullscreen)
- last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
- else
- last_window_state_ = ui::SHOW_STATE_NORMAL;
- last_normal_size_ = widget_size_;
-
if (!has_frame()) {
// Set Window style so that we get a minimize and maximize animation when
// frameless.
window_->CenterWindow(size);
Layout();
+
+#if defined(OS_WIN)
+ // Save initial window state.
+ if (fullscreen)
+ last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
+ else
+ last_window_state_ = ui::SHOW_STATE_NORMAL;
+ last_normal_bounds_ = GetBounds();
+#endif
}
NativeWindowViews::~NativeWindowViews() {
#if defined(OS_WIN)
// For window without WS_THICKFRAME style, we can not call Maximize().
if (!thick_frame_) {
- last_normal_size_ = GetSize();
+ last_normal_bounds_ = GetBounds();
auto display =
gfx::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
SetBounds(display.work_area(), false);
void NativeWindowViews::Unmaximize() {
#if defined(OS_WIN)
if (!thick_frame_) {
- NativeWindow::SetSize(last_normal_size_);
+ SetBounds(last_normal_bounds_, false);
return;
}
#endif
// For window without WS_THICKFRAME style, we can not call SetFullscreen().
if (!thick_frame_) {
if (fullscreen) {
- last_normal_size_ = GetSize();
+ last_normal_bounds_ = GetBounds();
auto display =
gfx::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
SetBounds(display.bounds(), false);
} else {
- NativeWindow::SetSize(last_normal_size_);
+ SetBounds(last_normal_bounds_, false);
}
return;
}
// to receive the wrong size (#2498). To circumvent that, we keep tabs on the
// size of the window while in the normal state (not maximized, minimized or
// fullscreen), so we restore it correctly.
- gfx::Size last_normal_size_;
+ gfx::Rect last_normal_bounds_;
// In charge of running taskbar related APIs.
TaskbarHost taskbar_host_;
case SIZE_RESTORED:
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
// Window was resized so we save it's new size.
- last_normal_size_ = GetSize();
+ last_normal_bounds_ = GetBounds();
} else {
switch (last_window_state_) {
case ui::SHOW_STATE_MAXIMIZED:
// When the window is restored we resize it to the previous known
// normal size.
- NativeWindow::SetSize(last_normal_size_);
+ SetBounds(last_normal_bounds_, false);
NotifyWindowUnmaximize();
break;
// When the window is restored we resize it to the previous known
// normal size.
- NativeWindow::SetSize(last_normal_size_);
+ SetBounds(last_normal_bounds_, false);
NotifyWindowRestore();
}