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

Unified Diff: ui/base/models/simple_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: Addressed review 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: ui/base/models/simple_menu_model.cc
diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc
index 7537faf5a268c982770672836ead0f20b7fb2049..a082773e1e4cf2bac94788fa69681f81791f8736 100644
--- a/ui/base/models/simple_menu_model.cc
+++ b/ui/base/models/simple_menu_model.cc
@@ -21,6 +21,7 @@ struct SimpleMenuModel::Item {
int group_id;
MenuModel* submenu;
ButtonMenuItemModel* button_model;
+ MenuSeparatorStyle separator_style;
};
////////////////////////////////////////////////////////////////////////////////
@@ -72,7 +73,7 @@ SimpleMenuModel::~SimpleMenuModel() {
void SimpleMenuModel::AddItem(int command_id, const string16& label) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_COMMAND, -1, NULL,
- NULL };
+ NULL, NO_SEPARATOR };
AppendItem(item);
}
@@ -80,15 +81,18 @@ void SimpleMenuModel::AddItemWithStringId(int command_id, int string_id) {
AddItem(command_id, l10n_util::GetStringUTF16(string_id));
}
-void SimpleMenuModel::AddSeparator() {
- Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR, -1,
- NULL, NULL };
+void SimpleMenuModel::AddSeparator(MenuSeparatorStyle separator_type) {
+#if defined(OS_WINDOWS)
sky 2012/08/21 03:03:25 if !defined(USE_AURA) right? Also, instead of the
Mr4D (OOO till 08-26) 2012/08/21 15:37:16 Actually - no? The new separator style should be u
sky 2012/08/21 19:36:29 This is what NOTIMPLEMENTED is meant for, it means
Mr4D (OOO till 08-26) 2012/08/21 21:34:54 No - you got me wrong here. I was not referring to
sky 2012/08/21 22:35:22 Agreed. My first comment was this define should be
+ DCHECK(separator_type == NORMAL_SEPARATOR)
+#endif
+ Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR,
+ -1, NULL, NULL , separator_type };
AppendItem(item);
}
void SimpleMenuModel::AddCheckItem(int command_id, const string16& label) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_CHECK, -1, NULL,
- NULL };
+ NULL, NO_SEPARATOR };
AppendItem(item);
}
@@ -99,7 +103,7 @@ void SimpleMenuModel::AddCheckItemWithStringId(int command_id, int string_id) {
void SimpleMenuModel::AddRadioItem(int command_id, const string16& label,
int group_id) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_RADIO, group_id, NULL,
- NULL };
+ NULL, NO_SEPARATOR };
AppendItem(item);
}
@@ -111,14 +115,14 @@ void SimpleMenuModel::AddRadioItemWithStringId(int command_id, int string_id,
void SimpleMenuModel::AddButtonItem(int command_id,
ButtonMenuItemModel* model) {
Item item = { command_id, string16(), gfx::ImageSkia(), TYPE_BUTTON_ITEM, -1,
- NULL, model };
+ NULL, model, NO_SEPARATOR };
AppendItem(item);
}
void SimpleMenuModel::AddSubMenu(int command_id, const string16& label,
MenuModel* model) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_SUBMENU, -1, model,
- NULL };
+ NULL, NO_SEPARATOR };
AppendItem(item);
}
@@ -130,7 +134,7 @@ void SimpleMenuModel::AddSubMenuWithStringId(int command_id,
void SimpleMenuModel::InsertItemAt(
int index, int command_id, const string16& label) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_COMMAND, -1, NULL,
- NULL };
+ NULL, NO_SEPARATOR };
InsertItemAtIndex(item, index);
}
@@ -139,16 +143,20 @@ void SimpleMenuModel::InsertItemWithStringIdAt(
InsertItemAt(index, command_id, l10n_util::GetStringUTF16(string_id));
}
-void SimpleMenuModel::InsertSeparatorAt(int index) {
- Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR, -1,
- NULL, NULL };
+void SimpleMenuModel::InsertSeparatorAt(int index,
+ MenuSeparatorStyle separator_type) {
+#if defined(OS_WINDOWS)
sky 2012/08/21 03:03:25 Same comment about define.
Mr4D (OOO till 08-26) 2012/08/21 15:37:16 Done.
+ DCHECK(separator_type == NORMAL_SEPARATOR)
+#endif
+ Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR,
+ -1, NULL, NULL, separator_type };
InsertItemAtIndex(item, index);
}
void SimpleMenuModel::InsertCheckItemAt(
int index, int command_id, const string16& label) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_CHECK, -1, NULL,
- NULL };
+ NULL, NO_SEPARATOR };
InsertItemAtIndex(item, index);
}
@@ -161,7 +169,7 @@ void SimpleMenuModel::InsertCheckItemWithStringIdAt(
void SimpleMenuModel::InsertRadioItemAt(
int index, int command_id, const string16& label, int group_id) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_RADIO, group_id, NULL,
- NULL };
+ NULL, NO_SEPARATOR };
InsertItemAtIndex(item, index);
}
@@ -174,7 +182,7 @@ void SimpleMenuModel::InsertRadioItemWithStringIdAt(
void SimpleMenuModel::InsertSubMenuAt(
int index, int command_id, const string16& label, MenuModel* model) {
Item item = { command_id, label, gfx::ImageSkia(), TYPE_SUBMENU, -1, model,
- NULL };
+ NULL, NO_SEPARATOR };
InsertItemAtIndex(item, index);
}
@@ -221,6 +229,10 @@ MenuModel::ItemType SimpleMenuModel::GetTypeAt(int index) const {
return items_[ValidateItemIndex(FlipIndex(index))].type;
}
+ui::MenuSeparatorStyle SimpleMenuModel::GetSeparatorStyleAt(int index) const {
+ return items_[ValidateItemIndex(FlipIndex(index))].separator_style;
+}
+
int SimpleMenuModel::GetCommandIdAt(int index) const {
return items_[ValidateItemIndex(FlipIndex(index))].command_id;
}

Powered by Google App Engine
This is Rietveld 408576698