mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: add NativeWindow::FromWidget() helper (#46917)
refactor: add NativeWindow::FromWidet() helper refactor: make kElectronNativeWindowKey a protected field
This commit is contained in:
@@ -284,6 +284,13 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||
Show();
|
||||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::FromWidget(const views::Widget* widget) {
|
||||
DCHECK(widget);
|
||||
return static_cast<NativeWindow*>(
|
||||
widget->GetNativeWindowProperty(kNativeWindowKey.c_str()));
|
||||
}
|
||||
|
||||
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
|
||||
SetBounds(gfx::Rect(GetPosition(), size), animate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user