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

Side by Side Diff: trunk/src/chrome/browser/ui/views/frame/browser_view.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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 // session. 1842 // session.
1843 if (tabstrip_ && !tabstrip_->IsTabStripCloseable()) 1843 if (tabstrip_ && !tabstrip_->IsTabStripCloseable())
1844 return false; 1844 return false;
1845 1845
1846 // Give beforeunload handlers the chance to cancel the close before we hide 1846 // Give beforeunload handlers the chance to cancel the close before we hide
1847 // the window below. 1847 // the window below.
1848 if (!browser_->ShouldCloseWindow()) 1848 if (!browser_->ShouldCloseWindow())
1849 return false; 1849 return false;
1850 1850
1851 if (!browser_->tab_strip_model()->empty()) { 1851 if (!browser_->tab_strip_model()->empty()) {
1852 // Tab strip isn't empty. Hide the frame (so it appears to have closed
1853 // immediately) and close all the tabs, allowing the renderers to shut
1854 // down. When the tab strip is empty we'll be called back again.
1852 frame_->Hide(); 1855 frame_->Hide();
1853 browser_->OnWindowClosing(); 1856 browser_->OnWindowClosing();
1854 browser_->tab_strip_model()->CloseAllTabs();
1855 return false;
1856 } else if (!browser_->HasCompletedUnloadProcessing()) {
1857 // The browser needs to finish running unload handlers.
1858 // Hide the window (so it appears to have closed immediately), and
1859 // the browser will call us back again when it is ready to close.
1860 frame_->Hide();
1861 return false; 1857 return false;
1862 } 1858 }
1863 1859
1864 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1860 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1865 content::NotificationService::current()->Notify( 1861 content::NotificationService::current()->Notify(
1866 chrome::NOTIFICATION_WINDOW_CLOSED, 1862 chrome::NOTIFICATION_WINDOW_CLOSED,
1867 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()), 1863 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()),
1868 content::NotificationService::NoDetails()); 1864 content::NotificationService::NoDetails());
1869 return true; 1865 return true;
1870 } 1866 }
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 2733
2738 Browser* modal_browser = 2734 Browser* modal_browser =
2739 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); 2735 chrome::FindBrowserWithWebContents(active_dialog->web_contents());
2740 if (modal_browser && (browser_ != modal_browser)) { 2736 if (modal_browser && (browser_ != modal_browser)) {
2741 modal_browser->window()->FlashFrame(true); 2737 modal_browser->window()->FlashFrame(true);
2742 modal_browser->window()->Activate(); 2738 modal_browser->window()->Activate();
2743 } 2739 }
2744 2740
2745 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2741 AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2746 } 2742 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/ui/unload_controller.cc ('k') | trunk/src/chrome/browser/unload_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698