OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_APP_MENU_APP_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/mac/objc_property_releaser.h" | 12 #include "base/mac/objc_property_releaser.h" |
11 #import "base/mac/scoped_nsobject.h" | 13 #import "base/mac/scoped_nsobject.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" | 15 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" |
15 #import "ui/base/cocoa/menu_controller.h" | 16 #import "ui/base/cocoa/menu_controller.h" |
16 | 17 |
17 class BookmarkMenuBridge; | 18 class BookmarkMenuBridge; |
18 class Browser; | 19 class Browser; |
19 @class BrowserActionsContainerView; | 20 @class BrowserActionsContainerView; |
20 @class BrowserActionsController; | 21 @class BrowserActionsController; |
21 @class MenuTrackedRootView; | 22 @class MenuTrackedRootView; |
22 class RecentTabsMenuModelDelegate; | 23 class RecentTabsMenuModelDelegate; |
(...skipping 17 matching lines...) Expand all Loading... |
40 // get spacing and alignment precisely right using a NIB. To do that, we | 41 // get spacing and alignment precisely right using a NIB. To do that, we |
41 // subclass the generic MenuController implementation and special-case the two | 42 // subclass the generic MenuController implementation and special-case the two |
42 // items that require specific layout and load them from the NIB. | 43 // items that require specific layout and load them from the NIB. |
43 // | 44 // |
44 // This object is owned by the ToolbarController and receives its NIB-based | 45 // This object is owned by the ToolbarController and receives its NIB-based |
45 // views using the shim view controller below. | 46 // views using the shim view controller below. |
46 @interface AppMenuController | 47 @interface AppMenuController |
47 : MenuController<NSMenuDelegate, HasWeakBrowserPointer> { | 48 : MenuController<NSMenuDelegate, HasWeakBrowserPointer> { |
48 @private | 49 @private |
49 // Used to provide accelerators for the menu. | 50 // Used to provide accelerators for the menu. |
50 scoped_ptr<AppMenuControllerInternal::AcceleratorDelegate> | 51 std::unique_ptr<AppMenuControllerInternal::AcceleratorDelegate> |
51 acceleratorDelegate_; | 52 acceleratorDelegate_; |
52 | 53 |
53 // The model, rebuilt each time the |-menuNeedsUpdate:|. | 54 // The model, rebuilt each time the |-menuNeedsUpdate:|. |
54 scoped_ptr<AppMenuModel> appMenuModel_; | 55 std::unique_ptr<AppMenuModel> appMenuModel_; |
55 | 56 |
56 // Used to update icons in the recent tabs menu. This must be declared after | 57 // Used to update icons in the recent tabs menu. This must be declared after |
57 // |appMenuModel_| so that it gets deleted first. | 58 // |appMenuModel_| so that it gets deleted first. |
58 scoped_ptr<RecentTabsMenuModelDelegate> recentTabsMenuModelDelegate_; | 59 std::unique_ptr<RecentTabsMenuModelDelegate> recentTabsMenuModelDelegate_; |
59 | 60 |
60 // A shim NSViewController that loads the buttons from the NIB because ObjC | 61 // A shim NSViewController that loads the buttons from the NIB because ObjC |
61 // doesn't have multiple inheritance as this class is a MenuController. | 62 // doesn't have multiple inheritance as this class is a MenuController. |
62 base::scoped_nsobject<AppMenuButtonViewController> buttonViewController_; | 63 base::scoped_nsobject<AppMenuButtonViewController> buttonViewController_; |
63 | 64 |
64 // The browser for which this controller exists. | 65 // The browser for which this controller exists. |
65 Browser* browser_; // weak | 66 Browser* browser_; // weak |
66 | 67 |
67 // Used to build the bookmark submenu. | 68 // Used to build the bookmark submenu. |
68 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; | 69 std::unique_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; |
69 | 70 |
70 // Observer for page zoom level change notifications. | 71 // Observer for page zoom level change notifications. |
71 scoped_ptr<AppMenuControllerInternal::ZoomLevelObserver> | 72 std::unique_ptr<AppMenuControllerInternal::ZoomLevelObserver> |
72 zoom_level_observer_; | 73 zoom_level_observer_; |
73 | 74 |
74 // Observer for the main window's ToolbarActionsBar changing size. | 75 // Observer for the main window's ToolbarActionsBar changing size. |
75 scoped_ptr<AppMenuControllerInternal::ToolbarActionsBarObserverHelper> | 76 std::unique_ptr<AppMenuControllerInternal::ToolbarActionsBarObserverHelper> |
76 toolbar_actions_bar_observer_; | 77 toolbar_actions_bar_observer_; |
77 | 78 |
78 // The controller for the toolbar actions overflow that is stored in the | 79 // The controller for the toolbar actions overflow that is stored in the |
79 // app menu. | 80 // app menu. |
80 // This will only be present if the extension action redesign switch is on. | 81 // This will only be present if the extension action redesign switch is on. |
81 base::scoped_nsobject<BrowserActionsController> browserActionsController_; | 82 base::scoped_nsobject<BrowserActionsController> browserActionsController_; |
82 | 83 |
83 // The menu item containing the browser actions overflow container. | 84 // The menu item containing the browser actions overflow container. |
84 NSMenuItem* browserActionsMenuItem_; | 85 NSMenuItem* browserActionsMenuItem_; |
85 | 86 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem; | 149 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem; |
149 @property(retain, nonatomic) | 150 @property(retain, nonatomic) |
150 IBOutlet BrowserActionsContainerView* overflowActionsContainerView; | 151 IBOutlet BrowserActionsContainerView* overflowActionsContainerView; |
151 | 152 |
152 - (id)initWithController:(AppMenuController*)controller; | 153 - (id)initWithController:(AppMenuController*)controller; |
153 - (IBAction)dispatchAppMenuCommand:(id)sender; | 154 - (IBAction)dispatchAppMenuCommand:(id)sender; |
154 | 155 |
155 @end | 156 @end |
156 | 157 |
157 #endif // CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_ | 158 #endif // CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_ |
OLD | NEW |