refactor: reduce use of NativeWidgetPrivate (#47006)

* refactor: do not use native_widget_private() in NativeWindowViews::SetContentProtection()

refactor: do not use native_widget_private() in NativeWindowViews::IsContentProtected()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: do not use native_widget_private() in NativeWindowViews::Show()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: remove native_widget_private #include from native_window_views_win

Not needed since Feb 2025: 9199d5c6

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot]
2025-05-08 15:33:43 -05:00
committed by GitHub
parent 057437f739
commit 2c6f713d72
2 changed files with 4 additions and 6 deletions

View File

@@ -487,8 +487,7 @@ bool NativeWindowViews::IsFocused() const {
}
void NativeWindowViews::Show() {
if (is_modal() && NativeWindow::parent() &&
!widget()->native_widget_private()->IsVisible())
if (is_modal() && NativeWindow::parent() && !widget()->IsVisible())
static_cast<NativeWindowViews*>(parent())->IncrementChildModals();
widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect());
@@ -1295,15 +1294,15 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
#endif
}
void NativeWindowViews::SetContentProtection(bool enable) {
void NativeWindowViews::SetContentProtection(const bool enable) {
#if BUILDFLAG(IS_WIN)
widget()->native_widget_private()->SetAllowScreenshots(!enable);
widget()->SetAllowScreenshots(!enable);
#endif
}
bool NativeWindowViews::IsContentProtected() const {
#if BUILDFLAG(IS_WIN)
return !widget()->native_widget_private()->AreScreenshotsAllowed();
return !widget()->AreScreenshotsAllowed();
#else // Not implemented on Linux
return false;
#endif

View File

@@ -19,7 +19,6 @@
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/resize_utils.h"
#include "ui/views/widget/native_widget_private.h"
// Must be included after other Windows headers.
#include <UIAutomationClient.h>