summaryrefslogtreecommitdiffstats
path: root/base/chrome_application_mac.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/chrome_application_mac.h')
-rw-r--r--base/chrome_application_mac.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/base/chrome_application_mac.h b/base/chrome_application_mac.h
index d7e7989..07fd433 100644
--- a/base/chrome_application_mac.h
+++ b/base/chrome_application_mac.h
@@ -8,15 +8,35 @@
#import <AppKit/AppKit.h>
#include "base/basictypes.h"
+#include "base/scoped_nsobject.h"
+
+// Event hooks must implement this protocol.
+@protocol CrApplicationEventHookProtocol
+- (void)hookForEvent:(NSEvent*)theEvent;
+@end
+
@interface CrApplication : NSApplication {
@private
BOOL handlingSendEvent_;
+ // Array of objects implementing the CrApplicationEventHookProtocol
+ scoped_nsobject<NSMutableArray> eventHooks_;
}
@property(readonly,
getter=isHandlingSendEvent,
nonatomic) BOOL handlingSendEvent;
+// Add or remove an event hook to be called for every sendEvent:
+// that the application receives. These handlers are called before
+// the normal [NSApplication sendEvent:] call is made.
+
+// This is not a good alternative to a nested event loop. It should
+// be used only when normal event logic and notification breaks down
+// (e.g. when clicking outside a canBecomeKey:NO window to "switch
+// context" out of it).
+- (void)addEventHook:(id<CrApplicationEventHookProtocol>)hook;
+- (void)removeEventHook:(id<CrApplicationEventHookProtocol>)hook;
+
+ (NSApplication*)sharedApplication;
@end