1 // Copyright (c) 2013 GitHub, Inc.
2 // Use of this source code is governed by the MIT license that can be
3 // found in the LICENSE file.
5 #include "atom/browser/atom_browser_main_parts.h"
7 #include "atom/browser/mac/atom_application.h"
8 #include "atom/browser/mac/atom_application_delegate.h"
9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h"
11 #include "ui/base/l10n/l10n_util_mac.h"
15 void AtomBrowserMainParts::PreMainMessageLoopStart() {
16 // Force the NSApplication subclass to be used.
17 [AtomApplication sharedApplication];
19 // Set our own application delegate.
20 AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
21 [NSApp setDelegate:delegate];
23 brightray::BrowserMainParts::PreMainMessageLoopStart();
25 // Prevent Cocoa from turning command-line arguments into
26 // |-application:openFiles:|, since we already handle them directly.
27 [[NSUserDefaults standardUserDefaults]
28 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
31 void AtomBrowserMainParts::FreeAppDelegate() {
32 [[NSApp delegate] release];
33 [NSApp setDelegate:nil];