OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // called. In a release build, cancelling termination will prevent a crash (but | 233 // called. In a release build, cancelling termination will prevent a crash (but |
234 // if things go really wrong, the user may have to force-terminate the | 234 // if things go really wrong, the user may have to force-terminate the |
235 // application). | 235 // application). |
236 - (NSApplicationTerminateReply)applicationShouldTerminate: | 236 - (NSApplicationTerminateReply)applicationShouldTerminate: |
237 (NSApplication*)sender { | 237 (NSApplication*)sender { |
238 NOTREACHED(); | 238 NOTREACHED(); |
239 return NSTerminateCancel; | 239 return NSTerminateCancel; |
240 } | 240 } |
241 | 241 |
242 - (BOOL)tryToTerminateApplication:(NSApplication*)app { | 242 - (BOOL)tryToTerminateApplication:(NSApplication*)app { |
| 243 // Check for in-process downloads, and prompt the user if they really want |
| 244 // to quit (and thus cancel downloads). Only check if we're not already |
| 245 // shutting down, else the user might be prompted multiple times if the |
| 246 // download isn't stopped before terminate is called again. |
| 247 if (!browser_shutdown::IsTryingToQuit() && |
| 248 ![self shouldQuitWithInProgressDownloads]) |
| 249 return NO; |
| 250 |
243 // Set the state to "trying to quit", so that closing all browser windows will | 251 // Set the state to "trying to quit", so that closing all browser windows will |
244 // lead to termination. | 252 // lead to termination. |
245 browser_shutdown::SetTryingToQuit(true); | 253 browser_shutdown::SetTryingToQuit(true); |
246 | 254 |
247 // TODO(viettrungluu): Remove Apple Event handlers here? (It's safe to leave | 255 // TODO(viettrungluu): Remove Apple Event handlers here? (It's safe to leave |
248 // them in, but I'm not sure about UX; we'd also want to disable other things | 256 // them in, but I'm not sure about UX; we'd also want to disable other things |
249 // though.) http://crbug.com/40861 | 257 // though.) http://crbug.com/40861 |
250 | 258 |
251 if (!BrowserList::size()) | 259 if (!BrowserList::size()) |
252 return YES; | 260 return YES; |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 [appController showPreferencesWindow:nil page:page profile:profile]; | 1017 [appController showPreferencesWindow:nil page:page profile:profile]; |
1010 } | 1018 } |
1011 | 1019 |
1012 namespace app_controller_mac { | 1020 namespace app_controller_mac { |
1013 | 1021 |
1014 bool IsOpeningNewWindow() { | 1022 bool IsOpeningNewWindow() { |
1015 return g_is_opening_new_window; | 1023 return g_is_opening_new_window; |
1016 } | 1024 } |
1017 | 1025 |
1018 } // namespace app_controller_mac | 1026 } // namespace app_controller_mac |
OLD | NEW |