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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.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
« no previous file with comments | « chrome/browser/ui/unload_controller.cc ('k') | chrome/browser/unload_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 // the window below. 1824 // the window below.
1825 if (!browser_->ShouldCloseWindow()) 1825 if (!browser_->ShouldCloseWindow())
1826 return false; 1826 return false;
1827 1827
1828 if (!browser_->tab_strip_model()->empty()) { 1828 if (!browser_->tab_strip_model()->empty()) {
1829 // Tab strip isn't empty. Hide the frame (so it appears to have closed 1829 // Tab strip isn't empty. Hide the frame (so it appears to have closed
1830 // immediately) and close all the tabs, allowing the renderers to shut 1830 // immediately) and close all the tabs, allowing the renderers to shut
1831 // down. When the tab strip is empty we'll be called back again. 1831 // down. When the tab strip is empty we'll be called back again.
1832 frame_->Hide(); 1832 frame_->Hide();
1833 browser_->OnWindowClosing(); 1833 browser_->OnWindowClosing();
1834 browser_->tab_strip_model()->CloseAllTabs();
1835 return false;
1836 } else if (!browser_->HasCompletedUnloadProcessing()) {
1837 // The browser needs to finish running unload handlers.
1838 // Hide the frame (so it appears to have closed immediately), and
1839 // the browser will call us back again when it is ready to close.
1840 frame_->Hide();
1834 return false; 1841 return false;
1835 } 1842 }
1836 1843
1837 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1844 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1838 content::NotificationService::current()->Notify( 1845 content::NotificationService::current()->Notify(
1839 chrome::NOTIFICATION_WINDOW_CLOSED, 1846 chrome::NOTIFICATION_WINDOW_CLOSED,
1840 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()), 1847 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()),
1841 content::NotificationService::NoDetails()); 1848 content::NotificationService::NoDetails());
1842 return true; 1849 return true;
1843 } 1850 }
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 // The +1 in the next line creates a 1-px gap between icon and arrow tip. 2774 // The +1 in the next line creates a 1-px gap between icon and arrow tip.
2768 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - 2775 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() -
2769 LocationBarView::kIconInternalPadding + 1); 2776 LocationBarView::kIconInternalPadding + 1);
2770 ConvertPointToTarget(location_icon_view, this, &icon_bottom); 2777 ConvertPointToTarget(location_icon_view, this, &icon_bottom);
2771 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2778 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2772 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2779 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2773 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2780 top_arrow_height = infobar_top.y() - icon_bottom.y();
2774 } 2781 }
2775 return top_arrow_height; 2782 return top_arrow_height;
2776 } 2783 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/unload_controller.cc ('k') | chrome/browser/unload_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698