summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/qwebenginenotification.cpp83
-rw-r--r--src/core/certificate_error_controller.cpp6
-rw-r--r--src/core/certificate_error_controller_p.h4
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/core_common.pri3
-rw-r--r--src/core/file_picker_controller.cpp51
-rw-r--r--src/core/profile_io_data_qt.cpp7
-rw-r--r--src/core/profile_io_data_qt.h2
-rw-r--r--src/core/render_widget_host_view_qt.cpp9
-rw-r--r--src/core/touch_selection_controller_client_qt.cpp2
-rw-r--r--src/core/web_event_factory.cpp4
11 files changed, 131 insertions, 42 deletions
diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp
index f91eabd25..abc63fed2 100644
--- a/src/core/api/qwebenginenotification.cpp
+++ b/src/core/api/qwebenginenotification.cpp
@@ -48,6 +48,22 @@ QT_BEGIN_NAMESPACE
using QtWebEngineCore::UserNotificationController;
/*!
+ \qmltype WebEngineNotification
+ \instantiates QWebEngineNotification
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.9
+ \brief Encapsulates the data of an HTML5 web notification.
+
+ This type contains the information and API for HTML5 desktop and push notifications.
+
+ Web engine notifications are passed to the user in the
+ \l WebEngineProfile::presentNotification() signal.
+
+ For more information about how to handle web notification, see the
+ \l{WebEngine Notifications Example}{Notification Example}.
+*/
+
+/*!
\class QWebEngineNotification
\brief The QWebEngineNotification class encapsulates the data of an HTML5 web notification.
\since 5.13
@@ -56,10 +72,11 @@ using QtWebEngineCore::UserNotificationController;
This class contains the information and API for HTML5 desktop and push notifications.
- Web engine notifications are passed to the user in the
- \l QWebEngineProfile::setNotificationPresenter() and
- \l QQuickWebEngineProfile::presentNotification() calls and the
- \l WebEngineProfile::presentNotification() signal.
+ Web engine notifications are passed to the user through the custom handler
+ provided with the \l QWebEngineProfile::setNotificationPresenter() call.
+
+ For more information about how to handle web notification, see the
+ \l{WebEngine Notifications Example}{Notification Example}.
*/
class QWebEngineNotificationPrivate : public UserNotificationController::Client {
@@ -115,6 +132,10 @@ bool QWebEngineNotification::matches(const QWebEngineNotification *other) const
}
/*!
+ \qmlproperty bool WebEngineNotification::title
+ \brief The title of the notification.
+*/
+/*!
\property QWebEngineNotification::title
\brief The title of the notification.
\sa message()
@@ -126,6 +147,10 @@ QString QWebEngineNotification::title() const
}
/*!
+ \qmlproperty string WebEngineNotification::message
+ \brief The body of the notification message.
+*/
+/*!
\property QWebEngineNotification::message
\brief The body of the notification message.
\sa title()
@@ -138,6 +163,13 @@ QString QWebEngineNotification::message() const
}
/*!
+ \qmlproperty string WebEngineNotification::tag
+ \brief The tag of the notification message.
+
+ New notifications that have the same tag and origin URL as an existing
+ one should replace or update the old notification with the same tag.
+*/
+/*!
\property QWebEngineNotification::tag
\brief The tag of the notification message.
@@ -153,6 +185,10 @@ QString QWebEngineNotification::tag() const
}
/*!
+ \qmlproperty url WebEngineNotification::origin
+ \brief The URL of the page sending the notification.
+*/
+/*!
\property QWebEngineNotification::origin
\brief The URL of the page sending the notification.
*/
@@ -175,6 +211,12 @@ QImage QWebEngineNotification::icon() const
}
/*!
+ \qmlproperty string WebEngineNotification::language
+ \brief The primary language for the notification's title and body.
+
+ Its value is a valid BCP 47 language tag, or the empty string.
+*/
+/*!
\property QWebEngineNotification::language
\brief The primary language for the notification's title and body.
@@ -189,6 +231,14 @@ QString QWebEngineNotification::language() const
}
/*!
+ \qmlproperty enumeration WebEngineNotification::direction
+ \brief The text direction for the notification's title and body.
+
+ \value Qt.LeftToRight Items are laid out from left to right.
+ \value Qt.RightToLeft Items are laid out from right to left.
+ \value Qt.LayoutDirectionAuto The direction to lay out items is determined automatically.
+*/
+/*!
\property QWebEngineNotification::direction
\brief The text direction for the notification's title and body.
\sa title(), message()
@@ -200,6 +250,12 @@ Qt::LayoutDirection QWebEngineNotification::direction() const
}
/*!
+ \qmlmethod void WebEngineNotification::show()
+ Creates and dispatches a JavaScript \e {show event} on notification.
+
+ Should be called by the notification platform when the notification has been shown to user.
+*/
+/*!
Creates and dispatches a JavaScript \e {show event} on notification.
Should be called by the notification platform when the notification has been shown to user.
@@ -212,6 +268,12 @@ void QWebEngineNotification::show() const
}
/*!
+ \qmlmethod void WebEngineNotification::click()
+ Creates and dispatches a JavaScript \e {click event} on notification.
+
+ Should be called by the notification platform when the notification is activated by the user.
+*/
+/*!
Creates and dispatches a JavaScript \e {click event} on notification.
Should be called by the notification platform when the notification is activated by the user.
@@ -224,6 +286,13 @@ void QWebEngineNotification::click() const
}
/*!
+ \qmlmethod void WebEngineNotification::close()
+ Creates and dispatches a JavaScript \e {close event} on notification.
+
+ Should be called by the notification platform when the notification is closed,
+ either by the underlying platform or by the user.
+*/
+/*!
Creates and dispatches a JavaScript \e {close event} on notification.
Should be called by the notification platform when the notification is closed,
@@ -237,6 +306,12 @@ void QWebEngineNotification::close() const
}
/*!
+ \qmlsignal WebEngineNotification::closed()
+
+ This signal is emitted when the web page calls close steps for the notification,
+ and it no longer needs to be shown.
+*/
+/*!
\fn void QWebEngineNotification::closed()
This signal is emitted when the web page calls close steps for the notification,
diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp
index 71465a1af..89c2980e3 100644
--- a/src/core/certificate_error_controller.cpp
+++ b/src/core/certificate_error_controller.cpp
@@ -79,14 +79,14 @@ CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_er
const net::SSLInfo& ssl_info,
const GURL &request_url,
content::ResourceType resource_type,
- bool _overridable,
+ bool fatal_error,
bool strict_enforcement,
const base::Callback<void(content::CertificateRequestResultType)>& cb
)
: certError(CertificateErrorController::CertificateError(cert_error))
, requestUrl(toQt(request_url))
, resourceType(CertificateErrorController::ResourceType(resource_type))
- , overridable(_overridable)
+ , fatalError(fatal_error)
, strictEnforcement(strict_enforcement)
, callback(cb)
{
@@ -119,7 +119,7 @@ QUrl CertificateErrorController::url() const
bool CertificateErrorController::overridable() const
{
- return d->overridable;
+ return !d->fatalError && !d->strictEnforcement;
}
bool CertificateErrorController::strictEnforcement() const
diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h
index f3b0c23fa..d51a559d0 100644
--- a/src/core/certificate_error_controller_p.h
+++ b/src/core/certificate_error_controller_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class CertificateErrorControllerPrivate {
public:
- CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, content::ResourceType resource_type, bool overridable, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& callback);
+ CertificateErrorControllerPrivate(int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, content::ResourceType resource_type, bool fatal_error, bool strict_enforcement, const base::Callback<void(content::CertificateRequestResultType)>& callback);
void accept(bool accepted);
@@ -68,7 +68,7 @@ public:
QDateTime validStart;
QDateTime validExpiry;
CertificateErrorController::ResourceType resourceType;
- bool overridable;
+ bool fatalError;
bool strictEnforcement;
const base::Callback<void(content::CertificateRequestResultType)> callback;
QList<QSslCertificate> chain;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index ee420d258..5816749c8 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -393,7 +393,7 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont
ssl_info,
request_url,
resource_type,
- !IsCertErrorFatal(cert_error),
+ IsCertErrorFatal(cert_error),
strict_enforcement,
callback)));
contentsDelegate->allowCertificateError(errorController);
diff --git a/src/core/core_common.pri b/src/core/core_common.pri
index 2a9dc90c0..e10d14267 100644
--- a/src/core/core_common.pri
+++ b/src/core/core_common.pri
@@ -18,6 +18,3 @@ CONFIG -= ltcg
# Chromium requires C++14
CONFIG += c++14
-#QTBUG-73216 ci has to be updated with latest yocto
-boot2qt: CONFIG -= use_gold_linker
-
diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp
index 3e64afd20..63b93c502 100644
--- a/src/core/file_picker_controller.cpp
+++ b/src/core/file_picker_controller.cpp
@@ -39,6 +39,9 @@
#include "file_picker_controller.h"
#include "type_conversion.h"
+#if defined(OS_WIN)
+#include "base/files/file_path.h"
+#endif
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/file_select_listener.h"
@@ -64,12 +67,31 @@ FilePickerController::~FilePickerController() = default;
void FilePickerController::accepted(const QStringList &files)
{
QStringList stringList;
-
- for (const QString &file : files) {
- if (QDir(file).isAbsolute())
- stringList.append(file);
- else
- qWarning("Ignore invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(file));
+ stringList.reserve(files.count());
+
+ for (const QString &urlString : files) {
+ // We accept strings on both absolute-path and file-URL form:
+ if (QDir::isAbsolutePath(urlString)) {
+ QString absolutePath = QDir::fromNativeSeparators(urlString);
+#if defined(OS_WIN)
+ if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1()))
+ qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
+ else
+#endif
+ stringList.append(absolutePath);
+ } else {
+ QUrl url(urlString, QUrl::StrictMode);
+ if (url.isLocalFile() && QDir::isAbsolutePath(url.toLocalFile())) {
+ QString absolutePath = url.toLocalFile();
+#if defined(OS_WIN)
+ if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1()))
+ qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
+ else
+#endif
+ stringList.append(absolutePath);
+ } else
+ qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
+ }
}
FilePickerController::filesSelectedInChooser(stringList);
@@ -77,21 +99,10 @@ void FilePickerController::accepted(const QStringList &files)
void FilePickerController::accepted(const QVariant &files)
{
- QStringList stringList;
- QList<QUrl> urlList = QUrl::fromStringList(files.toStringList());
-
- if (urlList.isEmpty()) {
- FilePickerController::accepted(stringList);
- } else {
- for (const QUrl &url : qAsConst(urlList)) {
- if (url.isValid() && url.scheme() == "file" && !url.path().isEmpty())
- stringList.append(url.path());
- else
- qWarning("Ignore invalid item in FilePickerController::accepted(QVariant): %s", qPrintable(url.toString()));
- }
+ if (!files.canConvert(QVariant::StringList))
+ qWarning("An unhandled type '%s' was provided in FilePickerController::accepted(QVariant)", files.typeName());
- FilePickerController::accepted(stringList);
- }
+ accepted(files.toStringList());
}
void FilePickerController::rejected()
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 38fe56f7d..5c87d87a2 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -239,9 +239,11 @@ extensions::ExtensionSystemQt* ProfileIODataQt::GetExtensionSystem()
void ProfileIODataQt::initializeOnIOThread()
{
m_networkDelegate.reset(new NetworkDelegateQt(this));
+ m_hostResolver = net::HostResolver::CreateStandaloneResolver(nullptr);
m_urlRequestContext.reset(new net::URLRequestContext());
m_urlRequestContext->set_network_delegate(m_networkDelegate.get());
m_urlRequestContext->set_enable_brotli(base::FeatureList::IsEnabled(features::kBrotliEncoding));
+ m_urlRequestContext->set_host_resolver(m_hostResolver.get());
// this binds factory to io thread
m_weakPtr = m_weakPtrFactory.GetWeakPtr();
const std::lock_guard<QRecursiveMutex> lock(m_mutex);
@@ -338,11 +340,6 @@ void ProfileIODataQt::generateStorage()
ct_verifier->AddLogs(ct_logs);
m_storage->set_cert_transparency_verifier(std::move(ct_verifier));
m_storage->set_ct_policy_enforcer(base::WrapUnique(new net::DefaultCTPolicyEnforcer()));
-// static std::unique_ptr<net::HostResolverManager> s_hostResolverManager =
-// std::make_unique<net::HostResolverManager>(net::HostResolver::Options(), nullptr);
-// m_storage->set_host_resolver(net::HostResolver::CreateResolver(s_hostResolverManager.get()));
- m_storage->set_host_resolver(net::HostResolver::CreateStandaloneResolver(nullptr));
-
m_storage->set_ssl_config_service(std::make_unique<net::SSLConfigServiceDefaults>());
if (!m_httpAuthPreferences) {
m_httpAuthPreferences.reset(new net::HttpAuthPreferences());
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index 4a5b9f77d..00a4de2b0 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -56,6 +56,7 @@ class ClientCertStore;
class DhcpPacFileFetcherFactory;
class HttpAuthPreferences;
class HttpNetworkSession;
+class HostResolver;
class NetworkDelegate;
class ProxyConfigService;
class URLRequestContext;
@@ -157,6 +158,7 @@ private:
std::unique_ptr<net::HttpAuthPreferences> m_httpAuthPreferences;
std::unique_ptr<net::URLRequestJobFactory> m_jobFactory;
std::unique_ptr<net::TransportSecurityPersister> m_transportSecurityPersister;
+ std::unique_ptr<net::HostResolver> m_hostResolver;
base::WeakPtr<ProfileIODataQt> m_weakPtr;
scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate;
content::URLRequestInterceptorScopedVector m_requestInterceptors;
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index e741962fb..c98612192 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -770,8 +770,11 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana
}
ui::TextInputType type = getTextInputType();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu);
-
+#else
+ m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText);
+#endif
m_surroundingText = toQt(state->value);
// Remove IME composition text from the surrounding text
if (state->composition_start != -1 && state->composition_end != -1)
@@ -1200,7 +1203,11 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query)
// TODO: Implement this
return QVariant(); // No limit.
case Qt::ImHints:
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu);
+#else
+ return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText);
+#endif
default:
return QVariant();
}
diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp
index da3c78b8a..0f44210d1 100644
--- a/src/core/touch_selection_controller_client_qt.cpp
+++ b/src/core/touch_selection_controller_client_qt.cpp
@@ -315,7 +315,7 @@ void TouchSelectionControllerClientQt::showMenu()
WebContentsAdapterClient *adapterClient = m_rwhv->adapterClient();
Q_ASSERT(adapterClient);
- adapterClient->showTouchSelectionMenu(m_menuController.get(),
+ adapterClient->showTouchSelectionMenu(m_menuController.data(),
QRect(toQt(gfx::ToEnclosingRect(anchor_rect))),
QSize(toQt(gfx::ToRoundedSize(max_handle_size))));
m_menuShowing = true;
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 7f5306e67..3598c1c78 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -926,7 +926,7 @@ static ui::DomKey domKeyForQtKey(int qtKey)
return ui::DomKey::ZENKAKU;
case Qt::Key_Zenkaku_Hankaku:
return ui::DomKey::ZENKAKU_HANKAKU;
-
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
// Dead keys (ui/events/keycodes/keyboard_code_conversion_xkb.cc)
case Qt::Key_Dead_Grave:
return ui::DomKey::DeadKeyFromCombiningCharacter(0x0300);
@@ -994,7 +994,7 @@ static ui::DomKey domKeyForQtKey(int qtKey)
return ui::DomKey::DeadKeyFromCombiningCharacter(0x00A4);
case Qt::Key_Dead_Greek:
return ui::DomKey::DeadKeyFromCombiningCharacter(0x037E);
-
+#endif
// General-Purpose Function Keys
case Qt::Key_F1:
return ui::DomKey::F1;