refactor: add NativeWindowViews::SetTitleBarOverlay()
#47126
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
This is part of a series to update the lifecycle of
NativeWindow::widget_
to use non-deprecated views API, e.g. usingviews::Widget::MakeCloseSynchronous()
.There's a lot of work to do first though. For example, we have a lot of code that calls
window->widget()->foo()
and it's nontrivial to figure out which code paths will be reachable whenwidget()
isnullptr
after we make its destruction synchronous. So I'm going to remove some of the footguns by reducing public use ofNativeWindow::widget()
.This PR moves the implementation of
api::BaseWindow::SetTitleBarOverlay()
into a new methodNativeWindowViews::SetTitleBarOverlay()
. The main motivation to reduce public use ofNativeWindow::widget()
; but since code being moved fits better inNativeWindowViews
, it improves data hiding in several ways:api::BaseWindow
no longer needs to callNativeWindow::widget()
NativeWindowViews::set_overlay_button_color()
can be made privateNativeWindowVeiws::set_overlay_symbol_color()
can be made privateNativeWindow::set_titlebar_overlay_height()
can be made protectedBaseWindow
no longer needs to know about Widget internals, e.g. it no longer callsNativeWindow::widget()->non_client_view()->frame_view()
and no longer needs to know what derived type it should use when downcasting thatNonClientFrameView*
.Checklist
npm test
passesRelease Notes
Notes: none.