I'm trying to simplify a bunch of the code in the web_applications system, and we seem to be doing a bunch of crazy stuff with WebContentsObserver to do a seemingly simple thing:
- Compute a value / do work on a per-"content::Page" basis (fetch manifest and cache it, among some other things)
- Have that fetch be 'cancelled' / have another callback be called when the page has transitioned from 'active' to 'inactive'
It seems like, right now, I have to use a WebContentsObserver and do a bunch of caching work and listen to PrimaryPageChanged among other things.
My question - is there an observer interface somehow for the page.h or on the Lifecycle of RenderFrameHost? this would make it ultra easy to have one class encapsulate the responsibility of doing async work on an active page for users that also need to know when the page has become inactive.