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() { ...@@ -883,17 +883,12 @@ void AppMenuModel::CreateCutCopyPasteMenu() {
} }
void AppMenuModel::CreateZoomMenu() { 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_.reset(new ui::ButtonMenuItemModel(IDS_ZOOM_MENU, this));
zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_MINUS, zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_MINUS,
IDS_ZOOM_MINUS2); IDS_ZOOM_MINUS2);
zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_PLUS, zoom_menu_item_model_->AddGroupItemWithStringId(IDC_ZOOM_PLUS,
IDS_ZOOM_PLUS2); IDS_ZOOM_PLUS2);
// TODO(https://crbug.com/957391): Remove the former IDR_ parameter here once zoom_menu_item_model_->AddImageItem(IDC_FULLSCREEN);
// the change to remove it from the model (crrev.com/1816118) is in.
zoom_menu_item_model_->AddItemWithImage(IDC_FULLSCREEN, -1);
AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get()); AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get());
} }
......
...@@ -37,7 +37,6 @@ struct ButtonMenuItemModel::Item { ...@@ -37,7 +37,6 @@ struct ButtonMenuItemModel::Item {
int command_id; int command_id;
ButtonType type; ButtonType type;
base::string16 label; base::string16 label;
int icon_idr;
bool part_of_group; bool part_of_group;
}; };
...@@ -53,25 +52,24 @@ ButtonMenuItemModel::~ButtonMenuItemModel() { ...@@ -53,25 +52,24 @@ ButtonMenuItemModel::~ButtonMenuItemModel() {
void ButtonMenuItemModel::AddGroupItemWithStringId( void ButtonMenuItemModel::AddGroupItemWithStringId(
int command_id, int string_id) { int command_id, int string_id) {
Item item = { command_id, TYPE_BUTTON, l10n_util::GetStringUTF16(string_id), Item item = {command_id, TYPE_BUTTON, l10n_util::GetStringUTF16(string_id),
-1, true }; true};
items_.push_back(item); items_.push_back(item);
} }
void ButtonMenuItemModel::AddItemWithImage(int command_id, void ButtonMenuItemModel::AddImageItem(int command_id) {
int icon_idr) { Item item = {command_id, TYPE_BUTTON, base::string16(), false};
Item item = { command_id, TYPE_BUTTON, base::string16(), icon_idr, false };
items_.push_back(item); items_.push_back(item);
} }
void ButtonMenuItemModel::AddButtonLabel(int command_id, int string_id) { void ButtonMenuItemModel::AddButtonLabel(int command_id, int string_id) {
Item item = { command_id, TYPE_BUTTON_LABEL, Item item = {command_id, TYPE_BUTTON_LABEL,
l10n_util::GetStringUTF16(string_id), -1, false }; l10n_util::GetStringUTF16(string_id), false};
items_.push_back(item); items_.push_back(item);
} }
void ButtonMenuItemModel::AddSpace() { void ButtonMenuItemModel::AddSpace() {
Item item = { 0, TYPE_SPACE, base::string16(), -1, false }; Item item = {0, TYPE_SPACE, base::string16(), false};
items_.push_back(item); items_.push_back(item);
} }
...@@ -109,14 +107,6 @@ base::string16 ButtonMenuItemModel::GetLabelAt(int index) const { ...@@ -109,14 +107,6 @@ base::string16 ButtonMenuItemModel::GetLabelAt(int index) const {
return items_[index].label; 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 { bool ButtonMenuItemModel::PartOfGroup(int index) const {
return items_[index].part_of_group; return items_[index].part_of_group;
} }
......
...@@ -54,8 +54,11 @@ class UI_BASE_EXPORT ButtonMenuItemModel { ...@@ -54,8 +54,11 @@ class UI_BASE_EXPORT ButtonMenuItemModel {
// this method will have the same size, based on the largest button. // this method will have the same size, based on the largest button.
void AddGroupItemWithStringId(int command_id, int string_id); void AddGroupItemWithStringId(int command_id, int string_id);
// Adds a button that has an icon instead of a label. // Adds a button that has an icon instead of a label. Note that the image
void AddItemWithImage(int command_id, int icon_idr); // 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 // Adds a non-clickable button with a desensitized label that doesn't do
// anything. Usually combined with IsItemForCommandIdDynamic() to add // anything. Usually combined with IsItemForCommandIdDynamic() to add
...@@ -84,10 +87,6 @@ class UI_BASE_EXPORT ButtonMenuItemModel { ...@@ -84,10 +87,6 @@ class UI_BASE_EXPORT ButtonMenuItemModel {
// Returns the current label value for the button at |index|. // Returns the current label value for the button at |index|.
base::string16 GetLabelAt(int index) const; 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 // If the button at |index| should have its size equalized along with all
// other items that have their PartOfGroup bit set. // other items that have their PartOfGroup bit set.
bool PartOfGroup(int index) const; 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