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

Side by Side Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

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 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 // You cannot close a frame for which there is an active originating drag 1436 // You cannot close a frame for which there is an active originating drag
1437 // session. 1437 // session.
1438 if (tabstrip_->IsDragSessionActive()) 1438 if (tabstrip_->IsDragSessionActive())
1439 return false; 1439 return false;
1440 1440
1441 // Give beforeunload handlers the chance to cancel the close before we hide 1441 // Give beforeunload handlers the chance to cancel the close before we hide
1442 // the window below. 1442 // the window below.
1443 if (!browser_->ShouldCloseWindow()) 1443 if (!browser_->ShouldCloseWindow())
1444 return false; 1444 return false;
1445 1445
1446 bool fast_tab_closing_enabled =
1447 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableFastUnload);
1448
1446 if (!browser_->tab_strip_model()->empty()) { 1449 if (!browser_->tab_strip_model()->empty()) {
1447 // Tab strip isn't empty. Hide the window (so it appears to have closed 1450 // Tab strip isn't empty. Hide the window (so it appears to have closed
1448 // immediately) and close all the tabs, allowing the renderers to shut 1451 // immediately) and close all the tabs, allowing the renderers to shut
1449 // down. When the tab strip is empty we'll be called back again. 1452 // down. When the tab strip is empty we'll be called back again.
1450 gtk_widget_hide(GTK_WIDGET(window_)); 1453 gtk_widget_hide(GTK_WIDGET(window_));
1451 browser_->OnWindowClosing(); 1454 browser_->OnWindowClosing();
1452 browser_->tab_strip_model()->CloseAllTabs(); 1455 if (fast_tab_closing_enabled)
1456 browser_->tab_strip_model()->CloseAllTabs();
1453 return false; 1457 return false;
1454 } else if (!browser_->HasCompletedUnloadProcessing()) { 1458 } else if (fast_tab_closing_enabled &&
1459 !browser_->HasCompletedUnloadProcessing()) {
1455 // The browser needs to finish running unload handlers. 1460 // The browser needs to finish running unload handlers.
1456 // Hide the window (so it appears to have closed immediately), and 1461 // Hide the window (so it appears to have closed immediately), and
1457 // the browser will call us back again when it is ready to close. 1462 // the browser will call us back again when it is ready to close.
1458 gtk_widget_hide(GTK_WIDGET(window_)); 1463 gtk_widget_hide(GTK_WIDGET(window_));
1459 return false; 1464 return false;
1460 } 1465 }
1461 1466
1462 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1467 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1463 content::NotificationService::current()->Notify( 1468 content::NotificationService::current()->Notify(
1464 chrome::NOTIFICATION_WINDOW_CLOSED, 1469 chrome::NOTIFICATION_WINDOW_CLOSED,
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 wm_type == ui::WM_OPENBOX || 2416 wm_type == ui::WM_OPENBOX ||
2412 wm_type == ui::WM_XFWM4); 2417 wm_type == ui::WM_XFWM4);
2413 } 2418 }
2414 2419
2415 // static 2420 // static
2416 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2421 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2417 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2422 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2418 browser_window_gtk->Init(); 2423 browser_window_gtk->Init();
2419 return browser_window_gtk; 2424 return browser_window_gtk;
2420 } 2425 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698