| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/tab_menu_model.h" | |
| 6 | |
| 7 #include "base/command_line.h" | |
| 8 #include "chrome/browser/tabs/tab_strip_model.h" | |
| 9 #include "chrome/common/chrome_switches.h" | |
| 10 #include "chrome/common/pref_names.h" | |
| 11 #include "grit/generated_resources.h" | |
| 12 | |
| 13 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate, | |
| 14 bool is_pinned) | |
| 15 : menus::SimpleMenuModel(delegate) { | |
| 16 Build(is_pinned); | |
| 17 } | |
| 18 | |
| 19 // static | |
| 20 bool TabMenuModel::AreVerticalTabsEnabled() { | |
| 21 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) || defined(OS_CHROMEOS) | |
| 22 return CommandLine::ForCurrentProcess()->HasSwitch( | |
| 23 switches::kEnableVerticalTabs); | |
| 24 #else | |
| 25 return false; | |
| 26 #endif | |
| 27 } | |
| 28 | |
| 29 void TabMenuModel::Build(bool is_pinned) { | |
| 30 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); | |
| 31 AddSeparator(); | |
| 32 AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD); | |
| 33 AddItemWithStringId(TabStripModel::CommandDuplicate, | |
| 34 IDS_TAB_CXMENU_DUPLICATE); | |
| 35 AddItemWithStringId( | |
| 36 TabStripModel::CommandTogglePinned, | |
| 37 is_pinned ? IDS_TAB_CXMENU_UNPIN_TAB : IDS_TAB_CXMENU_PIN_TAB); | |
| 38 AddSeparator(); | |
| 39 AddItemWithStringId(TabStripModel::CommandCloseTab, | |
| 40 IDS_TAB_CXMENU_CLOSETAB); | |
| 41 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs, | |
| 42 IDS_TAB_CXMENU_CLOSEOTHERTABS); | |
| 43 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight, | |
| 44 IDS_TAB_CXMENU_CLOSETABSTORIGHT); | |
| 45 AddSeparator(); | |
| 46 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); | |
| 47 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, | |
| 48 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); | |
| 49 if (AreVerticalTabsEnabled()) { | |
| 50 AddSeparator(); | |
| 51 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, | |
| 52 IDS_TAB_CXMENU_USE_VERTICAL_TABS); | |
| 53 } | |
| 54 } | |
| OLD | NEW |