Index: content/public/browser/event_hook_application_mac.h |
diff --git a/content/public/browser/event_hook_application_mac.h b/content/public/browser/event_hook_application_mac.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..767f83f869c4b00c0be1127246d712841db766fc |
--- /dev/null |
+++ b/content/public/browser/event_hook_application_mac.h |
@@ -0,0 +1,42 @@ |
+// Copyright (c) 2012 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. |
+ |
+#ifndef CONTENT_PUBLIC_BROWSER_EVENT_HOOK_APPLICATION_MAC_H_ |
+#define CONTENT_PUBLIC_BROWSER_EVENT_HOOK_APPLICATION_MAC_H_ |
+ |
+#ifdef __OBJC__ |
+ |
+#import <AppKit/AppKit.h> |
+ |
+#include <vector> |
+ |
+#import "base/memory/scoped_nsobject.h" |
+ |
+// Event hooks must implement this protocol. |
+@protocol EventHookProtocol |
+- (void)hookForEvent:(NSEvent*)theEvent; |
+@end |
+ |
+@interface EventHookApplication : NSApplication { |
+ @private |
+ // Array of objects implementing EventHookProtocol. |
+ scoped_nsobject<NSMutableArray> eventHooks_; |
+} |
+ |
+// 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<EventHookProtocol>)hook; |
+- (void)removeEventHook:(id<EventHookProtocol>)hook; |
+ |
+@end |
+ |
+#endif |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_EVENT_HOOK_APPLICATION_MAC_H_ |