Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 832153b86e17201770479a2f4bfa17284c823b52..9e94f44ff407629aca9814f439e1704cbc6dbefa 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -746,11 +746,7 @@ void Browser::OnWindowClosing() { |
if (tab_restore_service && is_type_tabbed() && tab_strip_model_->count()) |
tab_restore_service->BrowserClosing(live_tab_context()); |
- // TODO(sky): convert session/tab restore to use notification. |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_BROWSER_CLOSING, |
- content::Source<Browser>(this), |
- content::NotificationService::NoDetails()); |
+ BrowserList::NotifyBrowserCloseStarted(this); |
if (!IsFastTabUnloadEnabled()) |
tab_strip_model_->CloseAllTabs(); |
@@ -2556,7 +2552,11 @@ bool Browser::ShouldHideUIForFullscreen() const { |
} |
bool Browser::ShouldStartShutdown() const { |
- return BrowserList::GetInstance()->size() <= 1; |
+ DCHECK_GE(BrowserList::GetInstance()->size(), |
+ BrowserList::GetInstance()->currently_closing_browsers_count()); |
+ // Start shutdown process only when closing the last browser. |
+ return BrowserList::GetInstance()->size() == |
+ BrowserList::GetInstance()->currently_closing_browsers_count() + 1; |
} |
bool Browser::MaybeCreateBackgroundContents( |