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

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: Fixed build problems 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 2ae71b9b8bf4b9123a8b4771c34f563648727fa8..2fa797ffafcacf55d1a60e337ab776be638d4d1f 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"
#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() {
GetImageSkiaNamed(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() {

Powered by Google App Engine
This is Rietveld 408576698