refactor: simplify titlebar overlay initialization (#47480)

This commit is contained in:
Charles Kerr 2025-06-23 04:24:05 -05:00 committed by GitHub
commit bb22eaccec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,20 +114,12 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
options.Get(options::kVibrancyType, &vibrancy_); options.Get(options::kVibrancyType, &vibrancy_);
#endif #endif
v8::Local<v8::Value> titlebar_overlay; if (gin_helper::Dictionary dict;
if (options.Get(options::ktitleBarOverlay, &titlebar_overlay)) { options.Get(options::ktitleBarOverlay, &dict)) {
if (titlebar_overlay->IsBoolean()) {
options.Get(options::ktitleBarOverlay, &titlebar_overlay_);
} else if (titlebar_overlay->IsObject()) {
titlebar_overlay_ = true; titlebar_overlay_ = true;
titlebar_overlay_height_ = dict.ValueOrDefault(options::kOverlayHeight, 0);
auto titlebar_overlay_dict = } else if (bool flag; options.Get(options::ktitleBarOverlay, &flag)) {
gin_helper::Dictionary::CreateEmpty(options.isolate()); titlebar_overlay_ = flag;
options.Get(options::ktitleBarOverlay, &titlebar_overlay_dict);
int height;
if (titlebar_overlay_dict.Get(options::kOverlayHeight, &height))
titlebar_overlay_height_ = height;
}
} }
WindowList::AddWindow(this); WindowList::AddWindow(this);