Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h

Issue 1419993010: chrome: Rename WrenchMenuController to AppMenuController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h"
13 #import "ui/base/cocoa/menu_controller.h"
14
15 class BookmarkMenuBridge;
16 class Browser;
17 @class BrowserActionsContainerView;
18 @class BrowserActionsController;
19 @class MenuTrackedRootView;
20 class RecentTabsMenuModelDelegate;
21 @class ToolbarController;
22 @class WrenchMenuButtonViewController;
23 class AppMenuModel;
24
25 namespace wrench_menu_controller {
26 // The vertical offset of the wrench bubbles from the wrench menu button.
27 extern const CGFloat kWrenchBubblePointOffsetY;
28 }
29
30 namespace WrenchMenuControllerInternal {
31 class AcceleratorDelegate;
32 class ToolbarActionsBarObserverHelper;
33 class ZoomLevelObserver;
34 } // namespace WrenchMenuControllerInternal
35
36 // The Wrench menu has a creative layout, with buttons in menu items. There is
37 // a cross-platform model for this special menu, but on the Mac it's easier to
38 // get spacing and alignment precisely right using a NIB. To do that, we
39 // subclass the generic MenuController implementation and special-case the two
40 // items that require specific layout and load them from the NIB.
41 //
42 // This object is owned by the ToolbarController and receives its NIB-based
43 // views using the shim view controller below.
44 @interface WrenchMenuController
45 : MenuController<NSMenuDelegate, HasWeakBrowserPointer> {
46 @private
47 // Used to provide accelerators for the menu.
48 scoped_ptr<WrenchMenuControllerInternal::AcceleratorDelegate>
49 acceleratorDelegate_;
50
51 // The model, rebuilt each time the |-menuNeedsUpdate:|.
52 scoped_ptr<AppMenuModel> appMenuModel_;
53
54 // Used to update icons in the recent tabs menu. This must be declared after
55 // |appMenuModel_| so that it gets deleted first.
56 scoped_ptr<RecentTabsMenuModelDelegate> recentTabsMenuModelDelegate_;
57
58 // A shim NSViewController that loads the buttons from the NIB because ObjC
59 // doesn't have multiple inheritance as this class is a MenuController.
60 base::scoped_nsobject<WrenchMenuButtonViewController> buttonViewController_;
61
62 // The browser for which this controller exists.
63 Browser* browser_; // weak
64
65 // Used to build the bookmark submenu.
66 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_;
67
68 // Observer for page zoom level change notifications.
69 scoped_ptr<WrenchMenuControllerInternal::ZoomLevelObserver>
70 zoom_level_observer_;
71
72 // Observer for the main window's ToolbarActionsBar changing size.
73 scoped_ptr<WrenchMenuControllerInternal::ToolbarActionsBarObserverHelper>
74 toolbar_actions_bar_observer_;
75
76 // The controller for the toolbar actions overflow that is stored in the
77 // wrench menu.
78 // This will only be present if the extension action redesign switch is on.
79 base::scoped_nsobject<BrowserActionsController> browserActionsController_;
80
81 // The menu item containing the browser actions overflow container.
82 NSMenuItem* browserActionsMenuItem_;
83 }
84
85 // Designated initializer.
86 - (id)initWithBrowser:(Browser*)browser;
87
88 // Used to dispatch commands from the Wrench menu. The custom items within the
89 // menu cannot be hooked up directly to First Responder because the window in
90 // which the controls reside is not the BrowserWindowController, but a
91 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system.
92 - (IBAction)dispatchWrenchMenuCommand:(id)sender;
93
94 // Returns the weak reference to the AppMenuModel.
95 - (AppMenuModel*)appMenuModel;
96
97 // Creates a RecentTabsMenuModelDelegate instance which will take care of
98 // updating the recent tabs submenu.
99 - (void)updateRecentTabsSubmenu;
100
101 // Updates the browser actions section of the menu.
102 - (void)updateBrowserActionsSubmenu;
103
104 // Retuns the weak reference to the BrowserActionsController.
105 - (BrowserActionsController*)browserActionsController;
106
107 @end
108
109 ////////////////////////////////////////////////////////////////////////////////
110
111 // Shim view controller that merely unpacks objects from a NIB.
112 @interface WrenchMenuButtonViewController : NSViewController {
113 @private
114 WrenchMenuController* controller_;
115
116 MenuTrackedRootView* editItem_;
117 NSButton* editCut_;
118 NSButton* editCopy_;
119 NSButton* editPaste_;
120
121 MenuTrackedRootView* zoomItem_;
122 NSButton* zoomPlus_;
123 NSButton* zoomDisplay_;
124 NSButton* zoomMinus_;
125 NSButton* zoomFullScreen_;
126
127 MenuTrackedRootView* toolbarActionsOverflowItem_;
128 BrowserActionsContainerView* overflowActionsContainerView_;
129 }
130
131 @property(assign, nonatomic) IBOutlet MenuTrackedRootView* editItem;
132 @property(assign, nonatomic) IBOutlet NSButton* editCut;
133 @property(assign, nonatomic) IBOutlet NSButton* editCopy;
134 @property(assign, nonatomic) IBOutlet NSButton* editPaste;
135 @property(assign, nonatomic) IBOutlet MenuTrackedRootView* zoomItem;
136 @property(assign, nonatomic) IBOutlet NSButton* zoomPlus;
137 @property(assign, nonatomic) IBOutlet NSButton* zoomDisplay;
138 @property(assign, nonatomic) IBOutlet NSButton* zoomMinus;
139 @property(assign, nonatomic) IBOutlet NSButton* zoomFullScreen;
140 @property(assign, nonatomic)
141 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem;
142 @property(assign, nonatomic)
143 IBOutlet BrowserActionsContainerView* overflowActionsContainerView;
144
145 - (id)initWithController:(WrenchMenuController*)controller;
146 - (IBAction)dispatchWrenchMenuCommand:(id)sender;
147
148 @end
149
150 #endif // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698