Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: chrome/browser/tab_menu_model.cc

Issue 1725006: Changes the tab menu to use pin and unpin instead of a check. The mac (Closed)
Patch Set: Merged with tip of tree and updated unit tests Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/tab_menu_model.h ('k') | chrome/browser/tab_menu_model_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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"
8 #include "chrome/browser/tabs/tab_strip_model.h" 7 #include "chrome/browser/tabs/tab_strip_model.h"
9 #include "grit/generated_resources.h" 8 #include "grit/generated_resources.h"
10 9
11 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate) 10 TabMenuModel::TabMenuModel(menus::SimpleMenuModel::Delegate* delegate,
11 bool is_pinned)
12 : menus::SimpleMenuModel(delegate) { 12 : menus::SimpleMenuModel(delegate) {
13 Build(); 13 Build(is_pinned);
14 } 14 }
15 15
16 void TabMenuModel::Build() { 16 void TabMenuModel::Build(bool is_pinned) {
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 // On Mac the HIG prefers "pin/unpin" to a checkmark. The Mac code will fix up 22 AddItemWithStringId(
23 // the actual string based on the tab's state via the delegate. 23 TabStripModel::CommandTogglePinned,
24 #if defined(OS_MACOSX) 24 is_pinned ? IDS_TAB_CXMENU_UNPIN_TAB : IDS_TAB_CXMENU_PIN_TAB);
25 AddItemWithStringId(TabStripModel::CommandTogglePinned,
26 IDS_TAB_CXMENU_PIN_TAB);
27 #else
28 AddCheckItemWithStringId(TabStripModel::CommandTogglePinned,
29 IDS_TAB_CXMENU_PIN_TAB);
30 #endif
31 AddSeparator(); 25 AddSeparator();
32 AddItemWithStringId(TabStripModel::CommandCloseTab, 26 AddItemWithStringId(TabStripModel::CommandCloseTab,
33 IDS_TAB_CXMENU_CLOSETAB); 27 IDS_TAB_CXMENU_CLOSETAB);
34 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs, 28 AddItemWithStringId(TabStripModel::CommandCloseOtherTabs,
35 IDS_TAB_CXMENU_CLOSEOTHERTABS); 29 IDS_TAB_CXMENU_CLOSEOTHERTABS);
36 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight, 30 AddItemWithStringId(TabStripModel::CommandCloseTabsToRight,
37 IDS_TAB_CXMENU_CLOSETABSTORIGHT); 31 IDS_TAB_CXMENU_CLOSETABSTORIGHT);
38 AddItemWithStringId(TabStripModel::CommandCloseTabsOpenedBy, 32 AddItemWithStringId(TabStripModel::CommandCloseTabsOpenedBy,
39 IDS_TAB_CXMENU_CLOSETABSOPENEDBY); 33 IDS_TAB_CXMENU_CLOSETABSOPENEDBY);
40 AddSeparator(); 34 AddSeparator();
41 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB); 35 AddItemWithStringId(TabStripModel::CommandRestoreTab, IDS_RESTORE_TAB);
42 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs, 36 AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs,
43 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS); 37 IDS_TAB_CXMENU_BOOKMARK_ALL_TABS);
44 } 38 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_menu_model.h ('k') | chrome/browser/tab_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698