refactor: implement sublabel fns in MenuModel (#20150)

This commit is contained in:
Shelley Vohr 2019-10-04 08:58:54 +02:00 committed by GitHub
parent 82ff142f9c
commit 513c8536c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -41,6 +41,17 @@ base::string16 AtomMenuModel::GetRoleAt(int index) {
return iter == std::end(roles_) ? base::string16() : iter->second;
}
void AtomMenuModel::SetSublabel(int index, const base::string16& sublabel) {
int command_id = GetCommandIdAt(index);
sublabels_[command_id] = sublabel;
}
base::string16 AtomMenuModel::GetSublabelAt(int index) const {
int command_id = GetCommandIdAt(index);
const auto iter = sublabels_.find(command_id);
return iter == std::end(sublabels_) ? base::string16() : iter->second;
}
bool AtomMenuModel::GetAcceleratorAtWithParams(
int index,
bool use_default_accelerator,