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

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

Issue 7790010: Revert 98679 - Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
602 // Determine if there is a visible window.
603 bool has_visible_browser = false;
604 for (std::vector<SessionWindow*>::iterator i = windows->begin();
605 i != windows->end(); ++i) {
606 if ((*i)->show_state != ui::SHOW_STATE_MINIMIZED)
607 has_visible_browser = true;
608 }
609
610 for (std::vector<SessionWindow*>::iterator i = windows->begin(); 601 for (std::vector<SessionWindow*>::iterator i = windows->begin();
611 i != windows->end(); ++i) { 602 i != windows->end(); ++i) {
612 Browser* browser = NULL; 603 Browser* browser = NULL;
613 if (!has_tabbed_browser && (*i)->type == Browser::TYPE_TABBED) 604 if (!has_tabbed_browser && (*i)->type == Browser::TYPE_TABBED)
614 has_tabbed_browser = true; 605 has_tabbed_browser = true;
615 if (i == windows->begin() && (*i)->type == Browser::TYPE_TABBED && 606 if (i == windows->begin() && (*i)->type == Browser::TYPE_TABBED &&
616 current_browser && current_browser->is_type_tabbed() && 607 current_browser && current_browser->is_type_tabbed() &&
617 !current_browser->profile()->IsOffTheRecord()) { 608 !current_browser->profile()->IsOffTheRecord()) {
618 // The first set of tabs is added to the existing browser. 609 // The first set of tabs is added to the existing browser.
619 browser = current_browser; 610 browser = current_browser;
620 } else { 611 } else {
621 #if defined(OS_CHROMEOS) 612 #if defined(OS_CHROMEOS)
622 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 613 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
623 "SessionRestore-CreateRestoredBrowser-Start", false); 614 "SessionRestore-CreateRestoredBrowser-Start", false);
624 #endif 615 #endif
625 // Show the first window if none are visible.
626 ui::WindowShowState show_state = (*i)->show_state;
627 if (!has_visible_browser) {
628 show_state = ui::SHOW_STATE_NORMAL;
629 has_visible_browser = true;
630 }
631
632 browser = CreateRestoredBrowser( 616 browser = CreateRestoredBrowser(
633 static_cast<Browser::Type>((*i)->type), (*i)->bounds, show_state); 617 static_cast<Browser::Type>((*i)->type),
618 (*i)->bounds,
619 (*i)->show_state);
634 #if defined(OS_CHROMEOS) 620 #if defined(OS_CHROMEOS)
635 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 621 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
636 "SessionRestore-CreateRestoredBrowser-End", false); 622 "SessionRestore-CreateRestoredBrowser-End", false);
637 #endif 623 #endif
638 } 624 }
639 if ((*i)->type == Browser::TYPE_TABBED) 625 if ((*i)->type == Browser::TYPE_TABBED)
640 last_browser = browser; 626 last_browser = browser;
641 TabContents* active_tab = browser->GetSelectedTabContents(); 627 TabContents* active_tab = browser->GetSelectedTabContents();
642 int initial_tab_count = browser->tab_count(); 628 int initial_tab_count = browser->tab_count();
643 int selected_tab_index = (*i)->selected_tab_index; 629 int selected_tab_index = (*i)->selected_tab_index;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 std::vector<GURL> gurls; 852 std::vector<GURL> gurls;
867 SessionRestoreImpl restorer(profile, 853 SessionRestoreImpl restorer(profile,
868 static_cast<Browser*>(NULL), true, false, true, gurls); 854 static_cast<Browser*>(NULL), true, false, true, gurls);
869 restorer.RestoreForeignTab(tab); 855 restorer.RestoreForeignTab(tab);
870 } 856 }
871 857
872 // static 858 // static
873 bool SessionRestore::IsRestoring() { 859 bool SessionRestore::IsRestoring() {
874 return restoring; 860 return restoring;
875 } 861 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/frame/panel_browser_view.cc ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698