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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 17571018: Reland fast tab closure behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff against original patch Created 7 years, 5 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // Give beforeunload handlers the chance to cancel the close before we hide 590 // Give beforeunload handlers the chance to cancel the close before we hide
591 // the window below. 591 // the window below.
592 if (!browser_->ShouldCloseWindow()) 592 if (!browser_->ShouldCloseWindow())
593 return NO; 593 return NO;
594 594
595 // saveWindowPositionIfNeeded: only works if we are the last active 595 // saveWindowPositionIfNeeded: only works if we are the last active
596 // window, but orderOut: ends up activating another window, so we 596 // window, but orderOut: ends up activating another window, so we
597 // have to save the window position before we call orderOut:. 597 // have to save the window position before we call orderOut:.
598 [self saveWindowPositionIfNeeded]; 598 [self saveWindowPositionIfNeeded];
599 599
600 bool fast_tab_closing_enabled =
601 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableFastUnload);
602
600 if (!browser_->tab_strip_model()->empty()) { 603 if (!browser_->tab_strip_model()->empty()) {
601 // Tab strip isn't empty. Hide the frame (so it appears to have closed 604 // Tab strip isn't empty. Hide the frame (so it appears to have closed
602 // immediately) and close all the tabs, allowing the renderers to shut 605 // immediately) and close all the tabs, allowing the renderers to shut
603 // down. When the tab strip is empty we'll be called back again. 606 // down. When the tab strip is empty we'll be called back again.
604 [[self window] orderOut:self]; 607 [[self window] orderOut:self];
605 browser_->OnWindowClosing(); 608 browser_->OnWindowClosing();
606 browser_->tab_strip_model()->CloseAllTabs(); 609 if (fast_tab_closing_enabled)
610 browser_->tab_strip_model()->CloseAllTabs();
607 return NO; 611 return NO;
608 } else if (!browser_->HasCompletedUnloadProcessing()) { 612 } else if (fast_tab_closing_enabled &&
613 !browser_->HasCompletedUnloadProcessing()) {
609 // The browser needs to finish running unload handlers. 614 // The browser needs to finish running unload handlers.
610 // Hide the window (so it appears to have closed immediately), and 615 // Hide the window (so it appears to have closed immediately), and
611 // the browser will call us back again when it is ready to close. 616 // the browser will call us back again when it is ready to close.
612 [[self window] orderOut:self]; 617 [[self window] orderOut:self];
613 return NO; 618 return NO;
614 } 619 }
615 620
616 // the tab strip is empty, it's ok to close the window 621 // the tab strip is empty, it's ok to close the window
617 return YES; 622 return YES;
618 } 623 }
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 2274
2270 - (BOOL)supportsBookmarkBar { 2275 - (BOOL)supportsBookmarkBar {
2271 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2276 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2272 } 2277 }
2273 2278
2274 - (BOOL)isTabbedWindow { 2279 - (BOOL)isTabbedWindow {
2275 return browser_->is_type_tabbed(); 2280 return browser_->is_type_tabbed();
2276 } 2281 }
2277 2282
2278 @end // @implementation BrowserWindowController(WindowType) 2283 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698