feat: expose win.isContentProtected()
(#47310)
* feat: expose win.isContentProtected() Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: remove stray _isContentProtected 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
c68389ad98
commit
2e2d1f1612
4 changed files with 12 additions and 7 deletions
|
@ -1346,6 +1346,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||||
|
|
||||||
|
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||||
|
|
||||||
|
Returns `boolean` - whether or not content protection is currently enabled.
|
||||||
|
|
||||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||||
|
|
||||||
* `focusable` boolean
|
* `focusable` boolean
|
||||||
|
|
|
@ -1528,6 +1528,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||||
|
|
||||||
|
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||||
|
|
||||||
|
Returns `boolean` - whether or not content protection is currently enabled.
|
||||||
|
|
||||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||||
|
|
||||||
* `focusable` boolean
|
* `focusable` boolean
|
||||||
|
|
|
@ -1260,7 +1260,7 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("isDocumentEdited", &BaseWindow::IsDocumentEdited)
|
.SetMethod("isDocumentEdited", &BaseWindow::IsDocumentEdited)
|
||||||
.SetMethod("setIgnoreMouseEvents", &BaseWindow::SetIgnoreMouseEvents)
|
.SetMethod("setIgnoreMouseEvents", &BaseWindow::SetIgnoreMouseEvents)
|
||||||
.SetMethod("setContentProtection", &BaseWindow::SetContentProtection)
|
.SetMethod("setContentProtection", &BaseWindow::SetContentProtection)
|
||||||
.SetMethod("_isContentProtected", &BaseWindow::IsContentProtected)
|
.SetMethod("isContentProtected", &BaseWindow::IsContentProtected)
|
||||||
.SetMethod("setFocusable", &BaseWindow::SetFocusable)
|
.SetMethod("setFocusable", &BaseWindow::SetFocusable)
|
||||||
.SetMethod("isFocusable", &BaseWindow::IsFocusable)
|
.SetMethod("isFocusable", &BaseWindow::IsFocusable)
|
||||||
.SetMethod("setMenu", &BaseWindow::SetMenu)
|
.SetMethod("setMenu", &BaseWindow::SetMenu)
|
||||||
|
|
|
@ -300,8 +300,7 @@ describe('BrowserWindow module', () => {
|
||||||
afterEach(closeAllWindows);
|
afterEach(closeAllWindows);
|
||||||
it('can set content protection', async () => {
|
it('can set content protection', async () => {
|
||||||
const w = new BrowserWindow({ show: false });
|
const w = new BrowserWindow({ show: false });
|
||||||
// @ts-expect-error This is a private API
|
expect(w.isContentProtected()).to.equal(false);
|
||||||
expect(w._isContentProtected()).to.equal(false);
|
|
||||||
|
|
||||||
const shown = once(w, 'show');
|
const shown = once(w, 'show');
|
||||||
|
|
||||||
|
@ -309,8 +308,7 @@ describe('BrowserWindow module', () => {
|
||||||
await shown;
|
await shown;
|
||||||
|
|
||||||
w.setContentProtection(true);
|
w.setContentProtection(true);
|
||||||
// @ts-expect-error This is a private API
|
expect(w.isContentProtected()).to.equal(true);
|
||||||
expect(w._isContentProtected()).to.equal(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not remove content protection after the window is hidden and shown', async () => {
|
it('does not remove content protection after the window is hidden and shown', async () => {
|
||||||
|
@ -329,8 +327,7 @@ describe('BrowserWindow module', () => {
|
||||||
w.show();
|
w.show();
|
||||||
await shown;
|
await shown;
|
||||||
|
|
||||||
// @ts-expect-error This is a private API
|
expect(w.isContentProtected()).to.equal(true);
|
||||||
expect(w._isContentProtected()).to.equal(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue