Add a content.desktop_capture setting

See #2939
This commit is contained in:
Florian Bruhin 2018-06-11 20:18:57 +02:00
parent 69abc9a1a1
commit 141afff0c6
4 changed files with 47 additions and 0 deletions

View File

@ -116,6 +116,7 @@
|<<content.cookies.accept,content.cookies.accept>>|Which cookies to accept.
|<<content.cookies.store,content.cookies.store>>|Store cookies.
|<<content.default_encoding,content.default_encoding>>|Default encoding to use for websites.
|<<content.desktop_capture,content.desktop_capture>>|Allow websites to share screen content.
|<<content.dns_prefetch,content.dns_prefetch>>|Try to pre-fetch DNS entries to speed up browsing.
|<<content.frame_flattening,content.frame_flattening>>|Expand each subframe to its contents.
|<<content.geolocation,content.geolocation>>|Allow websites to request geolocations.
@ -1551,6 +1552,21 @@ Type: <<types,String>>
Default: +pass:[iso-8859-1]+
[[content.desktop_capture]]
=== content.desktop_capture
Allow websites to share screen content.
On Qt < 5.10, a dialog box is always displayed, even if this is set to "true".
Type: <<types,BoolAsk>>
Valid values:
* +true+
* +false+
* +ask+
Default: +pass:[ask]+
[[content.dns_prefetch]]
=== content.dns_prefetch
Try to pre-fetch DNS entries to speed up browsing.

View File

@ -110,6 +110,11 @@ class WebEngineSettings(websettings.AbstractSettings):
Attr(QWebEngineSettings.WebGLEnabled),
'content.local_storage':
Attr(QWebEngineSettings.LocalStorageEnabled),
'content.desktop_capture':
Attr(QWebEngineSettings.ScreenCaptureEnabled,
converter=lambda val: True if val == 'ask' else val),
# 'ask' is handled via the permission system, or a hardcoded
# dialog on Qt < 5.10
'input.spatial_navigation':
Attr(QWebEngineSettings.SpatialNavigationEnabled),

View File

@ -699,6 +699,23 @@ class _WebEnginePermissions(QObject):
QWebEnginePage.MediaVideoCapture: 'record video',
QWebEnginePage.MediaAudioVideoCapture: 'record audio/video',
}
try:
options.update({
QWebEnginePage.DesktopVideoCapture:
'content.desktop_capture',
QWebEnginePage.DesktopAudioVideoCapture:
'content.desktop_capture',
})
messages.update({
QWebEnginePage.DesktopVideoCapture:
'capture your desktop',
QWebEnginePage.DesktopAudioVideoCapture:
'capture your desktop and audio',
})
except AttributeError:
# Added in Qt 5.10
pass
assert options.keys() == messages.keys()
page = self._widget.page()

View File

@ -305,6 +305,15 @@ content.windowed_fullscreen:
desc: >-
Limit fullscreen to the browser window (does not expand to fill the screen).
content.desktop_capture:
type: BoolAsk
default: ask
desc: >-
Allow websites to share screen content.
On Qt < 5.10, a dialog box is always displayed, even if this is set to
"true".
content.developer_extras:
deleted: true