1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_
6 #define CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_
10 #import <AppKit/AppKit.h>
14 #import "base/mac/scoped_sending_event.h"
15 #import "base/message_loop/message_pump_mac.h"
16 #include "base/synchronization/lock.h"
18 @interface BrowserCrApplication
: NSApplication
<CrAppProtocol
,
19 CrAppControlProtocol
> {
21 BOOL handlingSendEvent_
;
24 // App's previous key windows. Most recent key window is last.
25 // Does not include current key window. Elements of this vector are weak
27 std::vector
<NSWindow
*> previousKeyWindows_
;
29 // Guards previousKeyWindows_.
30 base::Lock previousKeyWindowsLock_
;
33 // Our implementation of |-terminate:| only attempts to terminate the
34 // application, i.e., begins a process which may lead to termination. This
35 // method cancels that process.
36 - (void)cancelTerminate
:(id
)sender
;
38 // Keep track of the previous key windows and whether windows are being
39 // cycled for use in determining whether a Panel window can become the
41 - (NSWindow
*)previousKeyWindow
;
42 - (BOOL
)isCyclingWindows
;
45 namespace chrome_browser_application_mac
{
47 // Bin for unknown exceptions. Exposed for testing purposes.
48 extern const size_t kUnknownNSException
;
50 // Returns the histogram bin for |exception| if it is one we track
51 // specifically, or |kUnknownNSException| if unknown. Exposed for testing
53 size_t BinForException(NSException
* exception
);
55 // Use UMA to track exception occurance. Exposed for testing purposes.
56 void RecordExceptionWithUma(NSException
* exception
);
58 } // namespace chrome_browser_application_mac
62 namespace chrome_browser_application_mac
{
64 // To be used to instantiate BrowserCrApplication from C++ code.
65 void RegisterBrowserCrApp();
67 // Calls -[NSApp terminate:].
70 // Cancels a termination started by |Terminate()|.
71 void CancelTerminate();
73 } // namespace chrome_browser_application_mac
75 #endif // CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_