refactor: inherit Observer classes privately, pt. 2 (#42237)

* refactor: use private inheritance in PushNotifications

* refactor: use private inheritance in electron::api::App

* refactor: use private inheritance in electron::api::BrowserWindow

* refactor: use private inheritance in electron::api::NativeTheme

* refactor: use private inheritance in electron::api::Tray

* refactor: use private inheritance in electron::api::Session

* refactor: use private inheritance in electron::api::WebContents

* refactor: use private inheritance in electron::api::DownloadItem

* refactor: use private inheritance in electron::api::MenuBar

* refactor: use private inheritance in ClearDataOperation

* refactor: use private inheritance in electron::api::Screen

* refactor: use private inheritance in electron::ElectronDesktopWindowTreeHostLinux

* refactor: use private inheritance in SpellCheckerHolder

* refactor: use private inheritance in electron::api::PowerMonitor

* refactor: use private inheritance in electron::api::BaseWindow

* refactor: use private inheritance in electron::api::AutoUpdater

* refactor: use private inheritance in electron::api::Menu

* refactor: use private inheritance in electron::api::NativeWindowViews

* refactor: use private inheritance in electron::ElectronBrowserClient

* refactor: use private inheritance in electron::AutofillPopupView

* refactor: use private inheritance in GtkMessageBox

* refactor: use private inheritance in electron::OffScreenRenderWidgetHostView

* refactor: use private inheritance in electron::InspectableWebContents

* refactor: use private inheritance in electron::ElectronUsbDelegate

* refactor: use private inheritance in electron::LoginHandler

* refactor: use private inheritance in WebFrameRenderer

* refactor: use private inheritance in electron::ElectronSerialDelegate

* refactor: use private inheritance in electron::ClientFrameViewLinux

* refactor: use private inheritance in electron::ElectronHidDelegate

* refactor: use private inheritance in IPCRenderer

* refactor: use private inheritance in electron::WinCaptionButtonContainer

* refactor: use private inheritance in electron::ElectronApiIPCHandlerImpl

* refactor: use private inheritance in electron::api::ServiceWorkerContext

* refactor: use private inheritance in ui::FileSelectHelper

* refactor: use private inheritance in electron::api::WebContentsView

* refactor: use private inheritance in electron::api::SimpleURLLoaderWrapper

* refactor: use private inheritance in electron::api::InAppPurchase

* refactor: use private inheritance in electron::api::Debugger

* refactor: use private inheritance in electron::ElectronWebContentsUtilityHandlerImpl

* refactor: use private inheritance in electron::OffScreenWebContentsView
This commit is contained in:
Charles Kerr 2024-05-29 13:07:02 -05:00 committed by GitHub
parent 705d92c5f6
commit ae0c55c0b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 54 additions and 54 deletions

View file

@ -50,9 +50,9 @@ namespace api {
class App : public ElectronBrowserClient::Delegate,
public gin::Wrappable<App>,
public gin_helper::EventEmitterMixin<App>,
public BrowserObserver,
public content::GpuDataManagerObserver,
public content::BrowserChildProcessObserver {
private BrowserObserver,
private content::GpuDataManagerObserver,
private content::BrowserChildProcessObserver {
public:
using FileIconCallback =
base::RepeatingCallback<void(v8::Local<v8::Value>, const gfx::Image&)>;

View file

@ -18,7 +18,7 @@ namespace electron::api {
class AutoUpdater : public gin::Wrappable<AutoUpdater>,
public gin_helper::EventEmitterMixin<AutoUpdater>,
public auto_updater::Delegate,
public WindowListObserver {
private WindowListObserver {
public:
static gin::Handle<AutoUpdater> Create(v8::Isolate* isolate);

View file

@ -26,7 +26,7 @@ namespace electron::api {
class View;
class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
public NativeWindowObserver {
private NativeWindowObserver {
public:
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);

View file

@ -16,8 +16,8 @@
namespace electron::api {
class BrowserWindow : public BaseWindow,
public content::WebContentsObserver,
public ExtendedWebContentsObserver {
private content::WebContentsObserver,
private ExtendedWebContentsObserver {
public:
static gin_helper::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);

View file

@ -28,7 +28,7 @@ namespace electron::api {
class Debugger : public gin::Wrappable<Debugger>,
public gin_helper::EventEmitterMixin<Debugger>,
public content::DevToolsAgentHostClient,
public content::WebContentsObserver {
private content::WebContentsObserver {
public:
static gin::Handle<Debugger> Create(v8::Isolate* isolate,
content::WebContents* web_contents);

View file

@ -24,7 +24,7 @@ namespace electron::api {
class DownloadItem : public gin::Wrappable<DownloadItem>,
public gin_helper::Pinnable<DownloadItem>,
public gin_helper::EventEmitterMixin<DownloadItem>,
public download::DownloadItem::Observer {
private download::DownloadItem::Observer {
public:
static gin::Handle<DownloadItem> FromOrCreate(v8::Isolate* isolate,
download::DownloadItem* item);

View file

@ -20,7 +20,7 @@ namespace electron::api {
class InAppPurchase : public gin::Wrappable<InAppPurchase>,
public gin_helper::EventEmitterMixin<InAppPurchase>,
public in_app_purchase::TransactionObserver {
private in_app_purchase::TransactionObserver {
public:
static gin::Handle<InAppPurchase> Create(v8::Isolate* isolate);

View file

@ -24,7 +24,7 @@ class Menu : public gin::Wrappable<Menu>,
public gin_helper::Constructible<Menu>,
public gin_helper::Pinnable<Menu>,
public ElectronMenuModel::Delegate,
public ElectronMenuModel::Observer {
private ElectronMenuModel::Observer {
public:
// gin_helper::Constructible
static gin::Handle<Menu> New(gin::Arguments* args);

View file

@ -16,7 +16,7 @@ namespace electron::api {
class NativeTheme : public gin::Wrappable<NativeTheme>,
public gin_helper::EventEmitterMixin<NativeTheme>,
public ui::NativeThemeObserver {
private ui::NativeThemeObserver {
public:
static gin::Handle<NativeTheme> Create(v8::Isolate* isolate);

View file

@ -20,9 +20,9 @@ namespace electron::api {
class PowerMonitor : public gin::Wrappable<PowerMonitor>,
public gin_helper::EventEmitterMixin<PowerMonitor>,
public gin_helper::Pinnable<PowerMonitor>,
public base::PowerStateObserver,
public base::PowerSuspendObserver,
public base::PowerThermalObserver {
private base::PowerStateObserver,
private base::PowerSuspendObserver,
private base::PowerThermalObserver {
public:
static v8::Local<v8::Value> Create(v8::Isolate* isolate);

View file

@ -21,7 +21,7 @@ class PushNotifications
: public ElectronBrowserClient::Delegate,
public gin::Wrappable<PushNotifications>,
public gin_helper::EventEmitterMixin<PushNotifications>,
public BrowserObserver {
private BrowserObserver {
public:
static PushNotifications* Get();
static gin::Handle<PushNotifications> Create(v8::Isolate* isolate);

View file

@ -24,7 +24,7 @@ namespace electron::api {
class Screen : public gin::Wrappable<Screen>,
public gin_helper::EventEmitterMixin<Screen>,
public display::DisplayObserver {
private display::DisplayObserver {
public:
static v8::Local<v8::Value> Create(gin_helper::ErrorThrower error_thrower);

View file

@ -21,7 +21,7 @@ namespace api {
class ServiceWorkerContext
: public gin::Wrappable<ServiceWorkerContext>,
public gin_helper::EventEmitterMixin<ServiceWorkerContext>,
public content::ServiceWorkerContextObserver {
private content::ServiceWorkerContextObserver {
public:
static gin::Handle<ServiceWorkerContext> Create(
v8::Isolate* isolate,

View file

@ -262,7 +262,7 @@ class ClearDataTask {
// of a full |ClearDataTask|. This class manages its own lifetime, cleaning
// itself up after the operation completes and notifies the task of the
// result.
class ClearDataOperation : public BrowsingDataRemover::Observer {
class ClearDataOperation : private BrowsingDataRemover::Observer {
public:
static void Run(std::shared_ptr<ClearDataTask> task,
BrowsingDataRemover* remover,

View file

@ -65,12 +65,12 @@ class Session : public gin::Wrappable<Session>,
public gin_helper::EventEmitterMixin<Session>,
public gin_helper::CleanedUpAtExit,
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
public SpellcheckHunspellDictionary::Observer,
private SpellcheckHunspellDictionary::Observer,
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
public extensions::ExtensionRegistryObserver,
private extensions::ExtensionRegistryObserver,
#endif
public content::DownloadManager::Observer {
private content::DownloadManager::Observer {
public:
// Gets or creates Session from the |browser_context|.
static gin::Handle<Session> CreateFrom(

View file

@ -39,7 +39,7 @@ class Tray : public gin::Wrappable<Tray>,
public gin_helper::Constructible<Tray>,
public gin_helper::CleanedUpAtExit,
public gin_helper::Pinnable<Tray>,
public TrayIconObserver {
private TrayIconObserver {
public:
// gin_helper::Constructible
static gin::Handle<Tray> New(gin_helper::ErrorThrower thrower,

View file

@ -111,7 +111,7 @@ class WebContents : public ExclusiveAccessContext,
public gin_helper::CleanedUpAtExit,
public content::WebContentsObserver,
public content::WebContentsDelegate,
public content::RenderWidgetHost::InputEventObserver,
private content::RenderWidgetHost::InputEventObserver,
public content::JavaScriptDialogManager,
public InspectableWebContentsDelegate,
public InspectableWebContentsViewDelegate,

View file

@ -21,7 +21,7 @@ namespace electron::api {
class WebContents;
class WebContentsView : public View,
public content::WebContentsObserver,
private content::WebContentsObserver,
public DraggableRegionProvider {
public:
// Create a new instance of WebContentsView.

View file

@ -20,7 +20,7 @@ class RenderFrameHost;
namespace electron {
class ElectronApiIPCHandlerImpl : public mojom::ElectronApiIPC,
public content::WebContentsObserver {
private content::WebContentsObserver {
public:
explicit ElectronApiIPCHandlerImpl(
content::RenderFrameHost* render_frame_host,

View file

@ -43,7 +43,7 @@ class PlatformNotificationService;
class ElectronWebAuthenticationDelegate;
class ElectronBrowserClient : public content::ContentBrowserClient,
public content::RenderProcessHostObserver {
private content::RenderProcessHostObserver {
public:
static ElectronBrowserClient* Get();
static void SetApplicationLocale(const std::string& locale);

View file

@ -21,7 +21,7 @@ class RenderFrameHost;
namespace electron {
class ElectronWebContentsUtilityHandlerImpl
: public mojom::ElectronWebContentsUtility,
public content::WebContentsObserver {
private content::WebContentsObserver {
public:
explicit ElectronWebContentsUtilityHandlerImpl(
content::RenderFrameHost* render_frame_host,

View file

@ -41,7 +41,7 @@ class FileSelectHelper : public base::RefCountedThreadSafe<
FileSelectHelper,
content::BrowserThread::DeleteOnUIThread>,
public ui::SelectFileDialog::Listener,
public content::WebContentsObserver,
private content::WebContentsObserver,
private net::DirectoryLister::DirectoryListerDelegate {
public:
// disable copy

View file

@ -41,7 +41,7 @@ namespace electron {
// Manages the HidDelegate observers for a single browser context.
class ElectronHidDelegate::ContextObservation
: public HidChooserContext::DeviceObserver {
: private HidChooserContext::DeviceObserver {
public:
ContextObservation(ElectronHidDelegate* parent,
content::BrowserContext* browser_context)

View file

@ -22,7 +22,7 @@ namespace electron {
// Handles HTTP basic auth.
class LoginHandler : public content::LoginDelegate,
public content::WebContentsObserver {
private content::WebContentsObserver {
public:
LoginHandler(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,

View file

@ -38,8 +38,8 @@ gfx::Rect ScreenToDIPRect(HWND hwnd, const gfx::Rect& pixel_bounds);
#endif
class NativeWindowViews : public NativeWindow,
public views::WidgetObserver,
public ui::EventHandler {
private views::WidgetObserver,
private ui::EventHandler {
public:
NativeWindowViews(const gin_helper::Dictionary& options,
NativeWindow* parent);

View file

@ -61,9 +61,9 @@ typedef base::RepeatingCallback<void(const gfx::Rect&)> OnPopupPaintCallback;
class OffScreenRenderWidgetHostView
: public content::RenderWidgetHostViewBase,
public content::RenderFrameMetadataProvider::Observer,
private content::RenderFrameMetadataProvider::Observer,
public ui::CompositorDelegate,
public OffscreenViewProxyObserver {
private OffscreenViewProxyObserver {
public:
OffScreenRenderWidgetHostView(bool transparent,
bool painting,

View file

@ -28,7 +28,7 @@ namespace electron {
class OffScreenWebContentsView : public content::WebContentsView,
public content::RenderViewHostDelegateView,
public NativeWindowObserver {
private NativeWindowObserver {
public:
OffScreenWebContentsView(bool transparent, const OnPaintCallback& callback);
~OffScreenWebContentsView() override;

View file

@ -20,7 +20,7 @@ namespace electron {
class SerialChooserController;
class ElectronSerialDelegate : public content::SerialDelegate,
public SerialChooserContext::PortObserver {
private SerialChooserContext::PortObserver {
public:
ElectronSerialDelegate();
~ElectronSerialDelegate() override;

View file

@ -23,8 +23,8 @@ namespace electron {
class ElectronDesktopWindowTreeHostLinux
: public views::DesktopWindowTreeHostLinux,
public ui::NativeThemeObserver,
public ui::DeviceScaleFactorObserver {
private ui::NativeThemeObserver,
private ui::DeviceScaleFactorObserver {
public:
ElectronDesktopWindowTreeHostLinux(
NativeWindowViews* native_window_view,

View file

@ -34,7 +34,7 @@ class InspectableWebContentsView;
class InspectableWebContents
: public content::DevToolsAgentHostClient,
public content::WebContentsObserver,
private content::WebContentsObserver,
public content::WebContentsDelegate,
public DevToolsEmbedderMessageDispatcher::Delegate {
public:

View file

@ -47,7 +47,7 @@ base::flat_map<int, GtkWidget*>& GetDialogsMap() {
return *dialogs;
}
class GtkMessageBox : public NativeWindowObserver {
class GtkMessageBox : private NativeWindowObserver {
public:
explicit GtkMessageBox(const MessageBoxSettings& settings)
: id_(settings.id),

View file

@ -58,8 +58,8 @@ class AutofillPopupChildView : public views::View {
};
class AutofillPopupView : public views::WidgetDelegateView,
public views::WidgetFocusChangeListener,
public views::WidgetObserver,
private views::WidgetFocusChangeListener,
private views::WidgetObserver,
public views::DragController {
public:
explicit AutofillPopupView(AutofillPopup* popup,

View file

@ -29,8 +29,8 @@
namespace electron {
class ClientFrameViewLinux : public FramelessView,
public ui::NativeThemeObserver,
public ui::WindowButtonOrderObserver {
private ui::NativeThemeObserver,
private ui::WindowButtonOrderObserver {
METADATA_HEADER(ClientFrameViewLinux, FramelessView)
public:

View file

@ -21,8 +21,8 @@ class MenuButton;
namespace electron {
class MenuBar : public views::AccessiblePaneView,
public MenuDelegate::Observer,
public NativeWindowObserver {
private MenuDelegate::Observer,
private NativeWindowObserver {
METADATA_HEADER(MenuBar, views::AccessiblePaneView)
public:

View file

@ -27,7 +27,7 @@ class WinCaptionButton;
// frame and browser window as needed. When extended horizontally, becomes a
// grab bar for moving the window.
class WinCaptionButtonContainer : public views::View,
public views::WidgetObserver {
private views::WidgetObserver {
METADATA_HEADER(WinCaptionButtonContainer, views::View)
public:

View file

@ -88,7 +88,7 @@ namespace electron {
// Manages the UsbDelegate observers for a single browser context.
class ElectronUsbDelegate::ContextObservation
: public UsbChooserContext::DeviceObserver {
: private UsbChooserContext::DeviceObserver {
public:
ContextObservation(ElectronUsbDelegate* parent,
content::BrowserContext* browser_context)

View file

@ -46,8 +46,8 @@ namespace electron::api {
class SimpleURLLoaderWrapper
: public gin::Wrappable<SimpleURLLoaderWrapper>,
public gin_helper::EventEmitterMixin<SimpleURLLoaderWrapper>,
public network::SimpleURLLoaderStreamConsumer,
public network::mojom::URLLoaderNetworkServiceObserver {
private network::SimpleURLLoaderStreamConsumer,
private network::mojom::URLLoaderNetworkServiceObserver {
public:
~SimpleURLLoaderWrapper() override;
static gin::Handle<SimpleURLLoaderWrapper> Create(gin::Arguments* args);

View file

@ -42,7 +42,7 @@ RenderFrame* GetCurrentRenderFrame() {
}
class IPCRenderer : public gin::Wrappable<IPCRenderer>,
public content::RenderFrameObserver {
private content::RenderFrameObserver {
public:
static gin::WrapperInfo kWrapperInfo;

View file

@ -272,7 +272,7 @@ class FrameSetSpellChecker : public content::RenderFrameVisitor {
content::RenderFrame* main_frame_;
};
class SpellCheckerHolder final : public content::RenderFrameObserver {
class SpellCheckerHolder final : private content::RenderFrameObserver {
public:
// Find existing holder for the |render_frame|.
static SpellCheckerHolder* FromRenderFrame(
@ -330,7 +330,7 @@ class SpellCheckerHolder final : public content::RenderFrameObserver {
} // namespace
class WebFrameRenderer : public gin::Wrappable<WebFrameRenderer>,
public content::RenderFrameObserver {
private content::RenderFrameObserver {
public:
static gin::WrapperInfo kWrapperInfo;