OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APPS_APP_SHIM_MENU_CONTROLLER_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_APPS_APP_SHIM_MENU_CONTROLLER_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_APPS_APP_SHIM_MENU_CONTROLLER_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_APPS_APP_SHIM_MENU_CONTROLLER_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 | 11 |
12 // Used by AppShimMenuController to manage menu items that are a copy of a | |
13 // Chrome menu item but with a different action. This manages unsetting and | |
14 // restoring the original item's key equivalent, so that we can use the same | |
15 // key equivalent in the copied item with a different action. | |
16 @interface DoppelgangerMenuItem : NSObject { | |
tapted
2013/09/03 08:17:25
I think you can forward declare this, using
@clas
jackhou1
2013/09/04 01:31:31
Done.
| |
17 @private | |
18 base::scoped_nsobject<NSMenuItem> menuItem_; | |
19 base::scoped_nsobject<NSMenuItem> sourceItem_; | |
20 int resourceId_; | |
21 } | |
22 | |
23 @end | |
24 | |
12 // This controller listens to NSWindowDidBecomeMainNotification and | 25 // This controller listens to NSWindowDidBecomeMainNotification and |
13 // NSWindowDidResignMainNotification and modifies the main menu bar to mimic a | 26 // NSWindowDidResignMainNotification and modifies the main menu bar to mimic a |
14 // main menu for the app. When an app window becomes main, all Chrome menu items | 27 // main menu for the app. When an app window becomes main, all Chrome menu items |
15 // are hidden and menu items for the app are appended to the main menu. When the | 28 // are hidden and menu items for the app are appended to the main menu. When the |
16 // app window resigns main, its menu items are removed and all Chrome menu items | 29 // app window resigns main, its menu items are removed and all Chrome menu items |
17 // are unhidden. | 30 // are unhidden. |
18 @interface AppShimMenuController : NSObject { | 31 @interface AppShimMenuController : NSObject { |
19 @private | 32 @private |
20 // The extension id of the currently focused packaged app. | 33 // The extension id of the currently focused packaged app. |
21 base::scoped_nsobject<NSString> appId_; | 34 base::scoped_nsobject<NSString> appId_; |
22 // A reference to the "Quit Chrome" menu item. | 35 // Items that need a doppelganger. |
23 base::scoped_nsobject<NSMenuItem> chromeMenuQuitItem_; | 36 base::scoped_nsobject<DoppelgangerMenuItem> hideDoppelganger_; |
37 base::scoped_nsobject<DoppelgangerMenuItem> quitDoppelganger_; | |
24 // Menu items for the currently focused packaged app. | 38 // Menu items for the currently focused packaged app. |
25 base::scoped_nsobject<NSMenuItem> appMenuItem_; | 39 base::scoped_nsobject<NSMenuItem> appMenuItem_; |
26 base::scoped_nsobject<NSMenuItem> fileMenuItem_; | 40 base::scoped_nsobject<NSMenuItem> fileMenuItem_; |
27 base::scoped_nsobject<NSMenuItem> editMenuItem_; | 41 base::scoped_nsobject<NSMenuItem> editMenuItem_; |
28 base::scoped_nsobject<NSMenuItem> windowMenuItem_; | 42 base::scoped_nsobject<NSMenuItem> windowMenuItem_; |
29 } | 43 } |
30 | 44 |
31 @end | 45 @end |
32 | 46 |
33 #endif // CHROME_BROWSER_UI_COCOA_APPS_APP_SHIM_MENU_CONTROLLER_MAC_H_ | 47 #endif // CHROME_BROWSER_UI_COCOA_APPS_APP_SHIM_MENU_CONTROLLER_MAC_H_ |
OLD | NEW |