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

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

Issue 14362028: Speculative Revert 195108 "Changes to closing contents with beforeunload/unl..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 // session. 1424 // session.
1425 if (tabstrip_->IsDragSessionActive()) 1425 if (tabstrip_->IsDragSessionActive())
1426 return false; 1426 return false;
1427 1427
1428 // Give beforeunload handlers the chance to cancel the close before we hide 1428 // Give beforeunload handlers the chance to cancel the close before we hide
1429 // the window below. 1429 // the window below.
1430 if (!browser_->ShouldCloseWindow()) 1430 if (!browser_->ShouldCloseWindow())
1431 return false; 1431 return false;
1432 1432
1433 if (!browser_->tab_strip_model()->empty()) { 1433 if (!browser_->tab_strip_model()->empty()) {
1434 // Tab strip isn't empty. Hide the window (so it appears to have closed
1435 // immediately) and close all the tabs, allowing the renderers to shut
1436 // down. When the tab strip is empty we'll be called back again.
1434 gtk_widget_hide(GTK_WIDGET(window_)); 1437 gtk_widget_hide(GTK_WIDGET(window_));
1435 browser_->OnWindowClosing(); 1438 browser_->OnWindowClosing();
1436 browser_->tab_strip_model()->CloseAllTabs();
1437 return false;
1438 } else if (!browser_->HasCompletedUnloadProcessing()) {
1439 // The browser needs to finish running unload handlers.
1440 // Hide the window (so it appears to have closed immediately), and
1441 // the browser will call us back again when it is ready to close.
1442 gtk_widget_hide(GTK_WIDGET(window_));
1443 return false; 1439 return false;
1444 } 1440 }
1445 1441
1446 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1442 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1447 content::NotificationService::current()->Notify( 1443 content::NotificationService::current()->Notify(
1448 chrome::NOTIFICATION_WINDOW_CLOSED, 1444 chrome::NOTIFICATION_WINDOW_CLOSED,
1449 content::Source<GtkWindow>(window_), 1445 content::Source<GtkWindow>(window_),
1450 content::NotificationService::NoDetails()); 1446 content::NotificationService::NoDetails());
1451 return true; 1447 return true;
1452 } 1448 }
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2395 wm_type == ui::WM_OPENBOX || 2391 wm_type == ui::WM_OPENBOX ||
2396 wm_type == ui::WM_XFWM4); 2392 wm_type == ui::WM_XFWM4);
2397 } 2393 }
2398 2394
2399 // static 2395 // static
2400 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2396 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2401 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2397 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2402 browser_window_gtk->Init(); 2398 browser_window_gtk->Init();
2403 return browser_window_gtk; 2399 return browser_window_gtk;
2404 } 2400 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | trunk/src/chrome/browser/ui/unload_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698