refactor: move IsClosed() and IsClosable() tests into NativeWindow::Close() (#46888)

refactor: devirtualize NativeWindow::IsClosed()
This commit is contained in:
Charles Kerr
2025-05-02 13:21:29 -05:00
committed by GitHub
parent 7153008bfa
commit 3faddd5ae2
8 changed files with 37 additions and 33 deletions

View File

@@ -82,9 +82,10 @@ class NativeWindow : public base::SupportsUserData,
virtual void SetContentView(views::View* view) = 0;
virtual void Close() = 0;
virtual void CloseImmediately() = 0;
virtual bool IsClosed() const;
// wrapper around CloseImpl that checks that window_ can be closed
void Close();
// wrapper around CloseImmediatelyImpl that checks that window_ can be closed
void CloseImmediately();
virtual void Focus(bool focus) = 0;
virtual bool IsFocused() const = 0;
virtual void Show() = 0;
@@ -436,6 +437,8 @@ class NativeWindow : public base::SupportsUserData,
protected:
friend class api::BrowserView;
[[nodiscard]] constexpr bool is_closed() const { return is_closed_; }
NativeWindow(const gin_helper::Dictionary& options, NativeWindow* parent);
virtual void OnTitleChanged() {}
@@ -447,6 +450,9 @@ class NativeWindow : public base::SupportsUserData,
void set_content_view(views::View* view) { content_view_ = view; }
virtual void CloseImpl() = 0;
virtual void CloseImmediatelyImpl() = 0;
// The boolean parsing of the "titleBarOverlay" option
bool titlebar_overlay_ = false;