summaryrefslogtreecommitdiffstats
path: root/src/core/api/qtwebenginecoreglobal.cpp
diff options
context:
space:
mode:
authorBenjamin Terrier <b.terrier@gmail.com>2022-07-30 20:24:34 +0000
committerBenjamin Terrier <b.terrier@gmail.com>2023-05-02 12:42:23 +0200
commit000f31fb643bb8fb0b89b1ab26a895223c318996 (patch)
treedcfa174620071fa199486951080c85fd800d1363 /src/core/api/qtwebenginecoreglobal.cpp
parent17c64fd5d2778df4a52849e8942104d4d9555a1e (diff)
Add qWebEngineGetDomainAndRegistry()
[ChangeLog][WebEngineCore] Add qWebEngineGetDomainAndRegistry() Fixes: QTBUG-105294 Change-Id: Ica40453f807b00c8548f974a495ddf84bbe8e194 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/api/qtwebenginecoreglobal.cpp')
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index d8d3d3b26..9082052f2 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -17,6 +17,8 @@
#include <QQuickWindow>
#include "web_engine_context.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
+
#if QT_CONFIG(opengl)
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
@@ -218,4 +220,14 @@ static void initialize()
#endif // QT_CONFIG(opengl)
}
+QT_BEGIN_NAMESPACE
+
+QString qWebEngineGetDomainAndRegistry(const QUrl &url) {
+ const QString host = url.host();
+ const std::string domain = net::registry_controlled_domains::GetDomainAndRegistry(host.toStdString(), net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
+ return QString::fromStdString(domain);
+}
+
+QT_END_NAMESPACE
+
Q_CONSTRUCTOR_FUNCTION(initialize)