mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: use upstream content protection logic on macOS (#46780)
* refactor: use upstream content protection logic on macOS * Update shell/browser/native_window.h Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "ui/base/hit_test.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/views/widget/native_widget_private.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
|
||||
#if !BUILDFLAG(IS_MAC)
|
||||
@@ -822,6 +823,20 @@ void NativeWindow::HandlePendingFullscreenTransitions() {
|
||||
SetFullScreen(next_transition);
|
||||
}
|
||||
|
||||
void NativeWindow::SetContentProtection(bool enable) {
|
||||
#if !BUILDFLAG(IS_LINUX)
|
||||
widget()->native_widget_private()->SetAllowScreenshots(!enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NativeWindow::IsContentProtected() const {
|
||||
#if !BUILDFLAG(IS_LINUX)
|
||||
return !widget()->native_widget_private()->AreScreenshotsAllowed();
|
||||
#else // Not implemented on Linux
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NativeWindow::IsTranslucent() const {
|
||||
// Transparent windows are translucent
|
||||
if (transparent()) {
|
||||
|
||||
Reference in New Issue
Block a user