Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / wrench_menu / wrench_menu_controller.h
blobb8b6d368daf2eeaed6b8715c6dfb5112941cb92f
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.
5 #ifndef CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #import "ui/base/cocoa/menu_controller.h"
14 class BookmarkMenuBridge;
15 class Browser;
16 @class BrowserActionsContainerView;
17 @class BrowserActionsController;
18 @class MenuTrackedRootView;
19 class RecentTabsMenuModelDelegate;
20 @class ToolbarController;
21 @class WrenchMenuButtonViewController;
22 class WrenchMenuModel;
24 namespace wrench_menu_controller {
25 // The vertical offset of the wrench bubbles from the wrench menu button.
26 extern const CGFloat kWrenchBubblePointOffsetY;
29 namespace WrenchMenuControllerInternal {
30 class AcceleratorDelegate;
31 class ZoomLevelObserver;
32 } // namespace WrenchMenuControllerInternal
34 // The Wrench menu has a creative layout, with buttons in menu items. There is
35 // a cross-platform model for this special menu, but on the Mac it's easier to
36 // get spacing and alignment precisely right using a NIB. To do that, we
37 // subclass the generic MenuController implementation and special-case the two
38 // items that require specific layout and load them from the NIB.
40 // This object is owned by the ToolbarController and receives its NIB-based
41 // views using the shim view controller below.
42 @interface WrenchMenuController : MenuController<NSMenuDelegate> {
43 @private
44 // Used to provide accelerators for the menu.
45 scoped_ptr<WrenchMenuControllerInternal::AcceleratorDelegate>
46 acceleratorDelegate_;
48 // The model, rebuilt each time the |-menuNeedsUpdate:|.
49 scoped_ptr<WrenchMenuModel> wrenchMenuModel_;
51 // Used to update icons in the recent tabs menu. This must be declared after
52 // |wrenchMenuModel_| so that it gets deleted first.
53 scoped_ptr<RecentTabsMenuModelDelegate> recentTabsMenuModelDelegate_;
55 // A shim NSViewController that loads the buttons from the NIB because ObjC
56 // doesn't have multiple inheritance as this class is a MenuController.
57 base::scoped_nsobject<WrenchMenuButtonViewController> buttonViewController_;
59 // The browser for which this controller exists.
60 Browser* browser_; // weak
62 // Used to build the bookmark submenu.
63 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_;
65 // Observer for page zoom level change notifications.
66 scoped_ptr<WrenchMenuControllerInternal::ZoomLevelObserver> observer_;
68 // The controller for the toolbar actions overflow that is stored in the
69 // wrench menu.
70 // This will only be present if the extension action redesign switch is on.
71 base::scoped_nsobject<BrowserActionsController> browserActionsController_;
74 // Designated initializer.
75 - (id)initWithBrowser:(Browser*)browser;
77 // Used to dispatch commands from the Wrench menu. The custom items within the
78 // menu cannot be hooked up directly to First Responder because the window in
79 // which the controls reside is not the BrowserWindowController, but a
80 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system.
81 - (IBAction)dispatchWrenchMenuCommand:(id)sender;
83 // Returns the weak reference to the WrenchMenuModel.
84 - (WrenchMenuModel*)wrenchMenuModel;
86 // Creates a RecentTabsMenuModelDelegate instance which will take care of
87 // updating the recent tabs submenu.
88 - (void)updateRecentTabsSubmenu;
90 // Retuns the weak reference to the BrowserActionsController.
91 - (BrowserActionsController*)browserActionsController;
93 @end
95 ////////////////////////////////////////////////////////////////////////////////
97 // Shim view controller that merely unpacks objects from a NIB.
98 @interface WrenchMenuButtonViewController : NSViewController {
99 @private
100 WrenchMenuController* controller_;
102 MenuTrackedRootView* editItem_;
103 NSButton* editCut_;
104 NSButton* editCopy_;
105 NSButton* editPaste_;
107 MenuTrackedRootView* zoomItem_;
108 NSButton* zoomPlus_;
109 NSButton* zoomDisplay_;
110 NSButton* zoomMinus_;
111 NSButton* zoomFullScreen_;
113 MenuTrackedRootView* toolbarActionsOverflowItem_;
114 BrowserActionsContainerView* overflowActionsContainerView_;
117 @property(assign, nonatomic) IBOutlet MenuTrackedRootView* editItem;
118 @property(assign, nonatomic) IBOutlet NSButton* editCut;
119 @property(assign, nonatomic) IBOutlet NSButton* editCopy;
120 @property(assign, nonatomic) IBOutlet NSButton* editPaste;
121 @property(assign, nonatomic) IBOutlet MenuTrackedRootView* zoomItem;
122 @property(assign, nonatomic) IBOutlet NSButton* zoomPlus;
123 @property(assign, nonatomic) IBOutlet NSButton* zoomDisplay;
124 @property(assign, nonatomic) IBOutlet NSButton* zoomMinus;
125 @property(assign, nonatomic) IBOutlet NSButton* zoomFullScreen;
126 @property(assign, nonatomic)
127 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem;
128 @property(assign, nonatomic)
129 IBOutlet BrowserActionsContainerView* overflowActionsContainerView;
131 - (id)initWithController:(WrenchMenuController*)controller;
132 - (IBAction)dispatchWrenchMenuCommand:(id)sender;
134 @end
136 #endif // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_