Emit 'finish-launching' event when the application has finished launching.

This commit is contained in:
Cheng Zhao 2013-05-30 19:12:14 +08:00
parent 7dd48e24d3
commit 4133fc28d9
10 changed files with 28 additions and 10 deletions

View file

@ -4,21 +4,27 @@
#import "browser/atom_application_delegate_mac.h"
#include "base/strings/sys_string_conversions.h"
#import "browser/atom_application_mac.h"
#include "browser/browser.h"
@implementation AtomApplicationDelegate
- (void)applicationDidFinishLaunching:(NSNotification*)notify {
// Trap the quit message to handleQuitEvent.
NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager];
[em setEventHandler:self
andSelector:@selector(handleQuitEvent:withReplyEvent:)
forEventClass:kCoreEventClass
andEventID:kAEQuitApplication];
atom::Browser::Get()->DidFinishLaunching();
}
- (BOOL)application:(NSApplication*)sender
openFile:(NSString*)filename {
return [[AtomApplication sharedApplication] openFile:filename];
std::string filename_str(base::SysNSStringToUTF8(filename));
return atom::Browser::Get()->OpenFile(filename_str) ? YES : NO;
}
- (void)handleQuitEvent:(NSAppleEventDescriptor*)event