From a412f079d759615f9e4273ec3e4f555c166ef883 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 16 Sep 2011 16:17:19 +0000 Subject: [PATCH] Mac: Fix 10.6 SDK compile errors due to delegate protocol requirement. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@287 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- include/cef_application_mac.h | 38 ++++++++++++++++++++++++++++++++ libcef/browser_webview_mac.h | 3 ++- tests/cefclient/cefclient_mac.mm | 4 ++-- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/include/cef_application_mac.h b/include/cef_application_mac.h index 3c0b59b43..aa8547ad8 100644 --- a/include/cef_application_mac.h +++ b/include/cef_application_mac.h @@ -40,9 +40,13 @@ // Use the existing CrAppProtocol definition. #include "base/message_pump_mac.h" +// Use the existing empty protocol definitions. +#import "base/mac/cocoa_protocols.h" + #else // BUILDING_CEF_SHARED #import +#import // Copy of CrAppProtocol definition from base/message_pump_mac.h. @protocol CrAppProtocol @@ -50,6 +54,40 @@ - (BOOL)isHandlingSendEvent; @end +// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These +// protocol defintions were not present in earlier releases of the Mac OS X +// SDK. In order to support building against the new SDK, which requires +// delegates to conform to these protocols, and earlier SDKs, which do not +// define these protocols at all, this file will provide empty protocol +// definitions when used with earlier SDK versions. + +#if !defined(MAC_OS_X_VERSION_10_6) || \ +MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 + +#define DEFINE_EMPTY_PROTOCOL(p) \ +@protocol p \ +@end + +DEFINE_EMPTY_PROTOCOL(NSAlertDelegate) +DEFINE_EMPTY_PROTOCOL(NSApplicationDelegate) +DEFINE_EMPTY_PROTOCOL(NSControlTextEditingDelegate) +DEFINE_EMPTY_PROTOCOL(NSMatrixDelegate) +DEFINE_EMPTY_PROTOCOL(NSMenuDelegate) +DEFINE_EMPTY_PROTOCOL(NSOpenSavePanelDelegate) +DEFINE_EMPTY_PROTOCOL(NSOutlineViewDataSource) +DEFINE_EMPTY_PROTOCOL(NSOutlineViewDelegate) +DEFINE_EMPTY_PROTOCOL(NSSpeechSynthesizerDelegate) +DEFINE_EMPTY_PROTOCOL(NSSplitViewDelegate) +DEFINE_EMPTY_PROTOCOL(NSTableViewDataSource) +DEFINE_EMPTY_PROTOCOL(NSTableViewDelegate) +DEFINE_EMPTY_PROTOCOL(NSTextFieldDelegate) +DEFINE_EMPTY_PROTOCOL(NSTextViewDelegate) +DEFINE_EMPTY_PROTOCOL(NSWindowDelegate) + +#undef DEFINE_EMPTY_PROTOCOL + +#endif + #endif // BUILDING_CEF_SHARED // All CEF client applications must subclass NSApplication and implement this diff --git a/libcef/browser_webview_mac.h b/libcef/browser_webview_mac.h index 19920509a..2abdf05ce 100644 --- a/libcef/browser_webview_mac.h +++ b/libcef/browser_webview_mac.h @@ -3,6 +3,7 @@ // found in the LICENSE file. #import +#import "base/mac/cocoa_protocols.h" #include "base/memory/scoped_nsobject.h" class CefBrowserImpl; @@ -13,7 +14,7 @@ struct WebDropData; // A view to wrap the WebCore view and help it live in a Cocoa world. The // (rough) equivalent of Apple's WebView. -@interface BrowserWebView : NSView { +@interface BrowserWebView : NSView { @private CefBrowserImpl *browser_; // weak NSTrackingArea *trackingArea_; diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index 72d0841ef..7f40cb7c0 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -58,7 +58,7 @@ static NSAutoreleasePool* g_autopool = nil; // Receives notifications from controls and the browser window. Will delete // itself when done. -@interface ClientWindowDelegate : NSObject +@interface ClientWindowDelegate : NSObject - (IBAction)goBack:(id)sender; - (IBAction)goForward:(id)sender; - (IBAction)reload:(id)sender; @@ -286,7 +286,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { [menubar addItem:testItem]; // Create the delegate for control and browser window events. - NSObject* delegate = [[ClientWindowDelegate alloc] init]; + ClientWindowDelegate* delegate = [[ClientWindowDelegate alloc] init]; // Create the main application window. NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];