refactor: use upstream content protection logic on macOS (#46813)
* refactor: use upstream content protection logic on macOS Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update shell/browser/native_window.h Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
5c2f70c1d5
commit
34adb976b6
6 changed files with 17 additions and 30 deletions
|
@ -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)
|
||||
|
@ -818,6 +819,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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue