diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 013e0672a..3479f7301 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -116,6 +116,7 @@ |<>|Which cookies to accept. |<>|Store cookies. |<>|Default encoding to use for websites. +|<>|Allow websites to share screen content. |<>|Try to pre-fetch DNS entries to speed up browsing. |<>|Expand each subframe to its contents. |<>|Allow websites to request geolocations. @@ -1551,6 +1552,21 @@ Type: <> 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: <> + +Valid values: + + * +true+ + * +false+ + * +ask+ + +Default: +pass:[ask]+ + [[content.dns_prefetch]] === content.dns_prefetch Try to pre-fetch DNS entries to speed up browsing. diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index 6f384d693..42e74b857 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -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), diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index db94d6a00..f0cf32793 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -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() diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 86b8c4a05..a137489fd 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -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