OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/i18n/number_formatting.h" |
| 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/task_manager/task_manager.h" |
| 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "grit/chromium_strings.h" |
| 13 #include "grit/generated_resources.h" |
| 14 #include "grit/theme_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" |
| 17 |
| 18 void WrenchMenuModel::Build() { |
| 19 #if !defined(TOUCH_UI) |
| 20 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); |
| 21 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 22 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) |
| 23 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 24 |
| 25 AddSeparator(); |
| 26 CreateCutCopyPaste(); |
| 27 |
| 28 AddSeparator(); |
| 29 CreateZoomFullscreen(); |
| 30 |
| 31 AddSeparator(); |
| 32 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); |
| 33 #endif // !TOUCH_UI |
| 34 AddItemWithStringId(IDC_FIND, IDS_FIND); |
| 35 AddItemWithStringId(IDC_PRINT, IDS_PRINT); |
| 36 |
| 37 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); |
| 38 AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU, |
| 39 tools_menu_model_.get()); |
| 40 |
| 41 AddSeparator(); |
| 42 |
| 43 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); |
| 44 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, |
| 45 bookmark_sub_menu_model_.get()); |
| 46 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); |
| 47 #if !defined(TOUCH_UI) |
| 48 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
| 49 #endif // !TOUCH_UI |
| 50 AddSeparator(); |
| 51 |
| 52 AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS); |
| 53 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME); |
| 54 AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, product_name)); |
| 55 string16 num_background_pages = base::FormatNumber( |
| 56 TaskManager::GetBackgroundPageCount()); |
| 57 AddItem(IDC_VIEW_BACKGROUND_PAGES, |
| 58 l10n_util::GetStringFUTF16(IDS_VIEW_BACKGROUND_PAGES, |
| 59 num_background_pages)); |
| 60 AddItem(IDC_UPGRADE_DIALOG, |
| 61 l10n_util::GetStringFUTF16(IDS_UPDATE_NOW, product_name)); |
| 62 AddItem(IDC_VIEW_INCOMPATIBILITIES, |
| 63 l10n_util::GetStringUTF16(IDS_VIEW_INCOMPATIBILITIES)); |
| 64 |
| 65 // Use an icon for IDC_HELP_PAGE menu item. |
| 66 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); |
| 67 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 68 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE), |
| 69 *rb.GetBitmapNamed(IDR_HELP_MENU)); |
| 70 |
| 71 // Show IDC_FEEDBACK in top-tier wrench menu for ChromeOS. |
| 72 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); |
| 73 AddSeparator(); |
| 74 |
| 75 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
| 76 AddItemWithStringId(IDC_EXIT, IDS_EXIT_GUEST_MODE); |
| 77 } else { |
| 78 AddItemWithStringId(IDC_EXIT, IDS_SIGN_OUT); |
| 79 } |
| 80 } |
| 81 |
OLD | NEW |