| Index: chrome/browser/ui/views/frame/browser_view.cc
|
| diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
|
| index 8233102e82dd29a07bc87de259cf2dfae1e4e540..9fbd14d3537fb3bfc2f6da7d0c8a9a5c49e4b235 100644
|
| --- a/chrome/browser/ui/views/frame/browser_view.cc
|
| +++ b/chrome/browser/ui/views/frame/browser_view.cc
|
| @@ -1781,12 +1781,24 @@ bool BrowserView::CanClose() {
|
| if (!browser_->ShouldCloseWindow())
|
| return false;
|
|
|
| + bool fast_tab_closing_enabled =
|
| + CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableFastUnload);
|
| +
|
| if (!browser_->tab_strip_model()->empty()) {
|
| // Tab strip isn't empty. Hide the frame (so it appears to have closed
|
| // immediately) and close all the tabs, allowing the renderers to shut
|
| // down. When the tab strip is empty we'll be called back again.
|
| frame_->Hide();
|
| browser_->OnWindowClosing();
|
| + if (fast_tab_closing_enabled)
|
| + browser_->tab_strip_model()->CloseAllTabs();
|
| + return false;
|
| + } else if (fast_tab_closing_enabled &&
|
| + !browser_->HasCompletedUnloadProcessing()) {
|
| + // The browser needs to finish running unload handlers.
|
| + // Hide the frame (so it appears to have closed immediately), and
|
| + // the browser will call us back again when it is ready to close.
|
| + frame_->Hide();
|
| return false;
|
| }
|
|
|
|
|