feat: add MenuItem.userAccelerator property (#26682)
* feat: add MenuItem.userAccelerator property This allows folks to read the user-assigned accelerator that macOS users can provide in system preferences. Useful for showing in-app shortcut help dialogs, you need to know if the accelerator you provided is not being used in favor of a user assigned one. * chore: update syntax * chore: add safety check for command index being -1
This commit is contained in:
parent
3e69985b76
commit
da9261497e
7 changed files with 85 additions and 9 deletions
|
@ -212,7 +212,7 @@ void Menu::Clear() {
|
|||
model_->Clear();
|
||||
}
|
||||
|
||||
int Menu::GetIndexOfCommandId(int command_id) {
|
||||
int Menu::GetIndexOfCommandId(int command_id) const {
|
||||
return model_->GetIndexOfCommandId(command_id);
|
||||
}
|
||||
|
||||
|
@ -299,6 +299,9 @@ v8::Local<v8::ObjectTemplate> Menu::FillObjectTemplate(
|
|||
.SetMethod("closePopupAt", &Menu::ClosePopupAt)
|
||||
#if DCHECK_IS_ON()
|
||||
.SetMethod("getAcceleratorTextAt", &Menu::GetAcceleratorTextAtForTesting)
|
||||
#endif
|
||||
#if defined(OS_MAC)
|
||||
.SetMethod("_getUserAcceleratorAt", &Menu::GetUserAcceleratorAt)
|
||||
#endif
|
||||
.Build();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue