OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ | 5 #ifndef CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ |
6 #define CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ | 6 #define CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #ifdef __OBJC__ | 9 #ifdef __OBJC__ |
10 | 10 |
11 #import "content/common/chrome_application_mac.h" | 11 #import "content/common/chrome_application_mac.h" |
12 | 12 |
13 @interface BrowserCrApplication : CrApplication | 13 // Event hooks must implement this protocol. |
14 @protocol CrApplicationEventHookProtocol | |
15 - (void)hookForEvent:(NSEvent*)theEvent; | |
16 @end | |
17 | |
18 @interface BrowserCrApplication : CrApplication { | |
Robert Sesek
2011/11/09 18:38:59
@private
Scott Hess - ex-Googler
2011/11/09 18:48:32
Done. If you haven't noticed, I get dinged for th
| |
19 // Array of objects implementing CrApplicationEventHookProtocol. | |
20 scoped_nsobject<NSMutableArray> eventHooks_; | |
21 } | |
22 | |
14 // Our implementation of |-terminate:| only attempts to terminate the | 23 // Our implementation of |-terminate:| only attempts to terminate the |
15 // application, i.e., begins a process which may lead to termination. This | 24 // application, i.e., begins a process which may lead to termination. This |
16 // method cancels that process. | 25 // method cancels that process. |
17 - (void)cancelTerminate:(id)sender; | 26 - (void)cancelTerminate:(id)sender; |
27 | |
28 // Add or remove an event hook to be called for every sendEvent: | |
29 // that the application receives. These handlers are called before | |
30 // the normal [NSApplication sendEvent:] call is made. | |
31 | |
32 // This is not a good alternative to a nested event loop. It should | |
33 // be used only when normal event logic and notification breaks down | |
34 // (e.g. when clicking outside a canBecomeKey:NO window to "switch | |
35 // context" out of it). | |
36 - (void)addEventHook:(id<CrApplicationEventHookProtocol>)hook; | |
37 - (void)removeEventHook:(id<CrApplicationEventHookProtocol>)hook; | |
18 @end | 38 @end |
19 | 39 |
20 namespace chrome_browser_application_mac { | 40 namespace chrome_browser_application_mac { |
21 | 41 |
22 // Bin for unknown exceptions. Exposed for testing purposes. | 42 // Bin for unknown exceptions. Exposed for testing purposes. |
23 extern const size_t kUnknownNSException; | 43 extern const size_t kUnknownNSException; |
24 | 44 |
25 // Returns the histogram bin for |exception| if it is one we track | 45 // Returns the histogram bin for |exception| if it is one we track |
26 // specifically, or |kUnknownNSException| if unknown. Exposed for testing | 46 // specifically, or |kUnknownNSException| if unknown. Exposed for testing |
27 // purposes. | 47 // purposes. |
(...skipping 13 matching lines...) Expand all Loading... | |
41 | 61 |
42 // Calls -[NSApp terminate:]. | 62 // Calls -[NSApp terminate:]. |
43 void Terminate(); | 63 void Terminate(); |
44 | 64 |
45 // Cancels a termination started by |Terminate()|. | 65 // Cancels a termination started by |Terminate()|. |
46 void CancelTerminate(); | 66 void CancelTerminate(); |
47 | 67 |
48 } // namespace chrome_browser_application_mac | 68 } // namespace chrome_browser_application_mac |
49 | 69 |
50 #endif // CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ | 70 #endif // CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ |
OLD | NEW |