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

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: address review comments 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 9e823f437dfebda3b27681db8c8d51f06f16545d..59d8d16d62e1015c64fb8708c01d30ecbf97b4c6 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
@@ -43,6 +43,8 @@ using content::UserMetricsAction;
- (NSButton*)zoomDisplay;
- (void)removeAllItems:(NSMenu*)menu;
- (NSMenu*)recentTabsSubmenu;
+- (int)maxWidthForMenuModel:(ui::MenuModel*)model
+ modelIndex:(int)modelIndex;
@end
namespace WrenchMenuControllerInternal {
@@ -321,6 +323,22 @@ 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) {
+ return static_cast<RecentTabsSubMenuModel*>(
+ recentTabsMenuModel)->GetMaxWidthForItemAtIndex(modelIndex);
+ }
+ }
+ return -1;
+}
+
@end // @implementation WrenchMenuController
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/ui/cocoa/menu_controller.mm ('k') | chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698