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

Side by Side Diff: chrome/browser/sessions/session_restore.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sessions/session_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 void RestoreForeignSession( 459 void RestoreForeignSession(
460 std::vector<SessionWindow*>::const_iterator begin, 460 std::vector<SessionWindow*>::const_iterator begin,
461 std::vector<SessionWindow*>::const_iterator end) { 461 std::vector<SessionWindow*>::const_iterator end) {
462 StartTabCreation(); 462 StartTabCreation();
463 // Create a browser instance to put the restored tabs in. 463 // Create a browser instance to put the restored tabs in.
464 for (std::vector<SessionWindow*>::const_iterator i = begin; 464 for (std::vector<SessionWindow*>::const_iterator i = begin;
465 i != end; ++i) { 465 i != end; ++i) {
466 Browser* browser = CreateRestoredBrowser( 466 Browser* browser = CreateRestoredBrowser(
467 static_cast<Browser::Type>((*i)->type), 467 static_cast<Browser::Type>((*i)->type),
468 (*i)->bounds, 468 (*i)->bounds,
469 (*i)->is_maximized); 469 (*i)->show_state);
470 470
471 // Restore and show the browser. 471 // Restore and show the browser.
472 const int initial_tab_count = browser->tab_count(); 472 const int initial_tab_count = browser->tab_count();
473 int selected_tab_index = (*i)->selected_tab_index; 473 int selected_tab_index = (*i)->selected_tab_index;
474 RestoreTabsToBrowser(*(*i), browser, selected_tab_index); 474 RestoreTabsToBrowser(*(*i), browser, selected_tab_index);
475 ShowBrowser(browser, initial_tab_count, selected_tab_index); 475 ShowBrowser(browser, initial_tab_count, selected_tab_index);
476 tab_loader_->TabIsLoading( 476 tab_loader_->TabIsLoading(
477 &browser->GetSelectedTabContents()->controller()); 477 &browser->GetSelectedTabContents()->controller());
478 NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); 478 NotifySessionServiceOfRestoredTabs(browser, initial_tab_count);
479 } 479 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // The first set of tabs is added to the existing browser. 609 // The first set of tabs is added to the existing browser.
610 browser = current_browser; 610 browser = current_browser;
611 } else { 611 } else {
612 #if defined(OS_CHROMEOS) 612 #if defined(OS_CHROMEOS)
613 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 613 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
614 "SessionRestore-CreateRestoredBrowser-Start", false); 614 "SessionRestore-CreateRestoredBrowser-Start", false);
615 #endif 615 #endif
616 browser = CreateRestoredBrowser( 616 browser = CreateRestoredBrowser(
617 static_cast<Browser::Type>((*i)->type), 617 static_cast<Browser::Type>((*i)->type),
618 (*i)->bounds, 618 (*i)->bounds,
619 (*i)->is_maximized); 619 (*i)->show_state);
620 #if defined(OS_CHROMEOS) 620 #if defined(OS_CHROMEOS)
621 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 621 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
622 "SessionRestore-CreateRestoredBrowser-End", false); 622 "SessionRestore-CreateRestoredBrowser-End", false);
623 #endif 623 #endif
624 } 624 }
625 if ((*i)->type == Browser::TYPE_TABBED) 625 if ((*i)->type == Browser::TYPE_TABBED)
626 last_browser = browser; 626 last_browser = browser;
627 TabContents* active_tab = browser->GetSelectedTabContents(); 627 TabContents* active_tab = browser->GetSelectedTabContents();
628 int initial_tab_count = browser->tab_count(); 628 int initial_tab_count = browser->tab_count();
629 int selected_tab_index = (*i)->selected_tab_index; 629 int selected_tab_index = (*i)->selected_tab_index;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 false, 703 false,
704 tab.pinned, 704 tab.pinned,
705 true, 705 true,
706 NULL); 706 NULL);
707 if (schedule_load) 707 if (schedule_load)
708 tab_loader_->ScheduleLoad(&tab_contents->controller()); 708 tab_loader_->ScheduleLoad(&tab_contents->controller());
709 } 709 }
710 710
711 Browser* CreateRestoredBrowser(Browser::Type type, 711 Browser* CreateRestoredBrowser(Browser::Type type,
712 gfx::Rect bounds, 712 gfx::Rect bounds,
713 bool is_maximized) { 713 ui::WindowShowState show_state) {
714 Browser* browser = new Browser(type, profile_); 714 Browser* browser = new Browser(type, profile_);
715 browser->set_override_bounds(bounds); 715 browser->set_override_bounds(bounds);
716 browser->set_maximized_state(is_maximized ? 716 browser->set_show_state(show_state);
717 Browser::MAXIMIZED_STATE_MAXIMIZED :
718 Browser::MAXIMIZED_STATE_UNMAXIMIZED);
719 browser->InitBrowserWindow(); 717 browser->InitBrowserWindow();
720 return browser; 718 return browser;
721 } 719 }
722 720
723 void ShowBrowser(Browser* browser, 721 void ShowBrowser(Browser* browser,
724 int initial_tab_count, 722 int initial_tab_count,
725 int selected_session_index) { 723 int selected_session_index) {
726 DCHECK(browser); 724 DCHECK(browser);
727 DCHECK(browser->tab_count()); 725 DCHECK(browser->tab_count());
728 browser->ActivateTabAt( 726 browser->ActivateTabAt(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 std::vector<GURL> gurls; 852 std::vector<GURL> gurls;
855 SessionRestoreImpl restorer(profile, 853 SessionRestoreImpl restorer(profile,
856 static_cast<Browser*>(NULL), true, false, true, gurls); 854 static_cast<Browser*>(NULL), true, false, true, gurls);
857 restorer.RestoreForeignTab(tab); 855 restorer.RestoreForeignTab(tab);
858 } 856 }
859 857
860 // static 858 // static
861 bool SessionRestore::IsRestoring() { 859 bool SessionRestore::IsRestoring() {
862 return restoring; 860 return restoring;
863 } 861 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sessions/session_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698