Currently, audibility tracking is all over the place:
- Some things on WC.
- Some things on WCO.
- Some things on WCD.
- Some notifications channeled over navigation state changes.
- Duplicate state tracking in a handful of places.
While audio playing and being muted are properties of a WC, the notion of recent audibility is not. This should be factored out of contents entirely. In brief, the plan is to do the following:
1. Move OnAudioStateChange from delegate to observer. This immediately unblocks the stuff Seb is working on that needs the signal in our code, but because of Android can't use TSMO.
2. Create a AudibilityTabHelper that calculates recently/ever audible and has a callback for this state change.
3. Migrate each WC::WasRecentlyAudible/WasEverAudible user to using AudibilityTabHelper.
4. Remove all recently/ever audible functions from WC and WCO APIs.
5. Vastly simplify AudibleContentsTracker to only calculate aggregate audibility of the frame tree.
6. Clean up other misuses of NotifyNavigationStateChanged in order to use WCO directly (indirect consumers of OnAudioStateChange and DidUpdateAudioMutingState).
Comment 1 by bugdroid1@chromium.org
, May 24 2018