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_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 @
class ConfirmQuitFrameView
;
13 class PlatformAcceleratorCocoa
;
16 // The ConfirmQuitPanelController manages the black HUD window that tells users
17 // to "Hold Cmd+Q to Quit".
18 @interface ConfirmQuitPanelController
: NSWindowController
<NSWindowDelegate
> {
20 // The content view of the window that this controller manages.
21 ConfirmQuitFrameView
* contentView_
; // Weak, owned by the window.
24 // Returns a singleton instance of the Controller. This will create one if it
25 // does not currently exist.
26 + (ConfirmQuitPanelController
*)sharedController
;
28 // Checks whether the |event| should trigger the feature.
29 + (BOOL
)eventTriggersFeature
:(NSEvent
*)event
;
31 // Runs a modal loop that brings up the panel and handles the logic for if and
32 // when to terminate. Returns NSApplicationTerminateReply for use in
33 // -[NSApplicationDelegate applicationShouldTerminate:].
34 - (NSApplicationTerminateReply
)runModalLoopForApplication
:(NSApplication
*)app
;
37 - (void)showWindow
:(id
)sender
;
39 // If the user did not confirm quit, send this message to give the user
40 // instructions on how to quit.
43 // Returns a string representation fit for display of |+quitAccelerator|.
44 + (NSString
*)keyCommandString
;
48 @interface
ConfirmQuitPanelController (UnitTesting
)
49 + (NSString
*)keyCombinationForAccelerator
:
50 (const ui::PlatformAcceleratorCocoa
&)item
;
53 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_