2014-10-31 11:17:05 -07:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 17:49:37 +08:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-05-02 20:09:19 +08:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 08:30:26 +08:00
|
|
|
#include "atom/browser/atom_browser_main_parts.h"
|
2013-05-02 20:09:19 +08:00
|
|
|
|
2015-04-14 14:15:53 +08: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 15:54:25 +08:00
|
|
|
#include "ui/base/l10n/l10n_util_mac.h"
|
2013-05-02 20:09:19 +08:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
|
|
|
// Force the NSApplication subclass to be used.
|
2016-01-08 12:06:06 +08:00
|
|
|
[AtomApplication sharedApplication];
|
2013-05-02 20:09:19 +08:00
|
|
|
|
2016-01-08 12:06:06 +08:00
|
|
|
// Set our own application delegate.
|
2014-11-16 23:04:31 +08:00
|
|
|
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
|
2014-10-25 11:06:10 +08:00
|
|
|
[NSApp setDelegate:(id<NSFileManagerDelegate>)delegate];
|
2013-05-02 20:09:19 +08:00
|
|
|
|
2016-01-08 12:06:06 +08:00
|
|
|
brightray::BrowserMainParts::PreMainMessageLoopStart();
|
2013-05-31 10:17:40 +08: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 20:09:19 +08:00
|
|
|
}
|
|
|
|
|
2015-11-04 17:23:27 +08:00
|
|
|
void AtomBrowserMainParts::FreeAppDelegate() {
|
2014-11-17 09:52:24 +08:00
|
|
|
[[NSApp delegate] release];
|
|
|
|
[NSApp setDelegate:nil];
|
2013-05-30 16:03:10 +08:00
|
|
|
}
|
|
|
|
|
2013-05-02 20:09:19 +08:00
|
|
|
} // namespace atom
|