Store state of actual sound-playing for each tab

This commit is contained in:
YUKI Hiroshi 2015-11-19 18:10:17 +09:00
parent 44c7cd117a
commit 573556a834
2 changed files with 20 additions and 0 deletions

View File

@ -842,6 +842,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
w.addEventListener('SSWindowStateBusy', this, false);
ReferenceCounter.add('w,SSWindowStateBusy,TSTBrowser,false');
b.addEventListener('DOMAudioPlaybackStarted', this, false);
ReferenceCounter.add('b,DOMAudioPlaybackStarted,TSTBrowser,false');
b.addEventListener('DOMAudioPlaybackStopped', this, false);
ReferenceCounter.add('b,DOMAudioPlaybackStopped,TSTBrowser,false');
b.addEventListener('nsDOMMultipleTabHandlerTabsClosing', this, false);
ReferenceCounter.add('b,nsDOMMultipleTabHandlerTabsClosing,TSTBrowser,false');
@ -2326,6 +2331,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
w.removeEventListener('SSWindowStateBusy', this, false);
ReferenceCounter.remove('w,SSWindowStateBusy,TSTBrowser,false');
b.removeEventListener('DOMAudioPlaybackStarted', this, false);
ReferenceCounter.remove('b,DOMAudioPlaybackStarted,TSTBrowser,false');
b.removeEventListener('DOMAudioPlaybackStopped', this, false);
ReferenceCounter.remove('b,DOMAudioPlaybackStopped,TSTBrowser,false');
b.removeEventListener('nsDOMMultipleTabHandlerTabsClosing', this, false);
ReferenceCounter.remove('b,nsDOMMultipleTabHandlerTabsClosing,TSTBrowser,false');
@ -2995,6 +3005,15 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
return this.needRestoreTree = true;
case 'DOMAudioPlaybackStarted':
this.setTabValue(this.getTabFromBrowser(aEvent.target), this.kREALLY_SOUND_PLAYING, true);
return;
case 'DOMAudioPlaybackStopped':
this.deleteTabValue(this.getTabFromBrowser(aEvent.target), this.kREALLY_SOUND_PLAYING);
return;
case 'nsDOMMultipleTabHandlerTabsClosing':
if (!this.onTabsClosing(aEvent))
aEvent.preventDefault();

View File

@ -61,6 +61,7 @@ var TreeStyleTabConstants = Object.freeze({
kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse',
kALLOW_STACK : 'treestyletab-stack-collapsed-tabs',
kREMOVED : 'treestyletab-removed',
kREALLY_SOUND_PLAYING : 'treestyletab-really-sound-playing',
kX_OFFSET : 'treestyletab-x-offset',
kY_OFFSET : 'treestyletab-y-offset',