diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 8423aa48f8e6..19db0ef56d76 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -97,10 +97,11 @@ gfx::Size GetExpandedWindowSize(const NativeWindow* window, gfx::Size size) { NativeWindow::NativeWindow(const gin_helper::Dictionary& options, NativeWindow* parent) - : widget_(std::make_unique()), parent_(parent) { + : transparent_{options.ValueOrDefault(options::kTransparent, false)}, + enable_larger_than_screen_{ + options.ValueOrDefault(options::kEnableLargerThanScreen, false)}, + parent_{parent} { options.Get(options::kFrame, &has_frame_); - options.Get(options::kTransparent, &transparent_); - options.Get(options::kEnableLargerThanScreen, &enable_larger_than_screen_); options.Get(options::kTitleBarStyle, &title_bar_style_); #if BUILDFLAG(IS_WIN) options.Get(options::kBackgroundMaterial, &background_material_); diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index ae453dae7d56..f2a8334a951a 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -400,8 +400,11 @@ class NativeWindow : public base::SupportsUserData, [[nodiscard]] bool has_client_frame() const { return has_client_frame_; } - bool transparent() const { return transparent_; } - bool enable_larger_than_screen() const { return enable_larger_than_screen_; } + [[nodiscard]] bool transparent() const { return transparent_; } + + [[nodiscard]] bool enable_larger_than_screen() const { + return enable_larger_than_screen_; + } NativeWindow* parent() const { return parent_; } bool is_modal() const { return is_modal_; } @@ -478,11 +481,17 @@ class NativeWindow : public base::SupportsUserData, private: static bool PlatformHasClientFrame(); - std::unique_ptr widget_; + std::unique_ptr widget_ = std::make_unique(); static inline int32_t next_id_ = 0; const int32_t window_id_ = ++next_id_; + // Whether window is transparent. + const bool transparent_; + + // Whether window can be resized larger than screen. + const bool enable_larger_than_screen_; + // The content view, weak ref. raw_ptr content_view_ = nullptr; @@ -498,12 +507,6 @@ class NativeWindow : public base::SupportsUserData, // Wayland hosts. const bool has_client_frame_ = PlatformHasClientFrame(); - // Whether window is transparent. - bool transparent_ = false; - - // Whether window can be resized larger than screen. - bool enable_larger_than_screen_ = false; - // The windows has been closed. bool is_closed_ = false;