Browse Source

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

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
trop[bot] 5 years ago
parent
commit
7a1b3c5f2d
1 changed files with 2 additions and 8 deletions
  1. 2 8
      shell/browser/api/atom_api_global_shortcut.cc

+ 2 - 8
shell/browser/api/atom_api_global_shortcut.cc

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