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

Side by Side Diff: chrome/browser/ui/cocoa/app_menu/app_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
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_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_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 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" 12 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h"
13 #import "ui/base/cocoa/menu_controller.h" 13 #import "ui/base/cocoa/menu_controller.h"
14 14
15 class BookmarkMenuBridge; 15 class BookmarkMenuBridge;
16 class Browser; 16 class Browser;
17 @class BrowserActionsContainerView; 17 @class BrowserActionsContainerView;
18 @class BrowserActionsController; 18 @class BrowserActionsController;
19 @class MenuTrackedRootView; 19 @class MenuTrackedRootView;
20 class RecentTabsMenuModelDelegate; 20 class RecentTabsMenuModelDelegate;
21 @class ToolbarController; 21 @class ToolbarController;
22 @class WrenchMenuButtonViewController; 22 @class AppMenuButtonViewController;
23 class AppMenuModel; 23 class AppMenuModel;
Avi (use Gerrit) 2015/11/06 20:27:43 Alphabetize this mess. (Not your fault, I know.)
24 24
25 namespace wrench_menu_controller { 25 namespace app_menu_controller {
26 // The vertical offset of the wrench bubbles from the wrench menu button. 26 // The vertical offset of the app menu bubbles from the app menu button.
27 extern const CGFloat kWrenchBubblePointOffsetY; 27 extern const CGFloat kAppMenuBubblePointOffsetY;
28 } 28 }
29 29
30 namespace WrenchMenuControllerInternal { 30 namespace AppMenuControllerInternal {
31 class AcceleratorDelegate; 31 class AcceleratorDelegate;
32 class ToolbarActionsBarObserverHelper; 32 class ToolbarActionsBarObserverHelper;
33 class ZoomLevelObserver; 33 class ZoomLevelObserver;
34 } // namespace WrenchMenuControllerInternal 34 } // namespace AppMenuControllerInternal
35 35
36 // The Wrench menu has a creative layout, with buttons in menu items. There is 36 // The App menu has a creative layout, with buttons in menu items. There is
Peter Kasting 2015/11/06 22:21:28 Nit: Rewrap comments
37 // a cross-platform model for this special menu, but on the Mac it's easier to 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 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 39 // subclass the generic MenuController implementation and special-case the two
40 // items that require specific layout and load them from the NIB. 40 // items that require specific layout and load them from the NIB.
41 // 41 //
42 // This object is owned by the ToolbarController and receives its NIB-based 42 // This object is owned by the ToolbarController and receives its NIB-based
43 // views using the shim view controller below. 43 // views using the shim view controller below.
44 @interface WrenchMenuController 44 @interface AppMenuController
45 : MenuController<NSMenuDelegate, HasWeakBrowserPointer> { 45 : MenuController<NSMenuDelegate, HasWeakBrowserPointer> {
46 @private 46 @private
47 // Used to provide accelerators for the menu. 47 // Used to provide accelerators for the menu.
48 scoped_ptr<WrenchMenuControllerInternal::AcceleratorDelegate> 48 scoped_ptr<AppMenuControllerInternal::AcceleratorDelegate>
49 acceleratorDelegate_; 49 acceleratorDelegate_;
50 50
51 // The model, rebuilt each time the |-menuNeedsUpdate:|. 51 // The model, rebuilt each time the |-menuNeedsUpdate:|.
52 scoped_ptr<AppMenuModel> appMenuModel_; 52 scoped_ptr<AppMenuModel> appMenuModel_;
53 53
54 // Used to update icons in the recent tabs menu. This must be declared after 54 // Used to update icons in the recent tabs menu. This must be declared after
55 // |appMenuModel_| so that it gets deleted first. 55 // |appMenuModel_| so that it gets deleted first.
56 scoped_ptr<RecentTabsMenuModelDelegate> recentTabsMenuModelDelegate_; 56 scoped_ptr<RecentTabsMenuModelDelegate> recentTabsMenuModelDelegate_;
57 57
58 // A shim NSViewController that loads the buttons from the NIB because ObjC 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. 59 // doesn't have multiple inheritance as this class is a MenuController.
60 base::scoped_nsobject<WrenchMenuButtonViewController> buttonViewController_; 60 base::scoped_nsobject<AppMenuButtonViewController> buttonViewController_;
61 61
62 // The browser for which this controller exists. 62 // The browser for which this controller exists.
63 Browser* browser_; // weak 63 Browser* browser_; // weak
64 64
65 // Used to build the bookmark submenu. 65 // Used to build the bookmark submenu.
66 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; 66 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_;
67 67
68 // Observer for page zoom level change notifications. 68 // Observer for page zoom level change notifications.
69 scoped_ptr<WrenchMenuControllerInternal::ZoomLevelObserver> 69 scoped_ptr<AppMenuControllerInternal::ZoomLevelObserver>
70 zoom_level_observer_; 70 zoom_level_observer_;
71 71
72 // Observer for the main window's ToolbarActionsBar changing size. 72 // Observer for the main window's ToolbarActionsBar changing size.
73 scoped_ptr<WrenchMenuControllerInternal::ToolbarActionsBarObserverHelper> 73 scoped_ptr<AppMenuControllerInternal::ToolbarActionsBarObserverHelper>
74 toolbar_actions_bar_observer_; 74 toolbar_actions_bar_observer_;
75 75
76 // The controller for the toolbar actions overflow that is stored in the 76 // The controller for the toolbar actions overflow that is stored in the
77 // wrench menu. 77 // app menu.
78 // This will only be present if the extension action redesign switch is on. 78 // This will only be present if the extension action redesign switch is on.
79 base::scoped_nsobject<BrowserActionsController> browserActionsController_; 79 base::scoped_nsobject<BrowserActionsController> browserActionsController_;
80 80
81 // The menu item containing the browser actions overflow container. 81 // The menu item containing the browser actions overflow container.
82 NSMenuItem* browserActionsMenuItem_; 82 NSMenuItem* browserActionsMenuItem_;
83 } 83 }
84 84
85 // Designated initializer. 85 // Designated initializer.
86 - (id)initWithBrowser:(Browser*)browser; 86 - (id)initWithBrowser:(Browser*)browser;
87 87
88 // Used to dispatch commands from the Wrench menu. The custom items within the 88 // Used to dispatch commands from the App menu. The custom items within the
89 // menu cannot be hooked up directly to First Responder because the window in 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 90 // which the controls reside is not the BrowserWindowController, but a
91 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system. 91 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system.
92 - (IBAction)dispatchWrenchMenuCommand:(id)sender; 92 - (IBAction)dispatchAppMenuCommand:(id)sender;
93 93
94 // Returns the weak reference to the AppMenuModel. 94 // Returns the weak reference to the AppMenuModel.
95 - (AppMenuModel*)appMenuModel; 95 - (AppMenuModel*)appMenuModel;
96 96
97 // Creates a RecentTabsMenuModelDelegate instance which will take care of 97 // Creates a RecentTabsMenuModelDelegate instance which will take care of
98 // updating the recent tabs submenu. 98 // updating the recent tabs submenu.
99 - (void)updateRecentTabsSubmenu; 99 - (void)updateRecentTabsSubmenu;
100 100
101 // Updates the browser actions section of the menu. 101 // Updates the browser actions section of the menu.
102 - (void)updateBrowserActionsSubmenu; 102 - (void)updateBrowserActionsSubmenu;
103 103
104 // Retuns the weak reference to the BrowserActionsController. 104 // Retuns the weak reference to the BrowserActionsController.
105 - (BrowserActionsController*)browserActionsController; 105 - (BrowserActionsController*)browserActionsController;
106 106
107 @end 107 @end
108 108
109 //////////////////////////////////////////////////////////////////////////////// 109 ////////////////////////////////////////////////////////////////////////////////
110 110
111 // Shim view controller that merely unpacks objects from a NIB. 111 // Shim view controller that merely unpacks objects from a NIB.
112 @interface WrenchMenuButtonViewController : NSViewController { 112 @interface AppMenuButtonViewController : NSViewController {
113 @private 113 @private
114 WrenchMenuController* controller_; 114 AppMenuController* controller_;
115 115
116 MenuTrackedRootView* editItem_; 116 MenuTrackedRootView* editItem_;
117 NSButton* editCut_; 117 NSButton* editCut_;
118 NSButton* editCopy_; 118 NSButton* editCopy_;
119 NSButton* editPaste_; 119 NSButton* editPaste_;
120 120
121 MenuTrackedRootView* zoomItem_; 121 MenuTrackedRootView* zoomItem_;
122 NSButton* zoomPlus_; 122 NSButton* zoomPlus_;
123 NSButton* zoomDisplay_; 123 NSButton* zoomDisplay_;
124 NSButton* zoomMinus_; 124 NSButton* zoomMinus_;
(...skipping 10 matching lines...) Expand all
135 @property(assign, nonatomic) IBOutlet MenuTrackedRootView* zoomItem; 135 @property(assign, nonatomic) IBOutlet MenuTrackedRootView* zoomItem;
136 @property(assign, nonatomic) IBOutlet NSButton* zoomPlus; 136 @property(assign, nonatomic) IBOutlet NSButton* zoomPlus;
137 @property(assign, nonatomic) IBOutlet NSButton* zoomDisplay; 137 @property(assign, nonatomic) IBOutlet NSButton* zoomDisplay;
138 @property(assign, nonatomic) IBOutlet NSButton* zoomMinus; 138 @property(assign, nonatomic) IBOutlet NSButton* zoomMinus;
139 @property(assign, nonatomic) IBOutlet NSButton* zoomFullScreen; 139 @property(assign, nonatomic) IBOutlet NSButton* zoomFullScreen;
140 @property(assign, nonatomic) 140 @property(assign, nonatomic)
141 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem; 141 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem;
142 @property(assign, nonatomic) 142 @property(assign, nonatomic)
143 IBOutlet BrowserActionsContainerView* overflowActionsContainerView; 143 IBOutlet BrowserActionsContainerView* overflowActionsContainerView;
144 144
145 - (id)initWithController:(WrenchMenuController*)controller; 145 - (id)initWithController:(AppMenuController*)controller;
146 - (IBAction)dispatchWrenchMenuCommand:(id)sender; 146 - (IBAction)dispatchAppMenuCommand:(id)sender;
147 147
148 @end 148 @end
149 149
150 #endif // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ 150 #endif // CHROME_BROWSER_UI_COCOA_APP_MENU_APP_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698