| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "base/mac/cocoa_protocols.h" | 10 #import "base/mac/cocoa_protocols.h" |
| 11 #include "ui/base/models/accelerator_cocoa.h" | 11 #include "ui/base/models/accelerator_cocoa.h" |
| 12 | 12 |
| 13 @class ConfirmQuitFrameView; | 13 @class ConfirmQuitFrameView; |
| 14 | 14 |
| 15 // The ConfirmQuitPanelController manages the black HUD window that tells users | 15 // The ConfirmQuitPanelController manages the black HUD window that tells users |
| 16 // to "Hold Cmd+Q to Quit". | 16 // to "Hold Cmd+Q to Quit". |
| 17 @interface ConfirmQuitPanelController : NSWindowController<NSWindowDelegate> { | 17 @interface ConfirmQuitPanelController : NSWindowController<NSWindowDelegate> { |
| 18 @private | 18 @private |
| 19 // The content view of the window that this controller manages. | 19 // The content view of the window that this controller manages. |
| 20 ConfirmQuitFrameView* contentView_; // Weak, owned by the window. | 20 ConfirmQuitFrameView* contentView_; // Weak, owned by the window. |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Returns a singleton instance of the Controller. This will create one if it | 23 // Returns a singleton instance of the Controller. This will create one if it |
| 24 // does not currently exist. | 24 // does not currently exist. |
| 25 + (ConfirmQuitPanelController*)sharedController; | 25 + (ConfirmQuitPanelController*)sharedController; |
| 26 | 26 |
| 27 // Checks whether the |event| should trigger the feature. |
| 28 + (BOOL)eventTriggersFeature:(NSEvent*)event; |
| 29 |
| 30 // Runs a modal loop that brings up the panel and handles the logic for if and |
| 31 // when to terminate. Returns NSApplicationTerminateReply for use in |
| 32 // -[NSApplicationDelegate applicationShouldTerminate:]. |
| 33 - (NSApplicationTerminateReply)runModalLoopForApplication:(NSApplication*)app; |
| 34 |
| 27 // Shows the window. | 35 // Shows the window. |
| 28 - (void)showWindow:(id)sender; | 36 - (void)showWindow:(id)sender; |
| 29 | 37 |
| 30 // If the user did not confirm quit, send this message to give the user | 38 // If the user did not confirm quit, send this message to give the user |
| 31 // instructions on how to quit. | 39 // instructions on how to quit. |
| 32 - (void)dismissPanel; | 40 - (void)dismissPanel; |
| 33 | 41 |
| 34 // Returns the Accelerator for the Quit menu item. | 42 // Returns the Accelerator for the Quit menu item. |
| 35 + (ui::AcceleratorCocoa)quitAccelerator; | 43 + (ui::AcceleratorCocoa)quitAccelerator; |
| 36 | 44 |
| 37 @end | 45 @end |
| 38 | 46 |
| 39 @interface ConfirmQuitPanelController (UnitTesting) | 47 @interface ConfirmQuitPanelController (UnitTesting) |
| 40 - (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; | 48 - (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; |
| 41 @end | 49 @end |
| 42 | 50 |
| 43 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ | 51 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ |
| OLD | NEW |