Chromium Code Reviews| Index: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm |
| index 0223e4b4157b2e09c2ec73b67e2026c8a76b2458..92d0f5b06c64b6f08f948cd70089da165add423b 100644 |
| --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm |
| +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm |
| @@ -44,6 +44,8 @@ using content::UserMetricsAction; |
| - (NSButton*)zoomDisplay; |
| - (void)removeAllItems:(NSMenu*)menu; |
| - (NSMenu*)recentTabsSubmenu; |
| +- (int)maxWidthForMenuModel:(ui::MenuModel*)model |
| + modelIndex:(int)modelIndex; |
| @end |
| namespace WrenchMenuControllerInternal { |
| @@ -327,6 +329,21 @@ class ZoomLevelObserver : public content::NotificationObserver { |
| return [[[self menu] itemWithTitle:title] submenu]; |
| } |
| +// This overrdies the parent class to return a custom width for recent tabs |
| +// menu. |
| +- (int)maxWidthForMenuModel:(ui::MenuModel*)model |
| + modelIndex:(int)modelIndex { |
| + int index = 0; |
| + ui::MenuModel* recentTabsMenuModel = [self wrenchMenuModel]; |
| + if (ui::MenuModel::GetModelAndIndexForCommandId( |
| + IDC_RESTORE_TAB, &recentTabsMenuModel, &index)) { |
| + if (recentTabsMenuModel == model) |
|
Robert Sesek
2012/11/27 17:09:20
nit: braces needed since the body is more than one
sail
2012/11/28 07:38:25
Done.
|
| + return static_cast<RecentTabsSubMenuModel*>( |
| + recentTabsMenuModel)->GetMaxWidthForItemAtIndex(modelIndex); |
| + } |
| + return -1; |
| +} |
| + |
| @end // @implementation WrenchMenuController |
| //////////////////////////////////////////////////////////////////////////////// |