mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: NativeWindow::Create() returns a unique_ptr (#43607)
refactor: NativeWindow::Create() returns a unique_ptr Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
@@ -98,8 +98,8 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
// Creates NativeWindow.
|
||||
window_.reset(NativeWindow::Create(
|
||||
options, parent.IsEmpty() ? nullptr : parent->window_.get()));
|
||||
window_ = NativeWindow::Create(
|
||||
options, parent.IsEmpty() ? nullptr : parent->window_.get());
|
||||
window_->AddObserver(this);
|
||||
|
||||
SetContentView(View::Create(isolate));
|
||||
|
||||
@@ -71,8 +71,9 @@ class NativeWindow : public base::SupportsUserData,
|
||||
|
||||
// Create window with existing WebContents, the caller is responsible for
|
||||
// managing the window's live.
|
||||
static NativeWindow* Create(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent = nullptr);
|
||||
static std::unique_ptr<NativeWindow> Create(
|
||||
const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent = nullptr);
|
||||
|
||||
void InitFromOptions(const gin_helper::Dictionary& options);
|
||||
|
||||
|
||||
@@ -1814,9 +1814,10 @@ std::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
||||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return new NativeWindowMac(options, parent);
|
||||
std::unique_ptr<NativeWindow> NativeWindow::Create(
|
||||
const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return std::make_unique<NativeWindowMac>(options, parent);
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -1789,9 +1789,10 @@ void NativeWindowViews::MoveBehindTaskBarIfNeeded() {
|
||||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return new NativeWindowViews(options, parent);
|
||||
std::unique_ptr<NativeWindow> NativeWindow::Create(
|
||||
const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return std::make_unique<NativeWindowViews>(options, parent);
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
Reference in New Issue
Block a user