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 CHROME_BROWSER_CHROME_APPLICATION_MAC_H_ | 5 #ifndef BASE_CHROME_APPLICATION_MAC_H_ |
6 #define CHROME_BROWSER_CHROME_APPLICATION_MAC_H_ | 6 #define BASE_CHROME_APPLICATION_MAC_H_ |
7 | |
8 #ifdef __OBJC__ | |
9 | 7 |
10 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
11 | 9 |
12 @interface CrApplication : NSApplication | 10 #include "base/basictypes.h" |
| 11 |
| 12 @interface CrApplication : NSApplication { |
| 13 @private |
| 14 BOOL handlingSendEvent_; |
| 15 } |
| 16 @property(readonly, |
| 17 getter=isHandlingSendEvent, |
| 18 nonatomic) BOOL handlingSendEvent; |
| 19 |
| 20 + (NSApplication*)sharedApplication; |
13 @end | 21 @end |
14 | 22 |
15 // Namespace for exception-reporting helper functions. Exposed for | 23 namespace chrome_application_mac { |
16 // testing purposes. | |
17 namespace CrApplicationNSException { | |
18 | 24 |
19 // Bin for unknown exceptions. | 25 // Controls the state of |handlingSendEvent_| in the event loop so that it is |
20 extern const size_t kUnknownNSException; | 26 // reset properly. |
| 27 class ScopedSendingEvent { |
| 28 public: |
| 29 explicit ScopedSendingEvent(CrApplication* app); |
| 30 ~ScopedSendingEvent(); |
21 | 31 |
22 // Returns the histogram bin for |exception| if it is one we track | 32 private: |
23 // specifically, or |kUnknownNSException| if unknown. | 33 CrApplication* app_; |
24 size_t BinForException(NSException* exception); | 34 BOOL handling_; |
| 35 DISALLOW_COPY_AND_ASSIGN(ScopedSendingEvent); |
| 36 }; |
25 | 37 |
26 // Use UMA to track exception occurance. | 38 } // chrome_application_mac |
27 void RecordExceptionWithUma(NSException* exception); | |
28 | 39 |
29 } // CrApplicationNSException | 40 #endif // BASE_CHROME_APPLICATION_MAC_H_ |
30 | |
31 #endif // __OBJC__ | |
32 | |
33 // CrApplicationCC provides access to CrApplication Objective-C selectors from | |
34 // C++ code. | |
35 namespace CrApplicationCC { | |
36 | |
37 // Calls -[NSApp terminate:]. | |
38 void Terminate(); | |
39 | |
40 } // namespace CrApplicationCC | |
41 | |
42 #endif // CHROME_BROWSER_CHROME_APPLICATION_MAC_H_ | |
OLD | NEW |