mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
d7506cd7d5
In order to receive platform level media hardward keys event, we create a `MediaHardwareKeysEventSource` which is used to implement intercepting those events according to different platforms. We can add a `MediaHardwareKeysEventListener` onto `MediaHardwareKeysEventSource`, so that we can get notification whenever hardware media keys are being pressed. `MediaHardwareKeysManager` is used to encapsulate all these details, it would create a source and corresponding listener. Differential Revision: https://phabricator.services.mozilla.com/D43313 --HG-- extra : moz-landing-system : lando
35 lines
889 B
C++
35 lines
889 B
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_dom_mediahardwarekeysobservice_h__
|
|
#define mozilla_dom_mediahardwarekeysobservice_h__
|
|
|
|
#include "MediaHardwareKeysEvent.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
/**
|
|
* MediaHardwareKeysManager is used to create a source to intercept platform
|
|
* level media keys event and assign a proper event listener to handle those
|
|
* events.
|
|
*/
|
|
class MediaHardwareKeysManager final {
|
|
public:
|
|
MediaHardwareKeysManager();
|
|
~MediaHardwareKeysManager();
|
|
|
|
void StartMonitoringHardwareKeys();
|
|
void StopMonitoringHardwareKeys();
|
|
|
|
private:
|
|
void CreateEventSource();
|
|
RefPtr<MediaHardwareKeysEventSource> mEventSource;
|
|
};
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
#endif
|