summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-01 03:10:15 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-01 03:10:15 +0000
commitb876c7db6bc09c93c9396c2995a5885f61dcdf9e (patch)
tree3f97ddcf9683e4a440a3267fe1ace9f6942eb429 /chrome/browser
parentcb69b128dddf0cd36076913f192e0592f08a366b (diff)
downloadchromium_src-b876c7db6bc09c93c9396c2995a5885f61dcdf9e.zip
chromium_src-b876c7db6bc09c93c9396c2995a5885f61dcdf9e.tar.gz
chromium_src-b876c7db6bc09c93c9396c2995a5885f61dcdf9e.tar.bz2
Mac: Allow window/app. to be closed when tab modal sheets are showing.
This patch consists only of code deletions. Despite the comments in the deleted code, it's all okay since sheets are closed: |TabContents::~TabContents()| calls |ConstrainedWindowMac::CloseConstrainedWindow()|, which calls |ConstrainedWindowMacDelegate::DeleteDelegate()|, which should close the sheet if it's still open. This code path has been in use for quite some time, since we've allowed (or failed to disallow!) tabs containing sheets to be closed via the close tab button. BUG=19427 TEST=Open some tabs (possibly in multiple windows) with some tab modal sheet (e.g., by navigating to <http://www.pagetutor.com/keeper/mystash/secretstuff.html>); close a window containing such a tab, with a tab modal sheet visible or not; quit application while a tab modal sheet is active (not nec. visible). Review URL: http://codereview.chromium.org/242059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27699 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/app_controller_mac.mm26
-rw-r--r--chrome/browser/cocoa/browser_window_controller.h4
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm19
3 files changed, 0 insertions, 49 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index f2d1b2a..c56aa46 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -125,34 +125,8 @@
}
}
-// Checks if there are any tabs with sheets open, and if so, raises one of
-// the tabs with a sheet and returns NO.
-- (BOOL)shouldQuitWithOpenPerTabSheets {
- BrowserList::const_iterator it = BrowserList::begin();
- for (; it != BrowserList::end(); ++it) {
- Browser* browser = *it;
- BrowserWindowCocoa* window =
- static_cast<BrowserWindowCocoa*>(browser->window());
-
- // Could do this more nicely with a method e.g. on BWC. If I decide for
- // keeping it this way, at least add a DCHECK().
- BrowserWindowController* controller =
- (BrowserWindowController*)[window->GetNativeHandle() windowController];
-
- if (![controller shouldCloseWithOpenPerTabSheets])
- return NO;
- }
-
- return YES;
-}
-
- (NSApplicationTerminateReply)applicationShouldTerminate:
(NSApplication *)sender {
- // Do not quit if any per-tab sheets are open, as required by
- // GTMWindowSheetController.
- if (![self shouldQuitWithOpenPerTabSheets])
- return NSTerminateCancel;
-
// Check for in-progress downloads, and prompt the user if they really want to
// quit (and thus cancel the downloads).
if (![self shouldQuitWithInProgressDownloads])
diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h
index 339aa61..b4700b4 100644
--- a/chrome/browser/cocoa/browser_window_controller.h
+++ b/chrome/browser/cocoa/browser_window_controller.h
@@ -150,10 +150,6 @@ class TabStripModelObserverBridge;
// for the per-tab sheets.
- (GTMWindowSheetController*)sheetController;
-// Checks if there are any tabs with sheets open, and if so, raises one of
-// the tabs with a sheet and returns NO.
-- (BOOL)shouldCloseWithOpenPerTabSheets;
-
- (void)attachConstrainedWindow:(ConstrainedWindowMac*)window;
- (void)removeConstrainedWindow:(ConstrainedWindowMac*)window;
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 95fc140..32dd545 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -267,20 +267,6 @@ willPositionSheet:(NSWindow*)sheet
afterDelay:0];
}
-// Checks if there are any tabs with sheets open, and if so, raises one of
-// the tabs with a sheet and returns NO.
-- (BOOL)shouldCloseWithOpenPerTabSheets {
- // This is O(n_open_sheets * n_tabs), i.e. O(n**2). Since people probably
- // won't have 100 tabs open, and not every tab will have a sheet, this is ok.
- for (NSView* view in
- [[tabStripController_ sheetController] viewsWithAttachedSheets]) {
- [tabStripController_ gtm_systemRequestsVisibilityForView:view];
- return NO;
- }
-
- return YES;
-}
-
- (void)attachConstrainedWindow:(ConstrainedWindowMac*)window {
[tabStripController_ attachConstrainedWindow:window];
}
@@ -296,11 +282,6 @@ willPositionSheet:(NSWindow*)sheet
// required to get us to the closing state and (by watching for all the tabs
// going away) will again call to close the window when it's finally ready.
- (BOOL)windowShouldClose:(id)sender {
- // Do not close a window with open sheets, as required by
- // GTMWindowSheetController.
- if (![self shouldCloseWithOpenPerTabSheets])
- return NO;
-
// Disable updates while closing all tabs to avoid flickering.
base::ScopedNSDisableScreenUpdates disabler;
// Give beforeunload handlers the chance to cancel the close before we hide