return window_->SetIgnoreMouseEvents(ignore);
}
+void Window::SetContentProtection(bool enable) {
+ return window_->SetContentProtection(enable);
+}
+
void Window::SetFocusable(bool focusable) {
return window_->SetFocusable(focusable);
}
.SetMethod("setDocumentEdited", &Window::SetDocumentEdited)
.SetMethod("isDocumentEdited", &Window::IsDocumentEdited)
.SetMethod("setIgnoreMouseEvents", &Window::SetIgnoreMouseEvents)
+ .SetMethod("setContentProtection", &Window::SetContentProtection)
.SetMethod("setFocusable", &Window::SetFocusable)
.SetMethod("focusOnWebView", &Window::FocusOnWebView)
.SetMethod("blurWebView", &Window::BlurWebView)
void SetDocumentEdited(bool edited);
bool IsDocumentEdited();
void SetIgnoreMouseEvents(bool ignore);
+ void SetContentProtection(bool enable);
void SetFocusable(bool focusable);
void CapturePage(mate::Arguments* args);
void SetProgressBar(double progress);
virtual void SetDocumentEdited(bool edited);
virtual bool IsDocumentEdited();
virtual void SetIgnoreMouseEvents(bool ignore) = 0;
+ virtual void SetContentProtection(bool enable) = 0;
virtual void SetFocusable(bool focusable);
virtual void SetMenu(ui::MenuModel* menu);
virtual bool HasModalDialog();
void SetDocumentEdited(bool edited) override;
bool IsDocumentEdited() override;
void SetIgnoreMouseEvents(bool ignore) override;
+ void SetContentProtection(bool enable) override;
bool HasModalDialog() override;
void SetParentWindow(NativeWindow* parent) override;
gfx::NativeWindow GetNativeWindow() override;
[window_ setIgnoresMouseEvents:ignore];
}
+void NativeWindowMac::SetContentProtection(bool enable) {
+ [window_ setSharingType:enable ? NSWindowSharingNone
+ : NSWindowSharingReadOnly];
+}
+
bool NativeWindowMac::HasModalDialog() {
return [window_ attachedSheet] != nil;
}
#endif
}
+void NativeWindowViews::SetContentProtection(bool enable) {
+#if defined(OS_WIN)
+ DWORD affinity = enable ? WDA_MONITOR : WDA_NONE;
+ ::SetWindowDisplayAffinity(GetAcceleratedWidget(), affinity);
+#endif
+}
+
void NativeWindowViews::SetFocusable(bool focusable) {
#if defined(OS_WIN)
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
void SetHasShadow(bool has_shadow) override;
bool HasShadow() override;
void SetIgnoreMouseEvents(bool ignore) override;
+ void SetContentProtection(bool enable) override;
void SetFocusable(bool focusable) override;
void SetMenu(ui::MenuModel* menu_model) override;
void SetParentWindow(NativeWindow* parent) override;
this window, but if this window has focus, it will still receive keyboard
events.
+### `win.setContentProtection(enable)` _macOS_ _Windows_
+
+Prevents the window contents from being captured by other apps.
+
+On macOS it sets the NSWindow's sharingType to NSWindowSharingNone.
+On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
+
### `win.setFocusable(focusable)` _Windows_
* `focusable` Boolean