mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 782289 - Forward headphone status changed notification from gonk to chrome. r=philikon
The wrong patch was applied previously. This changeset rolls back the previous change and applies the correct one.
This commit is contained in:
parent
cb126a79ea
commit
50aa8610a3
@ -709,10 +709,10 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
|
|||||||
(function headphonesStatusTracker() {
|
(function headphonesStatusTracker() {
|
||||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||||
shell.sendChromeEvent({
|
shell.sendChromeEvent({
|
||||||
type: 'headphones-status',
|
type: 'headphones-status-changed',
|
||||||
state: aData
|
state: aData
|
||||||
});
|
});
|
||||||
}, "headphones-status", false);
|
}, "headphones-status-changed", false);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(function recordingStatusTracker() {
|
(function recordingStatusTracker() {
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
#include "mozilla/Hal.h"
|
#include "mozilla/Hal.h"
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
#include "gonk/AudioSystem.h"
|
#include "gonk/AudioSystem.h"
|
||||||
#include "nsIObserverService.h"
|
|
||||||
#include "mozilla/Services.h"
|
|
||||||
|
|
||||||
using namespace mozilla::dom::gonk;
|
using namespace mozilla::dom::gonk;
|
||||||
using namespace android;
|
using namespace android;
|
||||||
@ -55,27 +53,11 @@ InternalSetAudioRoutes(SwitchState aState)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
NotifyHeadphonesStatus(SwitchState aState)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
|
||||||
if (obs) {
|
|
||||||
if (aState == SWITCH_STATE_ON) {
|
|
||||||
obs->NotifyObservers(nullptr, "headphones-status", NS_LITERAL_STRING("on").get());
|
|
||||||
} else if (aState == SWITCH_STATE_OFF) {
|
|
||||||
obs->NotifyObservers(nullptr, "headphones-status", NS_LITERAL_STRING("off").get());
|
|
||||||
} else {
|
|
||||||
obs->NotifyObservers(nullptr, "headphones-status", NS_LITERAL_STRING("unknown").get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class HeadphoneSwitchObserver : public SwitchObserver
|
class HeadphoneSwitchObserver : public SwitchObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Notify(const SwitchEvent& aEvent) {
|
void Notify(const SwitchEvent& aEvent) {
|
||||||
InternalSetAudioRoutes(aEvent.status());
|
InternalSetAudioRoutes(aEvent.status());
|
||||||
NotifyHeadphonesStatus(aEvent.status());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user