From bb22eaccec5c9fc593a0a6d8ddfeae62bfd9e9ca Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 23 Jun 2025 04:24:05 -0500 Subject: [PATCH] refactor: simplify titlebar overlay initialization (#47480) --- shell/browser/native_window.cc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index dfbbbd0770e..0f69dc57f6f 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -114,20 +114,12 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, options.Get(options::kVibrancyType, &vibrancy_); #endif - v8::Local titlebar_overlay; - if (options.Get(options::ktitleBarOverlay, &titlebar_overlay)) { - if (titlebar_overlay->IsBoolean()) { - options.Get(options::ktitleBarOverlay, &titlebar_overlay_); - } else if (titlebar_overlay->IsObject()) { - titlebar_overlay_ = true; - - 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; - } + if (gin_helper::Dictionary dict; + options.Get(options::ktitleBarOverlay, &dict)) { + titlebar_overlay_ = true; + titlebar_overlay_height_ = dict.ValueOrDefault(options::kOverlayHeight, 0); + } else if (bool flag; options.Get(options::ktitleBarOverlay, &flag)) { + titlebar_overlay_ = flag; } WindowList::AddWindow(this);