summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/views/window.cc13
-rw-r--r--chrome/views/window.h4
-rw-r--r--chrome/views/window_delegate.cc2
3 files changed, 16 insertions, 3 deletions
diff --git a/chrome/views/window.cc b/chrome/views/window.cc
index fb7d945..e5726c8 100644
--- a/chrome/views/window.cc
+++ b/chrome/views/window.cc
@@ -87,7 +87,7 @@ gfx::Size Window::CalculateMaximumSize() const {
void Window::Show() {
int show_state = GetShowState();
bool maximized = false;
- if (window_delegate_->GetSavedMaximizedState(&maximized) && maximized)
+ if (saved_maximized_state_)
show_state = SW_SHOWMAXIMIZED;
Show(show_state);
}
@@ -232,7 +232,8 @@ Window::Window(WindowDelegate* window_delegate)
restored_enabled_(false),
is_always_on_top_(false),
window_closed_(false),
- disable_inactive_rendering_(false) {
+ disable_inactive_rendering_(false),
+ saved_maximized_state_(0) {
InitClass();
DCHECK(window_delegate_);
window_delegate_->window_.reset(this);
@@ -468,6 +469,14 @@ void Window::SetInitialFocus() {
}
void Window::SetInitialBounds(const gfx::Rect& create_bounds) {
+ // First we obtain the window's saved show-style and store it. We need to do
+ // this here, rather than in Show() because by the time Show() is called,
+ // the window's size will have been reset (below) and the saved maximized
+ // state will have been lost. Sadly there's no way to tell on Windows when
+ // a window is restored from maximized state, so we can't more accurately
+ // track maximized state independently of sizing information.
+ window_delegate_->GetSavedMaximizedState(&saved_maximized_state_);
+
// Restore the window's placement from the controller.
gfx::Rect saved_bounds(create_bounds.ToRECT());
if (window_delegate_->GetSavedWindowBounds(&saved_bounds)) {
diff --git a/chrome/views/window.h b/chrome/views/window.h
index ad8f020..9758f9f 100644
--- a/chrome/views/window.h
+++ b/chrome/views/window.h
@@ -249,6 +249,10 @@ class Window : public ContainerWin {
// or not it actually is.
bool disable_inactive_rendering_;
+ // The saved maximized state for this window. See note in SetInitialBounds
+ // that explains why we save this.
+ bool saved_maximized_state_;
+
DISALLOW_EVIL_CONSTRUCTORS(Window);
};
diff --git a/chrome/views/window_delegate.cc b/chrome/views/window_delegate.cc
index 7ce676e..381ea14 100644
--- a/chrome/views/window_delegate.cc
+++ b/chrome/views/window_delegate.cc
@@ -57,7 +57,7 @@ bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const {
!dictionary->GetInteger(L"bottom", &bottom))
return false;
- bounds->SetRect(left, top, right, bottom);
+ bounds->SetRect(left, top, right - left, bottom - top);
return true;
}