gecko-dev/dom/media/mediacontrol/MediaHardwareKeysManager.h
Alastor Wu d7506cd7d5 Bug 1575995 - part1 : implement basic classes for handling media hardware keys. r=baku
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
2019-09-13 00:08:57 +00:00

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