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

Unified Diff: chrome/browser/browser.cc

Issue 11377: Changes tab restore service to handle restoring closed windows as a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | « no previous file | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser.cc
===================================================================
--- chrome/browser/browser.cc (revision 5928)
+++ chrome/browser/browser.cc (working copy)
@@ -189,6 +189,10 @@
if (session_service)
session_service->WindowClosed(session_id_);
+ TabRestoreService* tab_restore_service = profile()->GetTabRestoreService();
+ if (tab_restore_service)
+ tab_restore_service->BrowserClosed(this);
+
NotificationService::current()->RemoveObserver(
this, NOTIFY_SSL_STATE_CHANGED, NotificationService::AllSources());
@@ -439,6 +443,10 @@
if (session_service)
session_service->WindowClosing(session_id());
+ TabRestoreService* tab_restore_service = profile()->GetTabRestoreService();
+ if (tab_restore_service)
+ tab_restore_service->BrowserClosing(this);
+
CloseAllTabs();
}
@@ -689,14 +697,7 @@
if (!service)
return;
- const TabRestoreService::Tabs& tabs = service->tabs();
- if (tabs.empty() || tabs.front().from_last_session)
- return;
-
- const TabRestoreService::HistoricalTab& tab = tabs.front();
- AddRestoredTab(tab.navigations, tab_count(), tab.current_navigation_index,
- true);
- service->RemoveHistoricalTabById(tab.id);
+ service->RestoreMostRecentEntry(this);
}
void Browser::ConvertPopupToTabbedBrowser() {
@@ -1952,6 +1953,11 @@
void Browser::UpdateNavigationCommands() {
TabContents* current_tab = GetSelectedTabContents();
+ if (!current_tab) {
+ // It's possible for this to be null during tab restore.
+ return;
+ }
+
NavigationController* nc = current_tab->controller();
controller_.UpdateCommandEnabled(IDC_BACK, nc->CanGoBack());
controller_.UpdateCommandEnabled(IDC_FORWARD, nc->CanGoForward());
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698