summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 21:11:01 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 21:11:01 +0000
commit2e71662080eac468322f9b61a81a3abb4c9d40bc (patch)
tree863408b851a33c57eeedd3bc788f1f8416a2ec02 /chrome
parent8bf80e9295fcc8166e103d3f4a5d1947619c525c (diff)
downloadchromium_src-2e71662080eac468322f9b61a81a3abb4c9d40bc.zip
chromium_src-2e71662080eac468322f9b61a81a3abb4c9d40bc.tar.gz
chromium_src-2e71662080eac468322f9b61a81a3abb4c9d40bc.tar.bz2
Fixes session restore bug where we wouldn't necessarily correctly
restore the maximized state. The problem was we were using a boolean when we really needed three values: use the default, explicitly maximized or explicitly normal. I'm also removing a bogus DLOG in info_bubble. BUG=7930 TEST=see bug Review URL: http://codereview.chromium.org/40306 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc13
-rw-r--r--chrome/browser/browser.h19
-rw-r--r--chrome/browser/sessions/session_restore.cc4
-rw-r--r--chrome/browser/views/info_bubble.cc1
4 files changed, 29 insertions, 8 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 4e21329..4de2951 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -174,7 +174,7 @@ Browser::Browser(Type type, Profile* profile)
toolbar_model_(this),
chrome_updater_factory_(this),
is_attempting_to_close_browser_(false),
- override_maximized_(false),
+ maximized_state_(MAXIMIZED_STATE_DEFAULT),
method_factory_(this),
idle_task_(new BrowserIdleTimer) {
tabstrip_model_.AddObserver(this);
@@ -376,8 +376,14 @@ bool Browser::GetSavedMaximizedState() const {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
return true;
+ if (maximized_state_ == MAXIMIZED_STATE_MAXIMIZED)
+ return true;
+ if (maximized_state_ == MAXIMIZED_STATE_UNMAXIMIZED)
+ return false;
+
+ // An explicit maximized state was not set. Query the window sizer.
gfx::Rect restored_bounds;
- bool maximized = override_maximized_;
+ bool maximized = false;
WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds,
&restored_bounds, &maximized);
return maximized;
@@ -1262,7 +1268,8 @@ void Browser::CreateNewStripWithContents(TabContents* detached_contents,
// Create an empty new browser window the same size as the old one.
Browser* browser = new Browser(TYPE_NORMAL, profile_);
browser->set_override_bounds(new_window_bounds);
- browser->set_override_maximized(maximize);
+ browser->set_maximized_state(
+ maximize ? MAXIMIZED_STATE_MAXIMIZED : MAXIMIZED_STATE_UNMAXIMIZED);
browser->CreateBrowserWindow();
browser->tabstrip_model()->AppendTabContents(detached_contents, true);
// Make sure the loading state is updated correctly, otherwise the throbber
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 5efbec8..dc9ebbd 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -68,6 +68,19 @@ class Browser : public TabStripModelDelegate,
FEATURE_DOWNLOADSHELF = 64
};
+ // Maximized state on creation.
+ enum MaximizedState {
+ // The maximized state is set to the default, which varies depending upon
+ // what the user has done.
+ MAXIMIZED_STATE_DEFAULT,
+
+ // Maximized state is explicitly maximized.
+ MAXIMIZED_STATE_MAXIMIZED,
+
+ // Maximized state is explicitly not maximized (normal).
+ MAXIMIZED_STATE_UNMAXIMIZED
+ };
+
// Constructors, Creation, Showing //////////////////////////////////////////
// Creates a new browser of the given |type| and for the given |profile|. The
@@ -92,8 +105,8 @@ class Browser : public TabStripModelDelegate,
void set_override_bounds(const gfx::Rect& bounds) {
override_bounds_ = bounds;
}
- void set_override_maximized(bool maximized) {
- override_maximized_ = maximized;
+ void set_maximized_state(MaximizedState state) {
+ maximized_state_ = state;
}
// Creates the Browser Window. Prefer to use the static helpers above where
@@ -640,7 +653,7 @@ class Browser : public TabStripModelDelegate,
// obtained from the last window of the same type, or obtained from the
// shell shortcut's startup info.
gfx::Rect override_bounds_;
- bool override_maximized_;
+ MaximizedState maximized_state_;
// The following factory is used to close the frame at a later time.
ScopedRunnableMethodFactory<Browser> method_factory_;
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index b6db981..51c5403 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -300,7 +300,9 @@ class SessionRestoreImpl : public NotificationObserver {
if (!browser) {
browser = new Browser((*i)->type, profile_);
browser->set_override_bounds((*i)->bounds);
- browser->set_override_maximized((*i)->is_maximized);
+ browser->set_maximized_state((*i)->is_maximized ?
+ Browser::MAXIMIZED_STATE_MAXIMIZED :
+ Browser::MAXIMIZED_STATE_UNMAXIMIZED);
browser->CreateBrowserWindow();
}
if ((*i)->type == Browser::TYPE_NORMAL)
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index 8c030d6..8dbf410 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -71,7 +71,6 @@ InfoBubble* InfoBubble::Show(HWND parent_hwnd,
views::View* content,
InfoBubbleDelegate* delegate) {
InfoBubble* window = new InfoBubble();
- DLOG(WARNING) << "new bubble=" << window;
window->Init(parent_hwnd, position_relative_to, content);
// Set the delegate before we show, on the off chance the delegate is needed
// during showing.