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

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

Issue 11016023: Quickly close tabs/window with long-running unload handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 7 years, 6 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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (!browser_->tab_strip_model()->empty()) { 1446 if (!browser_->tab_strip_model()->empty()) {
1447 // Tab strip isn't empty. Hide the window (so it appears to have closed 1447 // 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 1448 // 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. 1449 // down. When the tab strip is empty we'll be called back again.
1450 gtk_widget_hide(GTK_WIDGET(window_)); 1450 gtk_widget_hide(GTK_WIDGET(window_));
1451 browser_->OnWindowClosing(); 1451 browser_->OnWindowClosing();
1452 browser_->tab_strip_model()->CloseAllTabs();
1453 return false;
1454 } else if (!browser_->HasCompletedUnloadProcessing()) {
1455 // The browser needs to finish running unload handlers.
1456 // 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.
1458 gtk_widget_hide(GTK_WIDGET(window_));
1452 return false; 1459 return false;
1453 } 1460 }
1454 1461
1455 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1462 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1456 content::NotificationService::current()->Notify( 1463 content::NotificationService::current()->Notify(
1457 chrome::NOTIFICATION_WINDOW_CLOSED, 1464 chrome::NOTIFICATION_WINDOW_CLOSED,
1458 content::Source<GtkWindow>(window_), 1465 content::Source<GtkWindow>(window_),
1459 content::NotificationService::NoDetails()); 1466 content::NotificationService::NoDetails());
1460 return true; 1467 return true;
1461 } 1468 }
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 wm_type == ui::WM_OPENBOX || 2411 wm_type == ui::WM_OPENBOX ||
2405 wm_type == ui::WM_XFWM4); 2412 wm_type == ui::WM_XFWM4);
2406 } 2413 }
2407 2414
2408 // static 2415 // static
2409 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2416 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2410 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2417 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2411 browser_window_gtk->Init(); 2418 browser_window_gtk->Init();
2412 return browser_window_gtk; 2419 return browser_window_gtk;
2413 } 2420 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/unload_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698