refactor: move NativeWindow::child_windows_ to NativeWindowMac

only the Mac subclass uses it, so put it there
This commit is contained in:
Charles Kerr 2024-09-01 09:21:57 -05:00
Родитель fe0d4274e2
Коммит 55fd0743f9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 86CE40F971A50453
3 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -5,7 +5,6 @@
#ifndef ELECTRON_SHELL_BROWSER_NATIVE_WINDOW_H_
#define ELECTRON_SHELL_BROWSER_NATIVE_WINDOW_H_
#include <list>
#include <memory>
#include <optional>
#include <queue>
@ -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<NativeWindow*> child_windows_;
private:
std::unique_ptr<views::Widget> widget_;

Просмотреть файл

@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h>
#include <list>
#include <memory>
#include <optional>
#include <string>
@ -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<NativeWindow*> child_windows_;
};
} // namespace electron

Просмотреть файл

@ -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<NativeWindowMac*>(new_parent)) {
new_parent_mac->add_child_window(this);
if (attach)
new_parent->AttachChildren();
new_parent_mac->AttachChildren();
}
NativeWindow::SetParentWindow(new_parent);