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

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 7748036: Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: GetSavedWindowPlacement consolidation, Test, and All case. Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 "SessionRestore-CreatingTabs-Start", false); 591 "SessionRestore-CreatingTabs-Start", false);
592 #endif 592 #endif
593 StartTabCreation(); 593 StartTabCreation();
594 594
595 Browser* current_browser = 595 Browser* current_browser =
596 browser_ ? browser_ : BrowserList::GetLastActiveWithProfile(profile_); 596 browser_ ? browser_ : BrowserList::GetLastActiveWithProfile(profile_);
597 // After the for loop this contains the last TABBED_BROWSER. Is null if no 597 // After the for loop this contains the last TABBED_BROWSER. Is null if no
598 // tabbed browsers exist. 598 // tabbed browsers exist.
599 Browser* last_browser = NULL; 599 Browser* last_browser = NULL;
600 bool has_tabbed_browser = false; 600 bool has_tabbed_browser = false;
601 bool has_visible_browser = false;
602 std::vector<SessionWindow*>::iterator last_window =
603 windows->begin() + (windows->size() - 1);
601 for (std::vector<SessionWindow*>::iterator i = windows->begin(); 604 for (std::vector<SessionWindow*>::iterator i = windows->begin();
602 i != windows->end(); ++i) { 605 i != windows->end(); ++i) {
603 Browser* browser = NULL; 606 Browser* browser = NULL;
604 if (!has_tabbed_browser && (*i)->type == Browser::TYPE_TABBED) 607 if (!has_tabbed_browser && (*i)->type == Browser::TYPE_TABBED)
605 has_tabbed_browser = true; 608 has_tabbed_browser = true;
606 if (i == windows->begin() && (*i)->type == Browser::TYPE_TABBED && 609 if (i == windows->begin() && (*i)->type == Browser::TYPE_TABBED &&
607 current_browser && current_browser->is_type_tabbed() && 610 current_browser && current_browser->is_type_tabbed() &&
608 !current_browser->profile()->IsOffTheRecord()) { 611 !current_browser->profile()->IsOffTheRecord()) {
609 // The first set of tabs is added to the existing browser. 612 // The first set of tabs is added to the existing browser.
610 browser = current_browser; 613 browser = current_browser;
611 } else { 614 } else {
612 #if defined(OS_CHROMEOS) 615 #if defined(OS_CHROMEOS)
613 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 616 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
614 "SessionRestore-CreateRestoredBrowser-Start", false); 617 "SessionRestore-CreateRestoredBrowser-Start", false);
615 #endif 618 #endif
619 // Ensure that at least one restored window is visible.
sky 2011/08/26 22:29:56 The first window to be restored is the window the
dhollowa 2011/08/26 23:18:23 Done. As discussed, we may need to evaluate this
620 if ((*i)->show_state != ui::SHOW_STATE_MINIMIZED)
621 has_visible_browser = true;
622 ui::WindowShowState show_state = (*i)->show_state;
623 if (i == last_window && !has_visible_browser)
624 show_state = ui::SHOW_STATE_NORMAL;
625
616 browser = CreateRestoredBrowser( 626 browser = CreateRestoredBrowser(
617 static_cast<Browser::Type>((*i)->type), 627 static_cast<Browser::Type>((*i)->type), (*i)->bounds, show_state);
618 (*i)->bounds,
619 (*i)->show_state);
620 #if defined(OS_CHROMEOS) 628 #if defined(OS_CHROMEOS)
621 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 629 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
622 "SessionRestore-CreateRestoredBrowser-End", false); 630 "SessionRestore-CreateRestoredBrowser-End", false);
623 #endif 631 #endif
624 } 632 }
625 if ((*i)->type == Browser::TYPE_TABBED) 633 if ((*i)->type == Browser::TYPE_TABBED)
626 last_browser = browser; 634 last_browser = browser;
627 TabContents* active_tab = browser->GetSelectedTabContents(); 635 TabContents* active_tab = browser->GetSelectedTabContents();
628 int initial_tab_count = browser->tab_count(); 636 int initial_tab_count = browser->tab_count();
629 int selected_tab_index = (*i)->selected_tab_index; 637 int selected_tab_index = (*i)->selected_tab_index;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 std::vector<GURL> gurls; 860 std::vector<GURL> gurls;
853 SessionRestoreImpl restorer(profile, 861 SessionRestoreImpl restorer(profile,
854 static_cast<Browser*>(NULL), true, false, true, gurls); 862 static_cast<Browser*>(NULL), true, false, true, gurls);
855 restorer.RestoreForeignTab(tab); 863 restorer.RestoreForeignTab(tab);
856 } 864 }
857 865
858 // static 866 // static
859 bool SessionRestore::IsRestoring() { 867 bool SessionRestore::IsRestoring() {
860 return restoring; 868 return restoring;
861 } 869 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698