| 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 // Runs a modal loop that brings up the panel and handles the logic for if and |
| 28 // when to terminate. Returns NSApplicationTerminateReply for use in |
| 29 // -[NSApplicationDelegate applicationShouldTerminate:]. |
| 30 - (NSApplicationTerminateReply)runModalLoopForApplication:(NSApplication*)app; |
| 31 |
| 27 // Shows the window. | 32 // Shows the window. |
| 28 - (void)showWindow:(id)sender; | 33 - (void)showWindow:(id)sender; |
| 29 | 34 |
| 30 // If the user did not confirm quit, send this message to give the user | 35 // If the user did not confirm quit, send this message to give the user |
| 31 // instructions on how to quit. | 36 // instructions on how to quit. |
| 32 - (void)dismissPanel; | 37 - (void)dismissPanel; |
| 33 | 38 |
| 34 // Returns the Accelerator for the Quit menu item. | 39 // Returns the Accelerator for the Quit menu item. |
| 35 + (ui::AcceleratorCocoa)quitAccelerator; | 40 + (ui::AcceleratorCocoa)quitAccelerator; |
| 36 | 41 |
| 37 @end | 42 @end |
| 38 | 43 |
| 39 @interface ConfirmQuitPanelController (UnitTesting) | 44 @interface ConfirmQuitPanelController (UnitTesting) |
| 40 - (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; | 45 - (NSString*)keyCombinationForAccelerator:(const ui::AcceleratorCocoa&)item; |
| 41 @end | 46 @end |
| 42 | 47 |
| 43 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ | 48 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_PANEL_CONTROLLER_H_ |
| OLD | NEW |