OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/tabs/tab_menu_model.h" | 5 #include "chrome/browser/ui/tabs/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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, | 53 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, |
54 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); | 54 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); |
55 if (AreVerticalTabsEnabled()) { | 55 if (AreVerticalTabsEnabled()) { |
56 AddSeparator(); | 56 AddSeparator(); |
57 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, | 57 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, |
58 IDS_TAB_CXMENU_USE_VERTICAL_TABS); | 58 IDS_TAB_CXMENU_USE_VERTICAL_TABS); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void TabMenuModel::Build(TabStripModel* tab_strip, int index) { | 62 void TabMenuModel::Build(TabStripModel* tab_strip, int index) { |
63 bool effects_multiple_tabs = | 63 bool affects_multiple_tabs = |
Avi (use Gerrit)
2011/04/08 15:22:20
gah! nice
| |
64 (tab_strip->IsTabSelected(index) && | 64 (tab_strip->IsTabSelected(index) && |
65 tab_strip->selection_model().selected_indices().size() > 1); | 65 tab_strip->selection_model().selected_indices().size() > 1); |
66 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); | 66 AddItemWithStringId(TabStripModel::CommandNewTab, IDS_TAB_CXMENU_NEWTAB); |
67 AddSeparator(); | 67 AddSeparator(); |
68 AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD); | 68 AddItemWithStringId(TabStripModel::CommandReload, IDS_TAB_CXMENU_RELOAD); |
69 AddItemWithStringId(TabStripModel::CommandDuplicate, | 69 AddItemWithStringId(TabStripModel::CommandDuplicate, |
70 IDS_TAB_CXMENU_DUPLICATE); | 70 IDS_TAB_CXMENU_DUPLICATE); |
71 bool will_pin = tab_strip->WillContextMenuPin(index); | 71 bool will_pin = tab_strip->WillContextMenuPin(index); |
72 if (effects_multiple_tabs) { | 72 if (affects_multiple_tabs) { |
73 AddItemWithStringId( | 73 AddItemWithStringId( |
74 TabStripModel::CommandTogglePinned, | 74 TabStripModel::CommandTogglePinned, |
75 will_pin ? IDS_TAB_CXMENU_PIN_TABS : IDS_TAB_CXMENU_UNPIN_TABS); | 75 will_pin ? IDS_TAB_CXMENU_PIN_TABS : IDS_TAB_CXMENU_UNPIN_TABS); |
76 } else { | 76 } else { |
77 AddItemWithStringId( | 77 AddItemWithStringId( |
78 TabStripModel::CommandTogglePinned, | 78 TabStripModel::CommandTogglePinned, |
79 will_pin ? IDS_TAB_CXMENU_PIN_TAB : IDS_TAB_CXMENU_UNPIN_TAB); | 79 will_pin ? IDS_TAB_CXMENU_PIN_TAB : IDS_TAB_CXMENU_UNPIN_TAB); |
80 } | 80 } |
81 AddSeparator(); | 81 AddSeparator(); |
82 if (effects_multiple_tabs) { | 82 if (affects_multiple_tabs) { |
83 AddItemWithStringId(TabStripModel::CommandCloseTab, | 83 AddItemWithStringId(TabStripModel::CommandCloseTab, |
84 IDS_TAB_CXMENU_CLOSETABS); | 84 IDS_TAB_CXMENU_CLOSETABS); |
85 } else { | 85 } else { |
86 AddItemWithStringId(TabStripModel::CommandCloseTab, | 86 AddItemWithStringId(TabStripModel::CommandCloseTab, |
87 IDS_TAB_CXMENU_CLOSETAB); | 87 IDS_TAB_CXMENU_CLOSETAB); |
88 } | 88 } |
89 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs, | 89 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs, |
90 IDS_TAB_CXMENU_CLOSEOTHERTABS); | 90 IDS_TAB_CXMENU_CLOSEOTHERTABS); |
91 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight, | 91 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight, |
92 IDS_TAB_CXMENU_CLOSETABSTORIGHT); | 92 IDS_TAB_CXMENU_CLOSETABSTORIGHT); |
93 AddSeparator(); | 93 AddSeparator(); |
94 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); | 94 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); |
95 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, | 95 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, |
96 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); | 96 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); |
97 if (AreVerticalTabsEnabled()) { | 97 if (AreVerticalTabsEnabled()) { |
98 AddSeparator(); | 98 AddSeparator(); |
99 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, | 99 AddCheckItemWithStringId(TabStripModel::CommandUseVerticalTabs, |
100 IDS_TAB_CXMENU_USE_VERTICAL_TABS); | 100 IDS_TAB_CXMENU_USE_VERTICAL_TABS); |
101 } | 101 } |
102 if (CommandLine::ForCurrentProcess()->HasSwitch( | 102 if (CommandLine::ForCurrentProcess()->HasSwitch( |
103 switches::kEnableTabGroupsContextMenu)) { | 103 switches::kEnableTabGroupsContextMenu)) { |
104 AddSeparator(); | 104 AddSeparator(); |
105 AddItemWithStringId(TabStripModel::CommandSelectByDomain, | 105 AddItemWithStringId(TabStripModel::CommandSelectByDomain, |
106 IDS_TAB_CXMENU_SELECT_BY_DOMAIN); | 106 IDS_TAB_CXMENU_SELECT_BY_DOMAIN); |
107 AddItemWithStringId(TabStripModel::CommandSelectByOpener, | 107 AddItemWithStringId(TabStripModel::CommandSelectByOpener, |
108 IDS_TAB_CXMENU_SELECT_BY_OPENER); | 108 IDS_TAB_CXMENU_SELECT_BY_OPENER); |
109 } | 109 } |
110 } | 110 } |
OLD | NEW |