electron/brightray/browser/browser_main_parts_mac.mm

23 lines
736 B
Text
Raw Normal View History

2013-03-13 19:12:05 +00:00
#import "browser_main_parts.h"
#import "base/logging.h"
2013-03-13 19:12:05 +00:00
#import "base/mac/bundle_locations.h"
#import <AppKit/AppKit.h>
namespace brightray {
// Replicates NSApplicationMain, but doesn't start a run loop.
void BrowserMainParts::InitializeMainNib() {
2013-03-13 19:12:05 +00:00
auto infoDictionary = base::mac::OuterBundle().infoDictionary;
auto principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
auto application = [principalClass sharedApplication];
NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
auto mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:base::mac::FrameworkBundle()];
[mainNib instantiateWithOwner:application topLevelObjects:nil];
2013-03-13 19:12:05 +00:00
[mainNib release];
}
}