| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/tab_menu_model.h" | 5 #include "chrome/browser/tab_menu_model.h" |
| 6 | 6 |
| 7 #include "chrome/browser/defaults.h" | 7 #include "chrome/browser/defaults.h" |
| 8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 | 10 |
| 11 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate) | 11 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate) |
| 12 : menus::SimpleMenuModel(delegate) { | 12 : menus::SimpleMenuModel(delegate) { |
| 13 Build(); | 13 Build(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 void TabMenuModel::Build() { | 16 void TabMenuModel::Build() { |
| 17 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); | 17 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); |
| 18 AddSeparator(); | 18 AddSeparator(); |
| 19 AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD); | 19 AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD); |
| 20 AddItemWithStringId(TabStripModel::CommandDuplicate, | 20 AddItemWithStringId(TabStripModel::CommandDuplicate, |
| 21 IDS_TAB_CXMENU_DUPLICATE); | 21 IDS_TAB_CXMENU_DUPLICATE); |
| 22 if (browser_defaults::kEnablePinnedTabs) { | |
| 23 // On Mac the HIG prefers "pin/unpin" to a checkmark. The Mac code will fix up | 22 // On Mac the HIG prefers "pin/unpin" to a checkmark. The Mac code will fix up |
| 24 // the actual string based on the tab's state via the delegate. | 23 // the actual string based on the tab's state via the delegate. |
| 25 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
| 26 AddItemWithStringId(TabStripModel::CommandTogglePinned, | 25 AddItemWithStringId(TabStripModel::CommandTogglePinned, |
| 27 IDS_TAB_CXMENU_PIN_TAB); | 26 IDS_TAB_CXMENU_PIN_TAB); |
| 28 #else | 27 #else |
| 29 AddCheckItemWithStringId(TabStripModel::CommandTogglePinned, | 28 AddCheckItemWithStringId(TabStripModel::CommandTogglePinned, |
| 30 IDS_TAB_CXMENU_PIN_TAB); | 29 IDS_TAB_CXMENU_PIN_TAB); |
| 31 #endif | 30 #endif |
| 32 } | |
| 33 AddSeparator(); | 31 AddSeparator(); |
| 34 AddItemWithStringId(TabStripModel::CommandCloseTab, | 32 AddItemWithStringId(TabStripModel::CommandCloseTab, |
| 35 IDS_TAB_CXMENU_CLOSETAB); | 33 IDS_TAB_CXMENU_CLOSETAB); |
| 36 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs, | 34 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs, |
| 37 IDS_TAB_CXMENU_CLOSEOTHERTABS); | 35 IDS_TAB_CXMENU_CLOSEOTHERTABS); |
| 38 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight, | 36 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight, |
| 39 IDS_TAB_CXMENU_CLOSETABSTORIGHT); | 37 IDS_TAB_CXMENU_CLOSETABSTORIGHT); |
| 40 AddItemWithStringId(TabStripModel::CommandCloseTabsOpenedBy, | 38 AddItemWithStringId(TabStripModel::CommandCloseTabsOpenedBy, |
| 41 IDS_TAB_CXMENU_CLOSETABSOPENEDBY); | 39 IDS_TAB_CXMENU_CLOSETABSOPENEDBY); |
| 42 AddSeparator(); | 40 AddSeparator(); |
| 43 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); | 41 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); |
| 44 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, | 42 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, |
| 45 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); | 43 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); |
| 46 } | 44 } |
| OLD | NEW |