Chromium Code Reviews| Index: chrome/browser/ui/toolbar/wrench_menu_model.cc |
| diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc |
| index ef015d012682a137f770b700843256c4eb4dd0da..2dd470a692dc069b29b03d6182416b525f42bc3e 100644 |
| --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc |
| +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc |
| @@ -56,6 +56,7 @@ |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/image/image.h" |
| #include "ui/gfx/image/image_skia.h" |
| +#include "ui/views/controls/menu/menu_config.h" |
|
sky
2012/08/23 16:58:51
This is views specific, so you'll need to ifdef th
Mr4D (OOO till 08-26)
2012/08/23 17:46:31
Done.
|
| #if defined(TOOLKIT_GTK) |
| #include <gtk/gtk.h> |
| @@ -97,7 +98,7 @@ void EncodingMenuModel::Build() { |
| int id = it->first; |
| string16& label = it->second; |
| if (id == 0) { |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| } else { |
| if (id == IDC_ENCODING_AUTO_DETECT) { |
| AddCheckItem(id, label); |
| @@ -172,7 +173,7 @@ ToolsMenuModel::~ToolsMenuModel() {} |
| void ToolsMenuModel::Build(Browser* browser) { |
| #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX) |
| AddItemWithStringId(IDC_CREATE_SHORTCUTS, IDS_CREATE_SHORTCUTS); |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| #endif |
| AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS); |
| @@ -182,12 +183,12 @@ void ToolsMenuModel::Build(Browser* browser) { |
| AddItemWithStringId(IDC_CLEAR_BROWSING_DATA, IDS_CLEAR_BROWSING_DATA); |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| #if !defined(OS_CHROMEOS) |
| // Show IDC_FEEDBACK in "Tools" menu for non-ChromeOS platforms. |
| AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| #endif |
| encoding_menu_model_.reset(new EncodingMenuModel(browser)); |
| @@ -198,7 +199,7 @@ void ToolsMenuModel::Build(Browser* browser) { |
| AddItemWithStringId(IDC_DEV_TOOLS_CONSOLE, IDS_DEV_TOOLS_CONSOLE); |
| #if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| AddCheckItemWithStringId(IDC_PROFILING_ENABLED, IDS_PROFILING_ENABLED); |
| #endif |
| } |
| @@ -450,7 +451,9 @@ WrenchMenuModel::WrenchMenuModel() |
| } |
| void WrenchMenuModel::Build() { |
| - bool is_touch_menu = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH; |
| + bool is_new_menu = views::MenuConfig::IsNewMenu(); |
| + if (is_new_menu) |
| + AddSeparator(ui::SPACING_SEPARATOR); |
| AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); |
| AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| @@ -468,10 +471,10 @@ void WrenchMenuModel::Build() { |
| // Append the full menu including separators. The final separator only gets |
| // appended when this is a touch menu - otherwise it would get added twice. |
| - CreateCutCopyPasteMenu(is_touch_menu); |
| + CreateCutCopyPasteMenu(is_new_menu); |
| - if (!is_touch_menu) |
| - CreateZoomMenu(); |
| + if (!is_new_menu) |
| + CreateZoomMenu(is_new_menu); |
| AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); |
| AddItemWithStringId(IDC_FIND, IDS_FIND); |
| @@ -479,19 +482,19 @@ void WrenchMenuModel::Build() { |
| tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); |
| // In case of touch this is the last item. |
| - if (!is_touch_menu) { |
| + if (!is_new_menu) { |
| AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU, |
| tools_menu_model_.get()); |
| } |
| - if (is_touch_menu) |
| - CreateZoomMenu(); |
| + if (is_new_menu) |
| + CreateZoomMenu(is_new_menu); |
| else |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); |
| AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| if (browser_defaults::kShowSyncSetupMenuItem && |
| browser_->profile()->GetOriginalProfile()->IsSyncAccessible()) { |
| @@ -499,14 +502,14 @@ void WrenchMenuModel::Build() { |
| l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); |
| AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16( |
| IDS_SYNC_MENU_PRE_SYNCED_LABEL, short_product_name)); |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| } |
| AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS); |
| // On ChromeOS-Touch, we don't want the about/background pages menu options. |
| #if defined(OS_CHROMEOS) |
| - if (!is_touch_menu) |
| + if (!is_new_menu) |
| #endif |
| { |
| AddItem(IDC_ABOUT, l10n_util::GetStringUTF16(IDS_ABOUT)); |
| @@ -527,7 +530,7 @@ void WrenchMenuModel::Build() { |
| GetNativeImageNamed(IDR_CONFLICT_MENU)); |
| #endif |
| - if (!is_touch_menu) { |
| + if (!is_new_menu) { |
| AddItemWithStringId(IDC_HELP_PAGE_VIA_MENU, IDS_HELP_PAGE); |
| if (browser_defaults::kShowHelpMenuItemIcon) { |
| @@ -542,7 +545,7 @@ void WrenchMenuModel::Build() { |
| AddGlobalErrorMenuItems(); |
| - if (is_touch_menu) { |
| + if (is_new_menu) { |
| AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_MORE_TOOLS_MENU, |
| tools_menu_model_.get()); |
| } |
| @@ -552,10 +555,13 @@ void WrenchMenuModel::Build() { |
| if (!base::win::IsMetroProcess()) |
| #endif |
| { |
| - AddSeparator(); |
| + AddSeparator(ui::NORMAL_SEPARATOR); |
| AddItemWithStringId(IDC_EXIT, IDS_EXIT); |
| } |
| } |
| + |
| + if (is_new_menu) |
| + AddSeparator(ui::SPACING_SEPARATOR); |
| } |
| void WrenchMenuModel::AddGlobalErrorMenuItems() { |
| @@ -581,8 +587,8 @@ void WrenchMenuModel::AddGlobalErrorMenuItems() { |
| } |
| } |
| -void WrenchMenuModel::CreateCutCopyPasteMenu(bool append_final_separator) { |
| - AddSeparator(); |
| +void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) { |
| + AddSeparator(new_menu ? ui::LOWER_SEPARATOR: ui::NORMAL_SEPARATOR); |
| #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) |
| // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
| @@ -601,13 +607,13 @@ void WrenchMenuModel::CreateCutCopyPasteMenu(bool append_final_separator) { |
| AddItemWithStringId(IDC_PASTE, IDS_PASTE); |
| #endif |
| - if (append_final_separator) |
| - AddSeparator(); |
| + if (new_menu) |
| + AddSeparator(ui::UPPER_SEPARATOR); |
| } |
| -void WrenchMenuModel::CreateZoomMenu() { |
| +void WrenchMenuModel::CreateZoomMenu(bool new_menu) { |
| // This menu needs to be enclosed by separators. |
| - AddSeparator(); |
| + AddSeparator(new_menu ? ui::LOWER_SEPARATOR: ui::NORMAL_SEPARATOR); |
| #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) |
| // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
| @@ -633,7 +639,7 @@ void WrenchMenuModel::CreateZoomMenu() { |
| AddItemWithStringId(IDC_FULLSCREEN, IDS_FULLSCREEN); |
| #endif |
| - AddSeparator(); |
| + AddSeparator(new_menu ? ui::UPPER_SEPARATOR: ui::NORMAL_SEPARATOR); |
| } |
| void WrenchMenuModel::UpdateZoomControls() { |