Commit 47f9a12c authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

ui: remove icon_idr from MenuModel

It is actually not used anywhere and only set in one place, so we can
do away with it.

Bug: None
Change-Id: Ib6f2445f2fb02dbcaac25caa3f0beae1c473fd56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816118
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698961}
parent fb935ecd
......@@ -883,17 +883,12 @@ void AppMenuModel::CreateCutCopyPasteMenu() {
}
void AppMenuModel::CreateZoomMenu() {
// WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the
// layout for this menu item in AppMenu.xib. It does, however, use the
// command_id value from AddButtonItem() to identify this special item.
zoom_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_ZOOM_MENU, this));
zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_MINUS,
IDS_ZOOM_MINUS2);
zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_PLUS,
IDS_ZOOM_PLUS2);
// TODO(https://crbug.com/957391): Remove the former IDR_ parameter here once
// the change to remove it from the model (crrev.com/1816118) is in.
zoom_menu_item_model_->AddItemWithImage(IDC_FULLSCREEN, -1);
zoom_menu_item_model_->AddImageItem(IDC_FULLSCREEN);
AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get());
}
......
......@@ -37,7 +37,6 @@ struct ButtonMenuItemModel::Item {
int command_id;
ButtonType type;
base::string16 label;
int icon_idr;
bool part_of_group;
};
......@@ -53,25 +52,24 @@ ButtonMenuItemModel::~ButtonMenuItemModel() {
void ButtonMenuItemModel::AddGroupItemWithStringId(
int command_id, int string_id) {
Item item = { command_id, TYPE_BUTTON, l10n_util::GetStringUTF16(string_id),
-1, true };
Item item = {command_id, TYPE_BUTTON, l10n_util::GetStringUTF16(string_id),
true};
items_.push_back(item);
}
void ButtonMenuItemModel::AddItemWithImage(int command_id,
int icon_idr) {
Item item = { command_id, TYPE_BUTTON, base::string16(), icon_idr, false };
void ButtonMenuItemModel::AddImageItem(int command_id) {
Item item = {command_id, TYPE_BUTTON, base::string16(), false};
items_.push_back(item);
}
void ButtonMenuItemModel::AddButtonLabel(int command_id, int string_id) {
Item item = { command_id, TYPE_BUTTON_LABEL,
l10n_util::GetStringUTF16(string_id), -1, false };
Item item = {command_id, TYPE_BUTTON_LABEL,
l10n_util::GetStringUTF16(string_id), false};
items_.push_back(item);
}
void ButtonMenuItemModel::AddSpace() {
Item item = { 0, TYPE_SPACE, base::string16(), -1, false };
Item item = {0, TYPE_SPACE, base::string16(), false};
items_.push_back(item);
}
......@@ -109,14 +107,6 @@ base::string16 ButtonMenuItemModel::GetLabelAt(int index) const {
return items_[index].label;
}
bool ButtonMenuItemModel::GetIconAt(int index, int* icon_idr) const {
if (items_[index].icon_idr == -1)
return false;
*icon_idr = items_[index].icon_idr;
return true;
}
bool ButtonMenuItemModel::PartOfGroup(int index) const {
return items_[index].part_of_group;
}
......
......@@ -54,8 +54,11 @@ class UI_BASE_EXPORT ButtonMenuItemModel {
// this method will have the same size, based on the largest button.
void AddGroupItemWithStringId(int command_id, int string_id);
// Adds a button that has an icon instead of a label.
void AddItemWithImage(int command_id, int icon_idr);
// Adds a button that has an icon instead of a label. Note that the image
// itself must be separately configured by platform-specific code; this method
// simply serves to add a blank item in the menu with a specified
// |command_id|.
void AddImageItem(int command_id);
// Adds a non-clickable button with a desensitized label that doesn't do
// anything. Usually combined with IsItemForCommandIdDynamic() to add
......@@ -84,10 +87,6 @@ class UI_BASE_EXPORT ButtonMenuItemModel {
// Returns the current label value for the button at |index|.
base::string16 GetLabelAt(int index) const;
// If the button at |index| should have an icon instead, returns true and
// sets the IDR |icon|.
bool GetIconAt(int index, int* icon) const;
// If the button at |index| should have its size equalized along with all
// other items that have their PartOfGroup bit set.
bool PartOfGroup(int index) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment