Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 docs/api/base-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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_

* `focusable` boolean
Expand Down
4 changes: 4 additions & 0 deletions 4 docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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_

* `focusable` boolean
Expand Down
2 changes: 1 addition & 1 deletion 2 shell/browser/api/electron_api_base_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isDocumentEdited", &BaseWindow::IsDocumentEdited)
.SetMethod("setIgnoreMouseEvents", &BaseWindow::SetIgnoreMouseEvents)
.SetMethod("setContentProtection", &BaseWindow::SetContentProtection)
.SetMethod("_isContentProtected", &BaseWindow::IsContentProtected)
.SetMethod("isContentProtected", &BaseWindow::IsContentProtected)
.SetMethod("setFocusable", &BaseWindow::SetFocusable)
.SetMethod("isFocusable", &BaseWindow::IsFocusable)
.SetMethod("setMenu", &BaseWindow::SetMenu)
Expand Down
9 changes: 3 additions & 6 deletions 9 spec/api-browser-window-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,15 @@ describe('BrowserWindow module', () => {
afterEach(closeAllWindows);
it('can set content protection', async () => {
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');

w.show();
await shown;

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 () => {
Expand All @@ -329,8 +327,7 @@ describe('BrowserWindow module', () => {
w.show();
await shown;

// @ts-expect-error This is a private API
expect(w._isContentProtected()).to.equal(true);
expect(w.isContentProtected()).to.equal(true);
});
});

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.