summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_controller_mac.mm
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 05:43:11 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 05:43:11 +0000
commit58877932d4440da6b6a02d621c5c8b5c2f24c62c (patch)
tree01161f5136d7db588f727e43c331b01fef522f66 /chrome/browser/app_controller_mac.mm
parent39e53110995de4c121d5558ab8c6f048e2444757 (diff)
downloadchromium_src-58877932d4440da6b6a02d621c5c8b5c2f24c62c.zip
chromium_src-58877932d4440da6b6a02d621c5c8b5c2f24c62c.tar.gz
chromium_src-58877932d4440da6b6a02d621c5c8b5c2f24c62c.tar.bz2
Mac: Make quitting from AppleScript more reliable.
For some reason, doing osascript -e 'tell application "Chromium" to quit' wasn't resulting in our AE handler being called. I decided that Cocoa's default handling for quitting would call [NSApp terminate] in all cases anyway, which is exactly what we want. BUG=44965 TEST=Make sure the above works. Make sure quitting by right-clicking on the Dock icon and selecting Quit works (that sends an aevt/quit, which was correctly handled before). Make sure that onbeforeunload handlers still prevent window closure and quitting (go to about:blank, enter 'javascript:window.onbeforeunload=function () { return "please stay"; }' in the Omnibox, choose to stay on the page when the dialog comes up). Review URL: http://codereview.chromium.org/2154004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r--chrome/browser/app_controller_mac.mm26
1 files changed, 1 insertions, 25 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 824b1b4..1cd02e7 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -137,8 +137,6 @@ void RecordLastRunAppBundlePath() {
@interface AppController(Private)
- (void)initMenuState;
-- (void)handleQuitEvent:(NSAppleEventDescriptor*)event
- withReply:(NSAppleEventDescriptor*)reply;
- (void)openUrls:(const std::vector<GURL>&)urls;
- (void)getUrl:(NSAppleEventDescriptor*)event
withReply:(NSAppleEventDescriptor*)reply;
@@ -221,22 +219,7 @@ void RecordLastRunAppBundlePath() {
// (NSApplicationDelegate protocol) This is the Apple-approved place to override
// the default handlers.
- (void)applicationWillFinishLaunching:(NSNotification*)notification {
- NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager];
- [em setEventHandler:self
- andSelector:@selector(handleQuitEvent:withReply:)
- forEventClass:kCoreEventClass
- andEventID:kAEQuitApplication];
-}
-
-// (NSApplicationDelegate protocol) Our mechanism for application termination
-// does not go through |-applicationShouldTerminate:|, so it should not be
-// called. In a release build, cancelling termination will prevent a crash (but
-// if things go really wrong, the user may have to force-terminate the
-// application).
-- (NSApplicationTerminateReply)applicationShouldTerminate:
- (NSApplication*)sender {
- NOTREACHED();
- return NSTerminateCancel;
+ // Nothing here right now.
}
- (BOOL)tryToTerminateApplication:(NSApplication*)app {
@@ -860,13 +843,6 @@ void RecordLastRunAppBundlePath() {
return NULL;
}
-// (Private) Never call |-applicationShouldTerminate:|; just make everything go
-// through |-terminate:|.
-- (void)handleQuitEvent:(NSAppleEventDescriptor*)event
- withReply:(NSAppleEventDescriptor*)reply {
- [NSApp terminate:nil];
-}
-
// Various methods to open URLs that we get in a native fashion. We use
// BrowserInit here because on the other platforms, URLs to open come through
// the ProcessSingleton, and it calls BrowserInit. It's best to bottleneck the