Add role property for MenuItem

This commit is contained in:
Cheng Zhao 2015-09-01 19:48:11 +08:00
parent dd2ed559cf
commit d830badc57
9 changed files with 89 additions and 38 deletions

View file

@ -4,6 +4,8 @@
#include "atom/browser/ui/atom_menu_model.h"
#include "base/stl_util.h"
namespace atom {
AtomMenuModel::AtomMenuModel(Delegate* delegate)
@ -14,6 +16,17 @@ AtomMenuModel::AtomMenuModel(Delegate* delegate)
AtomMenuModel::~AtomMenuModel() {
}
void AtomMenuModel::SetRole(int index, const base::string16& role) {
roles_[index] = role;
}
base::string16 AtomMenuModel::GetRoleAt(int index) {
if (ContainsKey(roles_, index))
return roles_[index];
else
return base::string16();
}
void AtomMenuModel::MenuClosed() {
ui::SimpleMenuModel::MenuClosed();
FOR_EACH_OBSERVER(Observer, observers_, MenuClosed());