| 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 "chrome/common/pref_names.h" |
| 10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 11 | 12 |
| 12 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate, | 13 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate, |
| 13 bool is_pinned) | 14 bool is_pinned) |
| 14 : menus::SimpleMenuModel(delegate) { | 15 : menus::SimpleMenuModel(delegate) { |
| 15 Build(is_pinned); | 16 Build(is_pinned); |
| 16 } | 17 } |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 bool TabMenuModel::AreVerticalTabsEnabled() { | 20 bool TabMenuModel::AreVerticalTabsEnabled() { |
| 20 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 21 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) || defined(OS_CHROMEOS) |
| 21 return CommandLine::ForCurrentProcess()->HasSwitch( | 22 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 22 switches::kEnableVerticalTabs); | 23 switches::kEnableVerticalTabs); |
| 23 #else | 24 #else |
| 24 return false; | 25 return false; |
| 25 #endif | 26 #endif |
| 26 } | 27 } |
| 27 | 28 |
| 28 void TabMenuModel::Build(bool is_pinned) { | 29 void TabMenuModel::Build(bool is_pinned) { |
| 29 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); | 30 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); |
| 30 AddSeparator(); | 31 AddSeparator(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 44 AddSeparator(); | 45 AddSeparator(); |
| 45 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); | 46 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); |
| 46 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, | 47 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, |
| 47 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); | 48 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); |
| 48 if (AreVerticalTabsEnabled()) { | 49 if (AreVerticalTabsEnabled()) { |
| 49 AddSeparator(); | 50 AddSeparator(); |
| 50 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, | 51 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, |
| 51 IDS_TAB_CXMENU_USE_VERTICAL_TABS); | 52 IDS_TAB_CXMENU_USE_VERTICAL_TABS); |
| 52 } | 53 } |
| 53 } | 54 } |
| OLD | NEW |