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

Unified Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another merge! Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
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 7f76e60c24c52786d5247d5983838319b4bcd6bf..7b7e1f4603a1e92bfb289398054ef9907c30b92c 100644
--- a/chrome/browser/ui/toolbar/wrench_menu_model.cc
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc
@@ -97,7 +97,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 +172,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 +182,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 +198,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 +450,14 @@ WrenchMenuModel::WrenchMenuModel()
}
void WrenchMenuModel::Build() {
- bool is_touch_menu = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH;
+ // TODO(skuhne): Remove special casing when only the new menu style is left.
+#if defined(USE_AURA)
+ bool is_new_menu = true;
+#else
+ bool is_new_menu = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH;
+#endif
+ if (is_new_menu)
+ AddSeparator(ui::SPACING_SEPARATOR);
AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW);
@@ -468,10 +475,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 +486,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 +506,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));
@@ -530,7 +537,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) {
@@ -545,7 +552,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());
}
@@ -555,10 +562,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() {
@@ -584,8 +594,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
@@ -604,13 +614,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
@@ -636,7 +646,7 @@ void WrenchMenuModel::CreateZoomMenu() {
AddItemWithStringId(IDC_FULLSCREEN, IDS_FULLSCREEN);
#endif
- AddSeparator();
+ AddSeparator(new_menu ? ui::UPPER_SEPARATOR: ui::NORMAL_SEPARATOR);
}
void WrenchMenuModel::UpdateZoomControls() {
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.h ('k') | chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698