From 66c8014cf737cc4805af87a944e46d61ae1a712b Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Mon, 13 Aug 2012 16:59:30 +0200 Subject: [PATCH] Bug 782289 - Headphones status notification. Part 2: Generate mozChromeEvent. r=vingtetun Catching the 'headphones-status' event that is generated by AudioManager and generating a mozChromeEvent matching. It will allow us to grab this event in Gaia's status bar. --- b2g/chrome/content/shell.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index 023ac0b03bd7..f2c26c70175f 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -703,6 +703,15 @@ window.addEventListener('ContentStart', function ss_onContentStart() { }, "geolocation-device-events", false); })(); +(function headphonesStatusTracker() { + Services.obs.addObserver(function(aSubject, aTopic, aData) { + shell.sendChromeEvent({ + type: 'headphones-status', + state: aData + }); +}, "headphones-status", false); +})(); + (function recordingStatusTracker() { let gRecordingActiveCount = 0;