refactor: NativeWindow::Create()
returns a unique_ptr (#43605)
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:
parent
9da190f786
commit
5c424edcca
4 changed files with 13 additions and 10 deletions
|
@ -96,8 +96,8 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates NativeWindow.
|
// Creates NativeWindow.
|
||||||
window_.reset(NativeWindow::Create(
|
window_ = NativeWindow::Create(
|
||||||
options, parent.IsEmpty() ? nullptr : parent->window_.get()));
|
options, parent.IsEmpty() ? nullptr : parent->window_.get());
|
||||||
window_->AddObserver(this);
|
window_->AddObserver(this);
|
||||||
|
|
||||||
SetContentView(View::Create(isolate));
|
SetContentView(View::Create(isolate));
|
||||||
|
|
|
@ -72,7 +72,8 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
|
|
||||||
// Create window with existing WebContents, the caller is responsible for
|
// Create window with existing WebContents, the caller is responsible for
|
||||||
// managing the window's live.
|
// managing the window's live.
|
||||||
static NativeWindow* Create(const gin_helper::Dictionary& options,
|
static std::unique_ptr<NativeWindow> Create(
|
||||||
|
const gin_helper::Dictionary& options,
|
||||||
NativeWindow* parent = nullptr);
|
NativeWindow* parent = nullptr);
|
||||||
|
|
||||||
void InitFromOptions(const gin_helper::Dictionary& options);
|
void InitFromOptions(const gin_helper::Dictionary& options);
|
||||||
|
|
|
@ -1805,9 +1805,10 @@ std::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
|
std::unique_ptr<NativeWindow> NativeWindow::Create(
|
||||||
|
const gin_helper::Dictionary& options,
|
||||||
NativeWindow* parent) {
|
NativeWindow* parent) {
|
||||||
return new NativeWindowMac(options, parent);
|
return std::make_unique<NativeWindowMac>(options, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace electron
|
} // namespace electron
|
||||||
|
|
|
@ -1787,9 +1787,10 @@ void NativeWindowViews::MoveBehindTaskBarIfNeeded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
|
std::unique_ptr<NativeWindow> NativeWindow::Create(
|
||||||
|
const gin_helper::Dictionary& options,
|
||||||
NativeWindow* parent) {
|
NativeWindow* parent) {
|
||||||
return new NativeWindowViews(options, parent);
|
return std::make_unique<NativeWindowViews>(options, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace electron
|
} // namespace electron
|
||||||
|
|
Loading…
Reference in a new issue