diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-07-03 15:51:51 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-18 18:06:55 +0000 |
commit | 49c0ce8403e5caeb864f66553f122c68a7c975fb (patch) | |
tree | a3b4c1f89754c316fe1fb5cce4392dd05f1db4e7 /src/core/web_engine_settings.h | |
parent | 8365186b3fdc2f1eca7e015147688d23bfdf81e9 (diff) |
Add Setting to allow passing unknown URL schemes to QDesktopServices
A new enum UnknownUrlSchemePolicy was added to WebEngineSettings,
QWebEngineSettings and QQuickWebEngineSettings.
WebContentsDelegate now has a new attribute of that type, which can
be read and written through the public APIs
Q(Quick)WebEngineSettings::unknownUrlSchemeNavigationPolicy and
Q(Quick)WebEngineSettings::setUnknownUrlSchemeNavigationPolicy.
This way, one can control, whether URLs with unknown schemes are passed
to QDesktopServices. WebContentsAdapterClient::navigationRequested is
called on these requests, so this allows more fine-grained control
over the schemes and origins, that are allowed.
Task-number: QTBUG-58627
Change-Id: Ie81d9503456d63ea1ed5606483254acf437cd8f7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_engine_settings.h')
-rw-r--r-- | src/core/web_engine_settings.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index 639d314f3..d4c5e02a8 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -107,6 +107,14 @@ public: DefaultFixedFontSize }; + // Must match the values from the public API in qwebenginesettings.h. + enum UnknownUrlSchemePolicy { + InheritedUnknownUrlSchemePolicy = 0, + DisallowUnknownUrlSchemes = 1, + AllowUnknownUrlSchemesFromUserInteraction, + AllowAllUnknownUrlSchemes + }; + explicit WebEngineSettings(WebEngineSettings *parentSettings = 0); ~WebEngineSettings(); @@ -129,6 +137,9 @@ public: void setDefaultTextEncoding(const QString &encoding); QString defaultTextEncoding() const; + void setUnknownUrlSchemePolicy(UnknownUrlSchemePolicy policy); + UnknownUrlSchemePolicy unknownUrlSchemePolicy() const; + void initDefaults(); void scheduleApply(); @@ -155,6 +166,7 @@ private: static QHash<Attribute, bool> s_defaultAttributes; static QHash<FontFamily, QString> s_defaultFontFamilies; static QHash<FontSize, int> s_defaultFontSizes; + UnknownUrlSchemePolicy m_unknownUrlSchemePolicy; friend class BatchTimer; friend class WebContentsAdapter; |