• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_
7 
8 #import <Cocoa/Cocoa.h>
9 
10 @class ConfirmQuitFrameView;
11 
12 namespace ui {
13 class PlatformAcceleratorCocoa;
14 }
15 
16 // The ConfirmQuitPanelController manages the black HUD window that tells users
17 // to "Hold Cmd+Q to Quit".
18 @interface ConfirmQuitPanelController : NSWindowController<NSWindowDelegate> {
19  @private
20   // The content view of the window that this controller manages.
21   ConfirmQuitFrameView* contentView_;  // Weak, owned by the window.
22 }
23 
24 // Returns a singleton instance of the Controller. This will create one if it
25 // does not currently exist.
26 + (ConfirmQuitPanelController*)sharedController;
27 
28 // Checks whether the |event| should trigger the feature.
29 + (BOOL)eventTriggersFeature:(NSEvent*)event;
30 
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;
35 
36 // Shows the window.
37 - (void)showWindow:(id)sender;
38 
39 // If the user did not confirm quit, send this message to give the user
40 // instructions on how to quit.
41 - (void)dismissPanel;
42 
43 // Returns a string representation fit for display of |+quitAccelerator|.
44 + (NSString*)keyCommandString;
45 
46 @end
47 
48 @interface ConfirmQuitPanelController (UnitTesting)
49 + (NSString*)keyCombinationForAccelerator:
50     (const ui::PlatformAcceleratorCocoa&)item;
51 @end
52 
53 #endif  // CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_
54