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

Unified Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm

Issue 11316127: Alternate NTP: Limit width of tab titles in recent tabs menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
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
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698