summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/api/qwebenginecookiestore.cpp2
-rw-r--r--src/core/api/qwebenginecookiestore_p.h2
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp4
-rw-r--r--src/core/net/cookie_monster_delegate_qt.h4
-rw-r--r--src/core/net/network_delegate_qt.cpp6
-rw-r--r--src/core/profile_io_data_qt.cpp19
-rw-r--r--src/core/profile_io_data_qt.h4
7 files changed, 31 insertions, 10 deletions
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 21610e334..abb39f074 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -190,7 +190,7 @@ void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie,
Q_EMIT q_ptr->cookieAdded(cookie);
}
-bool QWebEngineCookieStorePrivate::canAccessCookies(const QUrl &firstPartyUrl, const QUrl &url)
+bool QWebEngineCookieStorePrivate::canAccessCookies(const QUrl &firstPartyUrl, const QUrl &url) const
{
if (!filterCallback)
return true;
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index c7ab429d8..93198d8ed 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -97,7 +97,7 @@ public:
void deleteAllCookies();
void getAllCookies();
- bool canAccessCookies(const QUrl &firstPartyUrl, const QUrl &url);
+ bool canAccessCookies(const QUrl &firstPartyUrl, const QUrl &url) const;
void onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList);
void onSetCallbackResult(qint64 callbackId, bool success);
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index 88e200287..bb89e9e5f 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -209,7 +209,7 @@ void CookieMonsterDelegateQt::setClient(QWebEngineCookieStore *client)
m_client->d_func()->processPendingUserCookies();
}
-bool CookieMonsterDelegateQt::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &/*cookieLine*/, const QUrl &url)
+bool CookieMonsterDelegateQt::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &/*cookieLine*/, const QUrl &url) const
{
if (!m_client)
return true;
@@ -217,7 +217,7 @@ bool CookieMonsterDelegateQt::canSetCookie(const QUrl &firstPartyUrl, const QByt
return m_client->d_func()->canAccessCookies(firstPartyUrl, url);
}
-bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUrl &url)
+bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUrl &url) const
{
if (!m_client)
return true;
diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h
index 6b2b1f417..7933ba329 100644
--- a/src/core/net/cookie_monster_delegate_qt.h
+++ b/src/core/net/cookie_monster_delegate_qt.h
@@ -94,8 +94,8 @@ public:
void setCookieMonster(net::CookieMonster* monster);
void setClient(QWebEngineCookieStore *client);
- bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url);
- bool canGetCookies(const QUrl &firstPartyUrl, const QUrl &url);
+ bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) const;
+ bool canGetCookies(const QUrl &firstPartyUrl, const QUrl &url) const;
void AddStore(net::CookieStore *store);
void OnCookieChanged(const net::CanonicalCookie &cookie, net::CookieChangeCause cause);
diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp
index 580f202e5..81c1d9efa 100644
--- a/src/core/net/network_delegate_qt.cpp
+++ b/src/core/net/network_delegate_qt.cpp
@@ -224,7 +224,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C
const QUrl qUrl = toQt(request->url());
- QWebEngineUrlRequestInterceptor* interceptor = m_profileIOData->m_requestInterceptor;
+ QWebEngineUrlRequestInterceptor* interceptor = m_profileIOData->requestInterceptor();
if (interceptor) {
QWebEngineUrlRequestInfoPrivate *infoPrivate = new QWebEngineUrlRequestInfoPrivate(toQt(resourceType),
toQt(navigationType),
@@ -299,13 +299,13 @@ bool NetworkDelegateQt::OnCanEnablePrivacyMode(const GURL &url, const GURL &site
bool NetworkDelegateQt::canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const
{
Q_ASSERT(m_profileIOData);
- return m_profileIOData->m_cookieDelegate->canSetCookie(toQt(first_party), QByteArray::fromStdString(cookie_line), toQt(url));
+ return m_profileIOData->canSetCookie(toQt(first_party), QByteArray::fromStdString(cookie_line), toQt(url));
}
bool NetworkDelegateQt::canGetCookies(const GURL &first_party, const GURL &url) const
{
Q_ASSERT(m_profileIOData);
- return m_profileIOData->m_cookieDelegate->canGetCookies(toQt(first_party), toQt(url));
+ return m_profileIOData->canGetCookies(toQt(first_party), toQt(url));
}
int NetworkDelegateQt::OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionCallback &callback, net::HttpRequestHeaders *headers)
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 547527e1f..0bc28ba46 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -666,4 +666,23 @@ void ProfileIODataQt::updateRequestInterceptor()
m_requestInterceptor = m_profileAdapter->requestInterceptor();
// We in this case do not need to regenerate any Chromium classes.
}
+
+QWebEngineUrlRequestInterceptor *ProfileIODataQt::requestInterceptor()
+{
+ // used in NetworkDelegateQt::OnBeforeURLRequest
+ Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ QMutexLocker lock(&m_mutex);
+ return m_requestInterceptor;
+}
+
+bool ProfileIODataQt::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) const
+{
+ return m_cookieDelegate->canSetCookie(firstPartyUrl,cookieLine, url);
+}
+
+bool ProfileIODataQt::canGetCookies(const QUrl &firstPartyUrl, const QUrl &url) const
+{
+ return m_cookieDelegate->canGetCookies(firstPartyUrl, url);
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index db0ec0146..7c4dae14b 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -88,6 +88,9 @@ public:
void generateUserAgent();
void generateJobFactory();
void regenerateJobFactory();
+ QWebEngineUrlRequestInterceptor *requestInterceptor();
+ bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) const;
+ bool canGetCookies(const QUrl &firstPartyUrl, const QUrl &url) const;
void setRequestContextData(content::ProtocolHandlerMap *protocolHandlers,
content::URLRequestInterceptorScopedVector request_interceptors);
@@ -138,7 +141,6 @@ private:
bool m_updateUserAgent = false;
bool m_ignoreCertificateErrors = false;
base::WeakPtrFactory<ProfileIODataQt> m_weakPtrFactory; // this should be always the last member
- friend class NetworkDelegateQt;
DISALLOW_COPY_AND_ASSIGN(ProfileIODataQt);
};
} // namespace QtWebEngineCore