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
This commit is contained in:
Marshall Greenblatt 2011-09-16 16:17:19 +00:00
parent 44946a7752
commit a412f079d7
3 changed files with 42 additions and 3 deletions

View File

@ -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 <AppKit/AppKit.h>
#import <Cocoa/Cocoa.h>
// 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

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>
#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 <NSMenuDelegate> {
@private
CefBrowserImpl *browser_; // weak
NSTrackingArea *trackingArea_;

View File

@ -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 <NSWindowDelegate>
- (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];