Use Atom+sharedApplication to init CEF

This commit is contained in:
Corey Johnson 2012-05-04 10:08:38 -07:00
parent bf87f467ef
commit 7ca50efa30
3 changed files with 683 additions and 677 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,12 +13,16 @@
// Provide the CefAppProtocol implementation required by CEF.
@implementation Atom
+ (void)load {
+ (id)sharedApplication {
id atomApp = [super sharedApplication];
CefSettings settings;
AppGetSettings(settings);
CefRefPtr<CefApp> app;
CefInitialize(settings, app);
return atomApp;
}
- (void)dealloc {

View File

@ -4,17 +4,19 @@
#include "include/cef_app.h"
int main(int argc, char* argv[]) {
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
Class principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
NSApplication *application = [principalClass sharedApplication];
NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]];
[mainNib instantiateNibWithOwner:application topLevelObjects:nil];
@autoreleasepool {
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
Class principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
NSApplication *application = [principalClass sharedApplication];
// Run the application message loop.
CefRunMessageLoop();
// Don't put anything below this line because it won't be executed.
return 0;
NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]];
[mainNib instantiateNibWithOwner:application topLevelObjects:nil];
// Run the application message loop.
CefRunMessageLoop();
// Don't put anything below this line because it won't be executed.
return 0;
}
}