2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-05-02 12:09:19 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/atom_browser_main_parts.h"
|
2013-05-02 12:09:19 +00:00
|
|
|
|
2015-04-14 06:15:53 +00:00
|
|
|
#include "atom/browser/mac/atom_application.h"
|
|
|
|
#include "atom/browser/mac/atom_application_delegate.h"
|
|
|
|
#include "base/mac/bundle_locations.h"
|
|
|
|
#include "base/mac/foundation_util.h"
|
2014-05-29 07:54:25 +00:00
|
|
|
#include "ui/base/l10n/l10n_util_mac.h"
|
2013-05-02 12:09:19 +00:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
2014-05-29 07:54:25 +00:00
|
|
|
// Initialize locale setting.
|
|
|
|
l10n_util::OverrideLocaleWithCocoaLocale();
|
|
|
|
|
2013-05-02 12:09:19 +00:00
|
|
|
// Force the NSApplication subclass to be used.
|
|
|
|
NSApplication* application = [AtomApplication sharedApplication];
|
|
|
|
|
2014-11-16 15:04:31 +00:00
|
|
|
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
|
2014-10-25 03:06:10 +00:00
|
|
|
[NSApp setDelegate:(id<NSFileManagerDelegate>)delegate];
|
2013-05-02 12:09:19 +00:00
|
|
|
|
2015-04-14 06:15:53 +00:00
|
|
|
NSBundle* frameworkBundle = base::mac::FrameworkBundle();
|
2013-09-12 09:16:33 +00:00
|
|
|
NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu"
|
|
|
|
bundle:frameworkBundle];
|
2013-05-02 12:09:19 +00:00
|
|
|
[mainNib instantiateWithOwner:application topLevelObjects:nil];
|
|
|
|
[mainNib release];
|
2013-05-31 02:17:40 +00:00
|
|
|
|
|
|
|
// Prevent Cocoa from turning command-line arguments into
|
|
|
|
// |-application:openFiles:|, since we already handle them directly.
|
|
|
|
[[NSUserDefaults standardUserDefaults]
|
|
|
|
setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
2013-05-02 12:09:19 +00:00
|
|
|
}
|
|
|
|
|
2013-05-30 08:03:10 +00:00
|
|
|
void AtomBrowserMainParts::PostDestroyThreads() {
|
2014-11-17 01:52:24 +00:00
|
|
|
[[NSApp delegate] release];
|
|
|
|
[NSApp setDelegate:nil];
|
2013-05-30 08:03:10 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 12:09:19 +00:00
|
|
|
} // namespace atom
|