fix: Fix broken globalShortcuts.registerAll() on non-macOS platforms (#20963)

This was a regression in #16125, which unintentionally put
`GlobalShortcutListener::RegisterAccelerator` into a
`#if defined(OS_MACOSX)` block.

Notes: Fix broken `globalShortcut.registerAll()` on Windows and Linux
This commit is contained in:
Birunthan Mohanathas 2019-11-05 15:47:23 -06:00 committed by Samuel Attard
parent 05de7277ab
commit ac69b89e82

View file

@ -74,19 +74,13 @@ bool GlobalShortcut::RegisterAll(
std::vector<ui::Accelerator> registered; std::vector<ui::Accelerator> registered;
for (auto& accelerator : accelerators) { for (auto& accelerator : accelerators) {
#if defined(OS_MACOSX) if (!Register(accelerator, callback)) {
if (RegisteringMediaKeyForUntrustedClient(accelerator))
return false;
GlobalShortcutListener* listener = GlobalShortcutListener::GetInstance();
if (!listener->RegisterAccelerator(accelerator, this)) {
// unregister all shortcuts if any failed // unregister all shortcuts if any failed
UnregisterSome(registered); UnregisterSome(registered);
return false; return false;
} }
#endif
registered.push_back(accelerator); registered.push_back(accelerator);
accelerator_callback_map_[accelerator] = callback;
} }
return true; return true;
} }