From b68937fb2a8f6ac8c293afa339373ff8414ae9f6 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 20 Aug 2012 15:25:17 -0700 Subject: [PATCH] Rippin' and tearin' --- atom.gyp | 10 +- tests/cefclient/cefclient_mac.h | 26 + tests/cefclient/cefclient_mac.mm | 267 ++--- .../cefclient/mac/English.lproj/MainMenu.xib | 1023 +---------------- tests/cefclient/mac/Info.plist | 2 +- tests/cefclient/main_mac.mm | 38 + 6 files changed, 206 insertions(+), 1160 deletions(-) create mode 100644 tests/cefclient/cefclient_mac.h create mode 100644 tests/cefclient/main_mac.mm diff --git a/atom.gyp b/atom.gyp index 52857c608..a23e085a4 100644 --- a/atom.gyp +++ b/atom.gyp @@ -183,11 +183,13 @@ ], }, 'sources': [ + 'tests/cefclient/main_mac.mm', + 'tests/cefclient/cefclient_mac.h', + 'tests/cefclient/cefclient_mac.mm', + 'tests/cefclient/client_handler_mac.mm', 'include/cef_application_mac.h', 'include/internal/cef_mac.h', 'include/internal/cef_types_mac.h', - 'tests/cefclient/cefclient_mac.mm', - 'tests/cefclient/client_handler_mac.mm', ], }], [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { @@ -266,15 +268,15 @@ ], }, 'sources': [ + 'tests/cefclient/client_handler_mac.mm', + 'tests/cefclient/process_helper_mac.cpp', 'tests/cefclient/client_app.cpp', 'tests/cefclient/client_app.h', 'tests/cefclient/client_app_delegates.cpp', 'tests/cefclient/client_handler.cpp', 'tests/cefclient/client_handler.h', - 'tests/cefclient/client_handler_mac.mm', 'tests/cefclient/client_renderer.cpp', 'tests/cefclient/client_renderer.h', - 'tests/cefclient/process_helper_mac.cpp', 'tests/cefclient/util.h', ], # TODO(mark): Come up with a fancier way to do this. It should only diff --git a/tests/cefclient/cefclient_mac.h b/tests/cefclient/cefclient_mac.h new file mode 100644 index 000000000..ed8ee00b5 --- /dev/null +++ b/tests/cefclient/cefclient_mac.h @@ -0,0 +1,26 @@ +#import +#include +#include "cefclient/cefclient.h" +#include "include/cef_app.h" +#import "include/cef_application_mac.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/client_handler.h" + +@interface ClientApplication : NSApplication { +@private + BOOL handlingSendEvent_; +} + +- (void)createWindow; +- (IBAction)goBack:(id)sender; +- (IBAction)goForward:(id)sender; +- (IBAction)reload:(id)sender; +- (IBAction)stopLoading:(id)sender; +- (IBAction)takeURLStringValueFrom:(NSTextField *)sender; +- (void)alert:(NSString*)title withMessage:(NSString*)message; +- (void)createApp:(id)object; +- (void)populateBrowserSettings:(CefBrowserSettings &)settings; + +@end \ No newline at end of file diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index 51abaf41a..f2f936175 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -1,8 +1,3 @@ -// Copyright (c) 2010 The Chromium Embedded Framework Authors. -// Portions copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - #import #include #include "cefclient/cefclient.h" @@ -12,11 +7,18 @@ #include "include/cef_frame.h" #include "include/cef_runnable.h" #include "cefclient/client_handler.h" +#include "cefclient/cefclient_mac.h" // The global ClientHandler reference. extern CefRefPtr g_handler; -char szWorkingDir[512]; // The current working directory +char szWorkingDir[512] = {0}; // The current working directory + +// Global functions +std::string AppGetWorkingDirectory() { + if (!szWorkingDir[0]) getcwd(szWorkingDir, sizeof(szWorkingDir)); + return szWorkingDir; +} // Sizes for URL bar layout #define BUTTON_HEIGHT 22 @@ -28,17 +30,70 @@ char szWorkingDir[512]; // The current working directory const int kWindowWidth = 800; const int kWindowHeight = 600; -// Memory AutoRelease pool. -static NSAutoreleasePool* g_autopool = nil; - -// Provide the CefAppProtocol implementation required by CEF. -@interface ClientApplication : NSApplication { -@private - BOOL handlingSendEvent_; -} -@end - @implementation ClientApplication + ++ (id)sharedApplication { + id atomApp = [super sharedApplication]; + + CefSettings settings; + + CefMainArgs mainArgs(0, NULL); + CefRefPtr app(new ClientApp); + + CefInitialize(mainArgs, settings, app.get()); + + return atomApp; +} + +// Create the application on the UI thread. +- (void)createWindow { + // Create the main application window. + NSRect screen_rect = [[NSScreen mainScreen] visibleFrame]; + NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight}, + {kWindowWidth, kWindowHeight} }; + NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc] + initWithContentRect:window_rect + styleMask:(NSTitledWindowMask | + NSClosableWindowMask | + NSMiniaturizableWindowMask | + NSResizableWindowMask ) + backing:NSBackingStoreBuffered + defer:NO]; + [mainWnd setTitle:@"cefclient"]; + [mainWnd setDelegate:self]; + + // Rely on the window delegate to clean us up rather than immediately + // releasing when the window gets closed. We use the delegate to do + // everything from the autorelease pool so the window isn't on the stack + // during cleanup (ie, a window close from javascript). + [mainWnd setReleasedWhenClosed:NO]; + + NSView* contentView = [mainWnd contentView]; + + // Create the handler. + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(contentView); + + // Create the browser view. + CefWindowInfo window_info; + CefBrowserSettings settings; + + [self populateBrowserSettings:settings]; + + window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight); + CefBrowserHost::CreateBrowser(window_info, g_handler.get(), + g_handler->GetStartupURL(), settings); + + // Show the window. + [mainWnd makeKeyAndOrderFront: nil]; + + // Size the window. + NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]]; + r.size.width = kWindowWidth; + r.size.height = kWindowHeight + URLBAR_HEIGHT; + [mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES]; +} + - (BOOL)isHandlingSendEvent { return handlingSendEvent_; } @@ -51,24 +106,6 @@ static NSAutoreleasePool* g_autopool = nil; CefScopedSendingEvent sendingEventScoper; [super sendEvent:event]; } -@end - - -// Receives notifications from controls and the browser window. Will delete -// itself when done. -@interface ClientWindowDelegate : NSObject -- (IBAction)goBack:(id)sender; -- (IBAction)goForward:(id)sender; -- (IBAction)reload:(id)sender; -- (IBAction)stopLoading:(id)sender; -- (IBAction)takeURLStringValueFrom:(NSTextField *)sender; -- (void)alert:(NSString*)title withMessage:(NSString*)message; -- (void)notifyConsoleMessage:(id)object; -- (void)notifyDownloadComplete:(id)object; -- (void)notifyDownloadError:(id)object; -@end - -@implementation ClientWindowDelegate - (IBAction)goBack:(id)sender { if (g_handler.get() && g_handler->GetBrowserId()) @@ -143,122 +180,6 @@ static NSAutoreleasePool* g_autopool = nil; [self release]; } -@end - - -NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { - NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease]; - [button setTitle:title]; - [button setBezelStyle:NSSmallSquareBezelStyle]; - [button setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)]; - [parent addSubview:button]; - rect->origin.x += BUTTON_WIDTH; - return button; -} - -// Receives notifications from the application. Will delete itself when done. -@interface ClientAppDelegate : NSObject -- (void)createApp:(id)object; -- (void)populateBrowserSettings:(CefBrowserSettings &)settings; -@end - -@implementation ClientAppDelegate - -// Create the application on the UI thread. -- (void)createApp:(id)object { - [NSApplication sharedApplication]; - [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; - - // Set the delegate for application events. - [NSApp setDelegate:self]; - - // Create the delegate for control and browser window events. - ClientWindowDelegate* delegate = [[ClientWindowDelegate alloc] init]; - - // Create the main application window. - NSRect screen_rect = [[NSScreen mainScreen] visibleFrame]; - NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight}, - {kWindowWidth, kWindowHeight} }; - NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc] - initWithContentRect:window_rect - styleMask:(NSTitledWindowMask | - NSClosableWindowMask | - NSMiniaturizableWindowMask | - NSResizableWindowMask ) - backing:NSBackingStoreBuffered - defer:NO]; - [mainWnd setTitle:@"cefclient"]; - [mainWnd setDelegate:delegate]; - - // Rely on the window delegate to clean us up rather than immediately - // releasing when the window gets closed. We use the delegate to do - // everything from the autorelease pool so the window isn't on the stack - // during cleanup (ie, a window close from javascript). - [mainWnd setReleasedWhenClosed:NO]; - - NSView* contentView = [mainWnd contentView]; - - // Create the buttons. - NSRect button_rect = [contentView bounds]; - button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT + - (URLBAR_HEIGHT - BUTTON_HEIGHT) / 2; - button_rect.size.height = BUTTON_HEIGHT; - button_rect.origin.x += BUTTON_MARGIN; - button_rect.size.width = BUTTON_WIDTH; - - NSButton* button = MakeButton(&button_rect, @"Back", contentView); - [button setTarget:delegate]; - [button setAction:@selector(goBack:)]; - - button = MakeButton(&button_rect, @"Forward", contentView); - [button setTarget:delegate]; - [button setAction:@selector(goForward:)]; - - button = MakeButton(&button_rect, @"Reload", contentView); - [button setTarget:delegate]; - [button setAction:@selector(reload:)]; - - button = MakeButton(&button_rect, @"Stop", contentView); - [button setTarget:delegate]; - [button setAction:@selector(stopLoading:)]; - - // Create the URL text field. - button_rect.origin.x += BUTTON_MARGIN; - button_rect.size.width = [contentView bounds].size.width - - button_rect.origin.x - BUTTON_MARGIN; - NSTextField* editWnd = [[NSTextField alloc] initWithFrame:button_rect]; - [contentView addSubview:editWnd]; - [editWnd setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; - [editWnd setTarget:delegate]; - [editWnd setAction:@selector(takeURLStringValueFrom:)]; - [[editWnd cell] setWraps:NO]; - [[editWnd cell] setScrollable:YES]; - - // Create the handler. - g_handler = new ClientHandler(); - g_handler->SetMainHwnd(contentView); - g_handler->SetEditHwnd(editWnd); - - // Create the browser view. - CefWindowInfo window_info; - CefBrowserSettings settings; - - [self populateBrowserSettings:settings]; - - window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight); - CefBrowserHost::CreateBrowser(window_info, g_handler.get(), - g_handler->GetStartupURL(), settings); - - // Show the window. - [mainWnd makeKeyAndOrderFront: nil]; - - // Size the window. - NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]]; - r.size.width = kWindowWidth; - r.size.height = kWindowHeight + URLBAR_HEIGHT; - [mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES]; -} - - (void)populateBrowserSettings:(CefBrowserSettings &)settings { CefString(&settings.default_encoding) = "UTF-8"; settings.remote_fonts_disabled = true; @@ -305,55 +226,11 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { // Shut down CEF. g_handler = NULL; CefShutdown(); - + [self release]; - - // Release the AutoRelease pool. - [g_autopool release]; } @end -int main(int argc, char* argv[]) { - CefMainArgs main_args(argc, argv); - CefRefPtr app(new ClientApp); - // Execute the secondary process, if any. - int exit_code = CefExecuteProcess(main_args, app.get()); - if (exit_code >= 0) - return exit_code; - - // Retrieve the current working directory. - getcwd(szWorkingDir, sizeof(szWorkingDir)); - - // Initialize the AutoRelease pool. - g_autopool = [[NSAutoreleasePool alloc] init]; - - // Initialize the ClientApplication instance. - [ClientApplication sharedApplication]; - - - CefSettings settings; - - // Initialize CEF. - CefInitialize(main_args, settings, app.get()); - - // Create the application delegate and window. - NSObject* delegate = [[ClientAppDelegate alloc] init]; - [delegate performSelectorOnMainThread:@selector(createApp:) withObject:nil - waitUntilDone:NO]; - - // Run the application message loop. - CefRunMessageLoop(); - - // Don't put anything below this line because it won't be executed. - return 0; -} - - -// Global functions - -std::string AppGetWorkingDirectory() { - return szWorkingDir; -} diff --git a/tests/cefclient/mac/English.lproj/MainMenu.xib b/tests/cefclient/mac/English.lproj/MainMenu.xib index e4f7c1fc3..196d4487b 100644 --- a/tests/cefclient/mac/English.lproj/MainMenu.xib +++ b/tests/cefclient/mac/English.lproj/MainMenu.xib @@ -2,17 +2,20 @@ 1050 - 10F569 - 820 - 1038.29 - 461.00 + 11D50d + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 820 + 2182 - + YES - + NSUserDefaultsController + NSMenu + NSMenuItem + NSCustomObject YES @@ -25,13 +28,13 @@ YES - NSApplication + ClientApplication FirstResponder - NSApplication + ClientApplication AMainMenu @@ -766,6 +769,22 @@ YES + + + delegate + + + + 440 + + + + orderFrontStandardAboutPanel: + + + + 142 + performMiniaturize: @@ -806,14 +825,6 @@ 127 - - - orderFrontStandardAboutPanel: - - - - 142 - performClose: @@ -1690,1158 +1701,255 @@ YES YES + -1.IBPluginDependency + -2.IBPluginDependency -3.IBPluginDependency 103.IBPluginDependency - 103.ImportedFromIB2 - 106.IBEditorWindowLastContentRect 106.IBPluginDependency - 106.ImportedFromIB2 - 106.editorWindowContentRectSynchronizationRect 111.IBPluginDependency - 111.ImportedFromIB2 112.IBPluginDependency - 112.ImportedFromIB2 124.IBPluginDependency - 124.ImportedFromIB2 125.IBPluginDependency - 125.ImportedFromIB2 - 125.editorWindowContentRectSynchronizationRect 126.IBPluginDependency - 126.ImportedFromIB2 129.IBPluginDependency - 129.ImportedFromIB2 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect 131.IBPluginDependency - 131.ImportedFromIB2 134.IBPluginDependency - 134.ImportedFromIB2 136.IBPluginDependency - 136.ImportedFromIB2 143.IBPluginDependency - 143.ImportedFromIB2 144.IBPluginDependency - 144.ImportedFromIB2 145.IBPluginDependency - 145.ImportedFromIB2 149.IBPluginDependency - 149.ImportedFromIB2 150.IBPluginDependency - 150.ImportedFromIB2 19.IBPluginDependency - 19.ImportedFromIB2 195.IBPluginDependency - 195.ImportedFromIB2 196.IBPluginDependency - 196.ImportedFromIB2 197.IBPluginDependency - 197.ImportedFromIB2 198.IBPluginDependency - 198.ImportedFromIB2 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBEditorWindowLastContentRect 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect 201.IBPluginDependency - 201.ImportedFromIB2 202.IBPluginDependency - 202.ImportedFromIB2 203.IBPluginDependency - 203.ImportedFromIB2 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBEditorWindowLastContentRect 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect 206.IBPluginDependency - 206.ImportedFromIB2 207.IBPluginDependency - 207.ImportedFromIB2 208.IBPluginDependency - 208.ImportedFromIB2 209.IBPluginDependency - 209.ImportedFromIB2 210.IBPluginDependency - 210.ImportedFromIB2 211.IBPluginDependency - 211.ImportedFromIB2 - 212.IBEditorWindowLastContentRect 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect 213.IBPluginDependency - 213.ImportedFromIB2 214.IBPluginDependency - 214.ImportedFromIB2 215.IBPluginDependency - 215.ImportedFromIB2 216.IBPluginDependency - 216.ImportedFromIB2 217.IBPluginDependency - 217.ImportedFromIB2 218.IBPluginDependency - 218.ImportedFromIB2 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBEditorWindowLastContentRect 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect 221.IBPluginDependency - 221.ImportedFromIB2 23.IBPluginDependency - 23.ImportedFromIB2 236.IBPluginDependency - 236.ImportedFromIB2 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBEditorWindowLastContentRect 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect 295.IBPluginDependency - 296.IBEditorWindowLastContentRect 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect 297.IBPluginDependency 298.IBPluginDependency 299.IBPluginDependency - 300.IBEditorWindowLastContentRect 300.IBPluginDependency - 300.editorWindowContentRectSynchronizationRect 344.IBPluginDependency 345.IBPluginDependency 346.IBPluginDependency - 346.ImportedFromIB2 348.IBPluginDependency - 348.ImportedFromIB2 - 349.IBEditorWindowLastContentRect 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect 350.IBPluginDependency - 350.ImportedFromIB2 351.IBPluginDependency - 351.ImportedFromIB2 354.IBPluginDependency - 354.ImportedFromIB2 389.IBPluginDependency 5.IBPluginDependency - 5.ImportedFromIB2 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect 58.IBPluginDependency - 58.ImportedFromIB2 72.IBPluginDependency - 72.ImportedFromIB2 73.IBPluginDependency - 73.ImportedFromIB2 74.IBPluginDependency - 74.ImportedFromIB2 75.IBPluginDependency - 75.ImportedFromIB2 77.IBPluginDependency - 77.ImportedFromIB2 78.IBPluginDependency - 78.ImportedFromIB2 79.IBPluginDependency - 79.ImportedFromIB2 80.IBPluginDependency - 80.ImportedFromIB2 - 81.IBEditorWindowLastContentRect 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect 82.IBPluginDependency - 82.ImportedFromIB2 83.IBPluginDependency - 83.ImportedFromIB2 92.IBPluginDependency - 92.ImportedFromIB2 - + YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - {{906, 713}, {164, 23}} com.apple.InterfaceBuilder.CocoaPlugin - - {{375, 955}, {171, 23}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{522, 812}, {146, 23}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{915, 473}, {272, 83}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{675, 493}, {240, 243}} com.apple.InterfaceBuilder.CocoaPlugin - - {{144, 735}, {243, 243}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{915, 473}, {164, 43}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{915, 473}, {238, 103}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{835, 663}, {194, 73}} com.apple.InterfaceBuilder.CocoaPlugin - - {{304, 905}, {197, 73}} - {{541, 736}, {426, 20}} com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 836}, {430, 20}} com.apple.InterfaceBuilder.CocoaPlugin - {{785, 693}, {231, 43}} com.apple.InterfaceBuilder.CocoaPlugin - {{254, 935}, {234, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{719, 693}, {173, 43}} com.apple.InterfaceBuilder.CocoaPlugin - {{188, 935}, {176, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{915, 473}, {212, 63}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{553, 553}, {193, 183}} com.apple.InterfaceBuilder.CocoaPlugin - - {{18, 653}, {200, 183}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{633, 533}, {196, 203}} com.apple.InterfaceBuilder.CocoaPlugin - - {{102, 775}, {199, 203}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin YES - - YES - + YES - - YES - + - 439 + 440 - + YES - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSController - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSController.h - - - - NSDocument - NSObject + ClientApplication + NSApplication YES YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: + goBack: + goForward: + reload: + stopLoading: + takeURLStringValueFrom: - + YES id id id id - id - id + NSTextField YES YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: + goBack: + goForward: + reload: + stopLoading: + takeURLStringValueFrom: - + YES - printDocument: + goBack: id - revertDocumentToSaved: + goForward: id - runPageLayout: + reload: id - saveDocument: + stopLoading: id - saveDocumentAs: - id - - - saveDocumentTo: - id + takeURLStringValueFrom: + NSTextField - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSDocumentController - NSObject - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - id - id - id - id - - - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - - clearRecentDocuments: - id - - - newDocument: - id - - - openDocument: - id - - - saveAllDocuments: - id - - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAlert.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAnimation.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSComboBox.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSComboBoxCell.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDatePickerCell.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSImage.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSRuleEditor.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSound.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSpeechRecognizer.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSpeechSynthesizer.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSplitView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTabView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTextStorage.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTokenField.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTokenFieldCell.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbar.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSMetadata.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSSpellServer.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - Print.framework/Headers/PDEPluginInterface.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CIImageProvider.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSTableView - NSControl - - - - NSText - NSView - - - - NSUserDefaultsController - NSController - - IBFrameworkSource - AppKit.framework/Headers/NSUserDefaultsController.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - - - NSWindow - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h + IBProjectSource + ./Classes/ClientApplication.h @@ -2852,16 +1960,11 @@ com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 YES - ../../../../cef.xcodeproj 3 YES @@ -2870,10 +1973,10 @@ NSMenuCheckmark NSMenuMixedState - + YES - {9, 8} - {7, 2} + {11, 11} + {10, 3} diff --git a/tests/cefclient/mac/Info.plist b/tests/cefclient/mac/Info.plist index 83c535e41..31732d910 100644 --- a/tests/cefclient/mac/Info.plist +++ b/tests/cefclient/mac/Info.plist @@ -23,6 +23,6 @@ NSMainNibFile MainMenu NSPrincipalClass - NSApplication + ClientApplicatoin diff --git a/tests/cefclient/main_mac.mm b/tests/cefclient/main_mac.mm new file mode 100644 index 000000000..364a8d83e --- /dev/null +++ b/tests/cefclient/main_mac.mm @@ -0,0 +1,38 @@ +#import +#include +#include "cefclient/cefclient.h" +#include "include/cef_app.h" +#import "include/cef_application_mac.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/client_handler.h" +#include "cefclient/cefclient_mac.h" + +int main(int argc, char* argv[]) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + CefMainArgs mainArgs(argc, argv); + CefRefPtr app(new ClientApp); + + int exit_code = CefExecuteProcess(mainArgs, app.get()); + if (exit_code >= 0){ + return exit_code; + } + + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; + ClientApplication *application = (ClientApplication *)[ClientApplication sharedApplication]; + + NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"]; + NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]]; + [mainNib instantiateNibWithOwner:application topLevelObjects:nil]; // Execute the secondary process, if any. + + [application createWindow]; + + // Run the application message loop. + CefRunMessageLoop(); + + [pool release]; + + // Don't put anything below this line because it won't be executed. + return 0; + } \ No newline at end of file