From 55fd0743f9d0fce1666fc64c4675bbf572d629d9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 1 Sep 2024 09:21:57 -0500 Subject: [PATCH] refactor: move NativeWindow::child_windows_ to NativeWindowMac only the Mac subclass uses it, so put it there --- shell/browser/native_window.h | 7 ------- shell/browser/native_window_mac.h | 7 +++++++ shell/browser/native_window_mac.mm | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index d387c8f793..bc9d0a068d 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -5,7 +5,6 @@ #ifndef ELECTRON_SHELL_BROWSER_NATIVE_WINDOW_H_ #define ELECTRON_SHELL_BROWSER_NATIVE_WINDOW_H_ -#include #include #include #include @@ -402,10 +401,6 @@ class NativeWindow : public base::SupportsUserData, int32_t window_id() const { return next_id_; } - void add_child_window(NativeWindow* child) { - child_windows_.push_back(child); - } - int NonClientHitTest(const gfx::Point& point); void AddDraggableRegionProvider(DraggableRegionProvider* provider); void RemoveDraggableRegionProvider(DraggableRegionProvider* provider); @@ -458,8 +453,6 @@ class NativeWindow : public base::SupportsUserData, FullScreenTransitionType fullscreen_transition_type_ = FullScreenTransitionType::kNone; - std::list child_windows_; - private: std::unique_ptr widget_; diff --git a/shell/browser/native_window_mac.h b/shell/browser/native_window_mac.h index cb39aab484..fcde24ba8b 100644 --- a/shell/browser/native_window_mac.h +++ b/shell/browser/native_window_mac.h @@ -7,6 +7,7 @@ #import +#include #include #include #include @@ -234,6 +235,10 @@ class NativeWindowMac : public NativeWindow, uint32_t changed_metrics) override; private: + void add_child_window(NativeWindow* child) { + child_windows_.push_back(child); + } + // Add custom layers to the content view. void AddContentViewLayers(); @@ -307,6 +312,8 @@ class NativeWindowMac : public NativeWindow, // The presentation options before entering simple fullscreen mode. NSApplicationPresentationOptions simple_fullscreen_options_; + + std::list child_windows_; }; } // namespace electron diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 625ffcf612..50212dbcf8 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1771,10 +1771,10 @@ void NativeWindowMac::InternalSetParentWindow(NativeWindow* new_parent, RemoveChildFromParentWindow(); // Set new parent window. - if (new_parent) { - new_parent->add_child_window(this); + if (auto* new_parent_mac = static_cast(new_parent)) { + new_parent_mac->add_child_window(this); if (attach) - new_parent->AttachChildren(); + new_parent_mac->AttachChildren(); } NativeWindow::SetParentWindow(new_parent);