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

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

Powered by Google App Engine
This is Rietveld 408576698