OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_CHROME_APPLICATION_MAC_H_ | 5 #ifndef BASE_CHROME_APPLICATION_MAC_H_ |
6 #define BASE_CHROME_APPLICATION_MAC_H_ | 6 #define BASE_CHROME_APPLICATION_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <AppKit/AppKit.h> | 9 #import <AppKit/AppKit.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/scoped_nsobject.h" | 12 #include "base/scoped_nsobject.h" |
13 | 13 |
14 // Event hooks must implement this protocol. | 14 // Event hooks must implement this protocol. |
15 @protocol CrApplicationEventHookProtocol | 15 @protocol CrApplicationEventHookProtocol |
16 - (void)hookForEvent:(NSEvent*)theEvent; | 16 - (void)hookForEvent:(NSEvent*)theEvent; |
17 @end | 17 @end |
18 | 18 |
19 | 19 |
20 @interface CrApplication : NSApplication { | 20 @interface CrApplication : NSApplication { |
21 @private | 21 @private |
22 BOOL handlingSendEvent_; | 22 BOOL handlingSendEvent_; |
23 // Array of objects implementing the CrApplicationEventHookProtocol | 23 // Array of objects implementing the CrApplicationEventHookProtocol |
24 scoped_nsobject<NSMutableArray> eventHooks_; | 24 scoped_nsobject<NSMutableArray> eventHooks_; |
25 } | 25 } |
26 @property(readonly, | 26 @property(readonly, |
27 getter=isHandlingSendEvent, | 27 getter=isHandlingSendEvent, |
28 nonatomic) BOOL handlingSendEvent; | 28 nonatomic) BOOL handlingSendEvent; |
29 | 29 |
30 // Add or remove an event hook to be called for every sendEvent: | 30 // Add or remove an event hook to be called for every sendEvent: |
31 // that the application receives. These handlers are called before | 31 // that the application receives. These handlers are called before |
32 // the normal [NSApplication sendEvent:] call is made. | 32 // the normal [NSApplication sendEvent:] call is made. |
33 | 33 |
(...skipping 18 matching lines...) Expand all Loading... |
52 | 52 |
53 private: | 53 private: |
54 CrApplication* app_; | 54 CrApplication* app_; |
55 BOOL handling_; | 55 BOOL handling_; |
56 DISALLOW_COPY_AND_ASSIGN(ScopedSendingEvent); | 56 DISALLOW_COPY_AND_ASSIGN(ScopedSendingEvent); |
57 }; | 57 }; |
58 | 58 |
59 } // chrome_application_mac | 59 } // chrome_application_mac |
60 | 60 |
61 #endif // BASE_CHROME_APPLICATION_MAC_H_ | 61 #endif // BASE_CHROME_APPLICATION_MAC_H_ |
OLD | NEW |