feat: allow registering multiple shortcuts (#15542)

This PR allows for multiple global shortcuts to be registered such that triggering any of them calls the same callback.
This commit is contained in:
Shelley Vohr 2018-11-07 09:40:38 -08:00 committed by GitHub
parent 20a540e680
commit e9ba26f50e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 2 deletions

View file

@ -7,6 +7,7 @@
#include <map>
#include <string>
#include <vector>
#include "atom/browser/api/trackable_object.h"
#include "base/callback.h"
@ -33,10 +34,13 @@ class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
private:
typedef std::map<ui::Accelerator, base::Closure> AcceleratorCallbackMap;
bool RegisterAll(const std::vector<ui::Accelerator>& accelerators,
const base::Closure& callback);
bool Register(const ui::Accelerator& accelerator,
const base::Closure& callback);
bool IsRegistered(const ui::Accelerator& accelerator);
void Unregister(const ui::Accelerator& accelerator);
void UnregisterSome(const std::vector<ui::Accelerator>& accelerators);
void UnregisterAll();
// GlobalShortcutListener::Observer implementation.