From dc6c8d5c9fe61ba58d065564f4d6dc0571475004 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 6 Mar 2019 13:56:01 +0100 Subject: Fix -no-ssl build Change-Id: I978f70545484060218f5243c74978c85bc603c16 Reviewed-by: Allan Sandfeld Jensen --- src/core/profile_adapter.cpp | 4 ++++ src/core/profile_adapter.h | 4 ++++ src/core/profile_io_data_qt.cpp | 10 ++++++++++ src/core/profile_io_data_qt.h | 4 ++++ src/webengine/api/qquickwebengineprofile.cpp | 4 ++++ src/webenginewidgets/api/qwebengineprofile.cpp | 4 ++++ 6 files changed, 30 insertions(+) (limited to 'src') diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 7070292d6..6f05c4c3f 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -114,7 +114,9 @@ ProfileAdapter::~ProfileAdapter() m_profile->GetDownloadManager(m_profile.data())->Shutdown(); m_downloadManagerDelegate.reset(); } +#if QT_CONFIG(ssl) delete m_clientCertificateStore; +#endif Q_ASSERT(m_pageRequestInterceptors == 0); } @@ -668,11 +670,13 @@ bool ProfileAdapter::isUsedForGlobalCertificateVerification() const return m_usedForGlobalCertificateVerification; } +#if QT_CONFIG(ssl) QWebEngineClientCertificateStore *ProfileAdapter::clientCertificateStore() { if (!m_clientCertificateStore) m_clientCertificateStore = new QWebEngineClientCertificateStore(m_profile->m_profileIOData->clientCertificateStoreData()); return m_clientCertificateStore; } +#endif } // namespace QtWebEngineCore diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h index 1aff145b2..48094a3d8 100644 --- a/src/core/profile_adapter.h +++ b/src/core/profile_adapter.h @@ -205,7 +205,9 @@ public: void removePageRequestInterceptor(); bool hasPageRequestInterceptor() const { return m_pageRequestInterceptors > 0; } +#if QT_CONFIG(ssl) QWebEngineClientCertificateStore *clientCertificateStore(); +#endif QHash> &ephemeralNotifications() { return m_ephemeralNotifications; } @@ -225,7 +227,9 @@ private: QScopedPointer m_downloadManagerDelegate; QScopedPointer m_userResourceController; QScopedPointer m_cookieStore; +#if QT_CONFIG(ssl) QWebEngineClientCertificateStore *m_clientCertificateStore = nullptr; +#endif QPointer m_requestInterceptor; QString m_dataPath; diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index f1fe96f81..a73a7c21d 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -169,7 +169,9 @@ static net::HttpNetworkSession::Params generateNetworkSessionParams(bool ignoreC ProfileIODataQt::ProfileIODataQt(ProfileQt *profile) : m_profile(profile), +#if QT_CONFIG(ssl) m_clientCertificateStoreData(new ClientCertificateStoreData), +#endif m_mutex(QMutex::Recursive), m_weakPtrFactory(this) { @@ -209,8 +211,10 @@ QPointer ProfileIODataQt::profileAdapter() void ProfileIODataQt::shutdownOnUIThread() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); +#if QT_CONFIG(ssl) delete m_clientCertificateStoreData; m_clientCertificateStoreData = nullptr; +#endif bool posted = content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, this); if (!posted) { qWarning() << "Could not delete ProfileIODataQt on io thread !"; @@ -775,14 +779,20 @@ void ProfileIODataQt::updateUsedForGlobalCertificateVerification() base::BindOnce(&ProfileIODataQt::setGlobalCertificateVerification, m_weakPtr)); } +#if QT_CONFIG(ssl) ClientCertificateStoreData *ProfileIODataQt::clientCertificateStoreData() { return m_clientCertificateStoreData; } +#endif std::unique_ptr ProfileIODataQt::CreateClientCertStore() { +#if QT_CONFIG(ssl) return std::unique_ptr(new ClientCertOverrideStore(m_clientCertificateStoreData)); +#else + return nullptr; +#endif } // static diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index edb2fd3b5..57ddb6fd3 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -124,7 +124,9 @@ public: void updateUsedForGlobalCertificateVerification(); // runs on ui thread bool hasPageInterceptors(); +#if QT_CONFIG(ssl) ClientCertificateStoreData *clientCertificateStoreData(); +#endif std::unique_ptr CreateClientCertStore(); static ProfileIODataQt *FromResourceContext(content::ResourceContext *resource_context); private: @@ -148,7 +150,9 @@ private: QAtomicPointer m_proxyConfigService; QPointer m_profileAdapter; // never dereferenced in IO thread and it is passed by qpointer ProfileAdapter::PersistentCookiesPolicy m_persistentCookiesPolicy; +#if QT_CONFIG(ssl) ClientCertificateStoreData *m_clientCertificateStoreData; +#endif QString m_cookiesPath; QString m_channelIdPath; QString m_httpAcceptLanguage; diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 3c4ec0595..ac75b5356 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -1086,8 +1086,12 @@ QQmlListProperty QQuickWebEngineProfile::userScripts() */ QWebEngineClientCertificateStore *QQuickWebEngineProfile::clientCertificateStore() { +#if QT_CONFIG(ssl) Q_D(QQuickWebEngineProfile); return d->profileAdapter()->clientCertificateStore(); +#else + return nullptr; +#endif } QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 50de63e9a..d69ddb343 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -871,8 +871,12 @@ void QWebEngineProfile::clearHttpCache() */ QWebEngineClientCertificateStore *QWebEngineProfile::clientCertificateStore() { +#if QT_CONFIG(ssl) Q_D(QWebEngineProfile); return d->profileAdapter()->clientCertificateStore(); +#else + return nullptr; +#endif } QT_END_NAMESPACE -- cgit v1.2.3