| 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_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 @class WrenchMenuButtonViewController; | 22 @class WrenchMenuButtonViewController; |
| 23 class WrenchMenuModel; | 23 class WrenchMenuModel; |
| 24 | 24 |
| 25 namespace wrench_menu_controller { | 25 namespace wrench_menu_controller { |
| 26 // The vertical offset of the wrench bubbles from the wrench menu button. | 26 // The vertical offset of the wrench bubbles from the wrench menu button. |
| 27 extern const CGFloat kWrenchBubblePointOffsetY; | 27 extern const CGFloat kWrenchBubblePointOffsetY; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace WrenchMenuControllerInternal { | 30 namespace WrenchMenuControllerInternal { |
| 31 class AcceleratorDelegate; | 31 class AcceleratorDelegate; |
| 32 class ToolbarActionsBarObserverHelper; |
| 32 class ZoomLevelObserver; | 33 class ZoomLevelObserver; |
| 33 } // namespace WrenchMenuControllerInternal | 34 } // namespace WrenchMenuControllerInternal |
| 34 | 35 |
| 35 // The Wrench menu has a creative layout, with buttons in menu items. There is | 36 // The Wrench menu has a creative layout, with buttons in menu items. There is |
| 36 // 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 |
| 37 // 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 |
| 38 // subclass the generic MenuController implementation and special-case the two | 39 // subclass the generic MenuController implementation and special-case the two |
| 39 // items that require specific layout and load them from the NIB. | 40 // items that require specific layout and load them from the NIB. |
| 40 // | 41 // |
| 41 // 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 58 // doesn't have multiple inheritance as this class is a MenuController. | 59 // doesn't have multiple inheritance as this class is a MenuController. |
| 59 base::scoped_nsobject<WrenchMenuButtonViewController> buttonViewController_; | 60 base::scoped_nsobject<WrenchMenuButtonViewController> buttonViewController_; |
| 60 | 61 |
| 61 // The browser for which this controller exists. | 62 // The browser for which this controller exists. |
| 62 Browser* browser_; // weak | 63 Browser* browser_; // weak |
| 63 | 64 |
| 64 // Used to build the bookmark submenu. | 65 // Used to build the bookmark submenu. |
| 65 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; | 66 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; |
| 66 | 67 |
| 67 // Observer for page zoom level change notifications. | 68 // Observer for page zoom level change notifications. |
| 68 scoped_ptr<WrenchMenuControllerInternal::ZoomLevelObserver> observer_; | 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_; |
| 69 | 75 |
| 70 // 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 |
| 71 // wrench menu. | 77 // wrench menu. |
| 72 // 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. |
| 73 base::scoped_nsobject<BrowserActionsController> browserActionsController_; | 79 base::scoped_nsobject<BrowserActionsController> browserActionsController_; |
| 74 | 80 |
| 75 // The menu item containing the browser actions overflow container. | 81 // The menu item containing the browser actions overflow container. |
| 76 NSMenuItem* browserActionsMenuItem_; | 82 NSMenuItem* browserActionsMenuItem_; |
| 77 } | 83 } |
| 78 | 84 |
| 79 // Designated initializer. | 85 // Designated initializer. |
| 80 - (id)initWithBrowser:(Browser*)browser; | 86 - (id)initWithBrowser:(Browser*)browser; |
| 81 | 87 |
| 82 // Used to dispatch commands from the Wrench menu. The custom items within the | 88 // Used to dispatch commands from the Wrench menu. The custom items within the |
| 83 // 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 |
| 84 // which the controls reside is not the BrowserWindowController, but a | 90 // which the controls reside is not the BrowserWindowController, but a |
| 85 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system. | 91 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system. |
| 86 - (IBAction)dispatchWrenchMenuCommand:(id)sender; | 92 - (IBAction)dispatchWrenchMenuCommand:(id)sender; |
| 87 | 93 |
| 88 // Returns the weak reference to the WrenchMenuModel. | 94 // Returns the weak reference to the WrenchMenuModel. |
| 89 - (WrenchMenuModel*)wrenchMenuModel; | 95 - (WrenchMenuModel*)wrenchMenuModel; |
| 90 | 96 |
| 91 // Creates a RecentTabsMenuModelDelegate instance which will take care of | 97 // Creates a RecentTabsMenuModelDelegate instance which will take care of |
| 92 // updating the recent tabs submenu. | 98 // updating the recent tabs submenu. |
| 93 - (void)updateRecentTabsSubmenu; | 99 - (void)updateRecentTabsSubmenu; |
| 94 | 100 |
| 101 // Updates the browser actions section of the menu. |
| 102 - (void)updateBrowserActionsSubmenu; |
| 103 |
| 95 // Retuns the weak reference to the BrowserActionsController. | 104 // Retuns the weak reference to the BrowserActionsController. |
| 96 - (BrowserActionsController*)browserActionsController; | 105 - (BrowserActionsController*)browserActionsController; |
| 97 | 106 |
| 98 @end | 107 @end |
| 99 | 108 |
| 100 //////////////////////////////////////////////////////////////////////////////// | 109 //////////////////////////////////////////////////////////////////////////////// |
| 101 | 110 |
| 102 // Shim view controller that merely unpacks objects from a NIB. | 111 // Shim view controller that merely unpacks objects from a NIB. |
| 103 @interface WrenchMenuButtonViewController : NSViewController { | 112 @interface WrenchMenuButtonViewController : NSViewController { |
| 104 @private | 113 @private |
| (...skipping 27 matching lines...) Expand all Loading... |
| 132 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem; | 141 IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem; |
| 133 @property(assign, nonatomic) | 142 @property(assign, nonatomic) |
| 134 IBOutlet BrowserActionsContainerView* overflowActionsContainerView; | 143 IBOutlet BrowserActionsContainerView* overflowActionsContainerView; |
| 135 | 144 |
| 136 - (id)initWithController:(WrenchMenuController*)controller; | 145 - (id)initWithController:(WrenchMenuController*)controller; |
| 137 - (IBAction)dispatchWrenchMenuCommand:(id)sender; | 146 - (IBAction)dispatchWrenchMenuCommand:(id)sender; |
| 138 | 147 |
| 139 @end | 148 @end |
| 140 | 149 |
| 141 #endif // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ | 150 #endif // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_WRENCH_MENU_CONTROLLER_H_ |
| OLD | NEW |