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