refactor: reduce use of NativeWidgetPrivate (#46942)

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

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

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

* chore: remove native_widget_private #include from native_window_views_win

Not needed since Feb 2025: 9199d5c6
This commit is contained in:
Charles Kerr
2025-05-08 09:02:19 -05:00
committed by GitHub
parent d4ca829069
commit 9f8a629126
2 changed files with 4 additions and 6 deletions

View File

@@ -488,8 +488,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());
@@ -1287,15 +1286,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>