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

Unified Diff: chrome/browser/ui/browser.cc

Issue 7621061: Restoring a session should restore window minimization state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing Mark's comments. Created 9 years, 4 months 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 | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 9a43e9ec72cb041290a73a0c90e590c25a846a69..941da4ccfa06f691069587b7e4fb9f05fb0a8c81 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -247,7 +247,7 @@ Browser::Browser(Type type, Profile* profile)
chrome_updater_factory_(this),
is_attempting_to_close_browser_(false),
cancel_download_confirmation_state_(NOT_PROMPTED),
- maximized_state_(MAXIMIZED_STATE_DEFAULT),
+ show_state_(ui::SHOW_STATE_DEFAULT),
method_factory_(this),
block_command_execution_(false),
last_blocked_command_id_(-1),
@@ -851,7 +851,8 @@ bool Browser::ShouldSaveWindowPlacement() const {
}
}
-void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) {
+void Browser::SaveWindowPlacement(const gfx::Rect& bounds,
+ ui::WindowShowState show_state) {
// Save to the session storage service, used when reloading a past session.
// Note that we don't want to be the ones who cause lazy initialization of
// the session service. This function gets called during initial window
@@ -859,7 +860,7 @@ void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) {
SessionService* session_service =
SessionServiceFactory::GetForProfileIfExisting(profile());
if (session_service)
- session_service->SetWindowBounds(session_id_, bounds, maximized);
+ session_service->SetWindowBounds(session_id_, bounds, show_state);
}
gfx::Rect Browser::GetSavedWindowBounds() const {
@@ -884,21 +885,19 @@ gfx::Rect Browser::GetSavedWindowBounds() const {
// TODO(beng): obtain maximized state some other way so we don't need to go
// through all this hassle.
-bool Browser::GetSavedMaximizedState() const {
+ui::WindowShowState Browser::GetSavedWindowShowState() const {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
- return true;
+ return ui::SHOW_STATE_MAXIMIZED;
- if (maximized_state_ == MAXIMIZED_STATE_MAXIMIZED)
- return true;
- if (maximized_state_ == MAXIMIZED_STATE_UNMAXIMIZED)
- return false;
+ if (show_state_ != ui::SHOW_STATE_DEFAULT)
+ return show_state_;
// An explicit maximized state was not set. Query the window sizer.
gfx::Rect restored_bounds;
bool maximized = false;
WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this,
&restored_bounds, &maximized);
- return maximized;
+ return maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL;
}
SkBitmap Browser::GetCurrentPageIcon() const {
@@ -2718,8 +2717,8 @@ Browser* Browser::CreateNewStripWithContents(
// Create an empty new browser window the same size as the old one.
Browser* browser = new Browser(TYPE_TABBED, profile_);
browser->set_override_bounds(new_window_bounds);
- browser->set_maximized_state(
- maximize ? MAXIMIZED_STATE_MAXIMIZED : MAXIMIZED_STATE_UNMAXIMIZED);
+ browser->set_show_state(
+ maximize ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL);
browser->InitBrowserWindow();
browser->tabstrip_model()->AppendTabContents(detached_contents, true);
// Make sure the loading state is updated correctly, otherwise the throbber
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698