1// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights 2// reserved. Use of this source code is governed by a BSD-style license that 3// can be found in the LICENSE file. 4 5#include "include/cef_app.h" 6#import "include/cef_application_mac.h" 7 8// Memory AutoRelease pool. 9static NSAutoreleasePool* g_autopool = nil; 10 11// Provide the CefAppProtocol implementation required by CEF. 12@interface TestApplication : NSApplication<CefAppProtocol> { 13 @private 14 BOOL handlingSendEvent_; 15} 16@end 17 18@implementation TestApplication 19- (BOOL)isHandlingSendEvent { 20 return handlingSendEvent_; 21} 22 23- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { 24 handlingSendEvent_ = handlingSendEvent; 25} 26 27- (void)sendEvent:(NSEvent*)event { 28 CefScopedSendingEvent sendingEventScoper; 29 [super sendEvent:event]; 30} 31@end 32 33void PlatformInit() { 34 // Initialize the AutoRelease pool. 35 g_autopool = [[NSAutoreleasePool alloc] init]; 36 37 // Initialize the TestApplication instance. 38 [TestApplication sharedApplication]; 39} 40 41void PlatformCleanup() { 42 // Release the AutoRelease pool. 43 [g_autopool release]; 44} 45