| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
| 8 #ifdef __OBJC__ | 8 #ifdef __OBJC__ |
| 9 | 9 |
| 10 #import <AppKit/AppKit.h> | 10 #import <AppKit/AppKit.h> |
| 11 #include <stddef.h> | 11 #include <stddef.h> |
| 12 | 12 |
| 13 #include <vector> | |
| 14 | |
| 15 #import "base/mac/scoped_sending_event.h" | 13 #import "base/mac/scoped_sending_event.h" |
| 16 #import "base/message_loop/message_pump_mac.h" | 14 #import "base/message_loop/message_pump_mac.h" |
| 17 #include "base/synchronization/lock.h" | |
| 18 | 15 |
| 19 @interface BrowserCrApplication : NSApplication<CrAppProtocol, | 16 @interface BrowserCrApplication : NSApplication<CrAppProtocol, |
| 20 CrAppControlProtocol> { | 17 CrAppControlProtocol> { |
| 21 @private | 18 @private |
| 22 BOOL handlingSendEvent_; | 19 BOOL handlingSendEvent_; |
| 23 BOOL cyclingWindows_; | 20 BOOL cyclingWindows_; |
| 24 | |
| 25 // App's previous key windows. Most recent key window is last. | |
| 26 // Does not include current key window. Elements of this vector are weak | |
| 27 // references. | |
| 28 std::vector<NSWindow*> previousKeyWindows_; | |
| 29 | |
| 30 // Guards previousKeyWindows_. | |
| 31 base::Lock previousKeyWindowsLock_; | |
| 32 } | 21 } |
| 33 | 22 |
| 34 // Our implementation of |-terminate:| only attempts to terminate the | 23 // Our implementation of |-terminate:| only attempts to terminate the |
| 35 // 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 |
| 36 // method cancels that process. | 25 // method cancels that process. |
| 37 - (void)cancelTerminate:(id)sender; | 26 - (void)cancelTerminate:(id)sender; |
| 38 | 27 |
| 39 // Keep track of the previous key windows and whether windows are being | 28 // Keep track of whether windows are being cycled for use in determining whether |
| 40 // cycled for use in determining whether a Panel window can become the | 29 // a Panel window can become the key window. |
| 41 // key window. | |
| 42 - (NSWindow*)previousKeyWindow; | |
| 43 - (BOOL)isCyclingWindows; | 30 - (BOOL)isCyclingWindows; |
| 44 @end | 31 @end |
| 45 | 32 |
| 46 namespace chrome_browser_application_mac { | 33 namespace chrome_browser_application_mac { |
| 47 | 34 |
| 48 // Bin for unknown exceptions. Exposed for testing purposes. | 35 // Bin for unknown exceptions. Exposed for testing purposes. |
| 49 extern const size_t kUnknownNSException; | 36 extern const size_t kUnknownNSException; |
| 50 | 37 |
| 51 // Returns the histogram bin for |exception| if it is one we track | 38 // Returns the histogram bin for |exception| if it is one we track |
| 52 // specifically, or |kUnknownNSException| if unknown. Exposed for testing | 39 // specifically, or |kUnknownNSException| if unknown. Exposed for testing |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 | 54 |
| 68 // Calls -[NSApp terminate:]. | 55 // Calls -[NSApp terminate:]. |
| 69 void Terminate(); | 56 void Terminate(); |
| 70 | 57 |
| 71 // Cancels a termination started by |Terminate()|. | 58 // Cancels a termination started by |Terminate()|. |
| 72 void CancelTerminate(); | 59 void CancelTerminate(); |
| 73 | 60 |
| 74 } // namespace chrome_browser_application_mac | 61 } // namespace chrome_browser_application_mac |
| 75 | 62 |
| 76 #endif // CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ | 63 #endif // CHROME_BROWSER_CHROME_BROWSER_APPLICATION_MAC_H_ |
| OLD | NEW |