electron icon indicating copy to clipboard operation
electron copied to clipboard

refactor: prefer to inherit observer classes privately

Open ckerr opened this issue 2 years ago • 0 comments

Description of Change

We have a lot of classes that inherit from upstream observer classes to manage internal state, e.g. our AutofillDriverFactory inherits from content::WebContentsObserver so that it can know when to close popups.

Since WebContentsObserver inherits AutofillDriverFactory publicly, we are accidentally exposing a lot of public API (it's a 900+ LOC class!) to WebContentsObserver's clients. We shouldn't do that; it might accidentally get used.

This PR uses private inheritance instead..

Checklist

Release Notes

Notes: none.

ckerr avatar Feb 16 '24 21:02 ckerr