refactor: simplify titlebar overlay initialization (#47480)
This commit is contained in:
parent
90a14299fd
commit
bb22eaccec
1 changed files with 6 additions and 14 deletions
|
@ -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()) {
|
titlebar_overlay_ = true;
|
||||||
options.Get(options::ktitleBarOverlay, &titlebar_overlay_);
|
titlebar_overlay_height_ = dict.ValueOrDefault(options::kOverlayHeight, 0);
|
||||||
} else if (titlebar_overlay->IsObject()) {
|
} else if (bool flag; options.Get(options::ktitleBarOverlay, &flag)) {
|
||||||
titlebar_overlay_ = true;
|
titlebar_overlay_ = flag;
|
||||||
|
|
||||||
auto titlebar_overlay_dict =
|
|
||||||
gin_helper::Dictionary::CreateEmpty(options.isolate());
|
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue