summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_context.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2018-06-07 16:37:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-02 20:52:46 +0000
commit5d79af42e1e442ef67b3f1c87ae75d60a22ef9fc (patch)
treeddafad6255d4766b669c200b1ab3d60d11623efe /src/core/web_engine_context.cpp
parent36cb71a4808456b6851c3fc7ddb2aa57bf286117 (diff)
Add QWebEngineUrlScheme class
Public API for the new url/url_util_qt extension to Chromium, which allows to integrate custom schemes into Chromium's url parsing library and security model. Previously custom schemes would be treated as 'unknown' schemes and rely on fallback behavior in Chromium. [ChangeLog][Custom Schemes] Added the QWebEngineUrlScheme class for configuring how custom schemes are parsed and which security restrictions should apply. Task-number: QTBUG-62536 Change-Id: I7d8b9da3ad742f568b82ccc6a2456ad35e84069b Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/web_engine_context.cpp')
-rw-r--r--src/core/web_engine_context.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 23302e8d2..c691e0c6e 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -83,6 +83,7 @@
#include "content/public/app/sandbox_helper_win.h"
#endif // OS_WIN
+#include "api/qwebengineurlscheme.h"
#include "profile_adapter.h"
#include "content_browser_client_qt.h"
#include "content_client_qt.h"
@@ -322,6 +323,12 @@ WebEngineContext::WebEngineContext()
qputenv("force_s3tc_enable", "true");
#endif
+ QWebEngineUrlScheme qrcScheme(QByteArrayLiteral("qrc"));
+ qrcScheme.setFlags(QWebEngineUrlScheme::Secure
+ | QWebEngineUrlScheme::LocalAccessAllowed
+ | QWebEngineUrlScheme::ViewSourceAllowed);
+ QWebEngineUrlScheme::addScheme(qrcScheme);
+
// Allow us to inject javascript like any webview toolkit.
content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView();