summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-09-01 13:10:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-19 07:42:58 +0000
commit757004ecf484289f576870b4f251c3e7551294c5 (patch)
tree3f45d9230b87239d16ca7584c07b54b068c11697 /src/core/content_browser_client_qt.cpp
parent71d6dc0c326523103dff867d7184e7bc7e49c71d (diff)
Reinstate cookie filter API
Expose API to block cookies for specific domains, or third party cookies in general. Task-number: QTBUG-62897 Change-Id: I7f0e3f346368a2ef2fbd77f3197ee2dea50d57ce Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index d0019e4f3..5689a4fb8 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -68,6 +68,7 @@
#include "device/geolocation/geolocation_provider.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
+#include "printing/features/features.h"
#include "net/ssl/client_cert_identity.h"
#include "services/service_manager/public/cpp/bind_source_info.h"
#include "services/service_manager/public/cpp/binder_registry.h"
@@ -93,7 +94,7 @@
#include "device/geolocation/location_provider.h"
#endif
#include "media_capture_devices_dispatcher.h"
-#include "printing/features/features.h"
+#include "network_delegate_qt.h"
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
#include "printing_message_filter_qt.h"
#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
@@ -660,6 +661,29 @@ bool ContentBrowserClientQt::CanCreateWindow(
return (settings && settings->getJavaScriptCanOpenWindowsAutomatically()) || user_gesture;
}
+bool ContentBrowserClientQt::AllowGetCookie(const GURL &url,
+ const GURL &first_party,
+ const net::CookieList & /*cookie_list*/,
+ content::ResourceContext *context,
+ int /*render_process_id*/,
+ int /*render_frame_id*/)
+{
+ NetworkDelegateQt *networkDelegate = static_cast<NetworkDelegateQt *>(context->GetRequestContext()->network_delegate());
+ return networkDelegate->canGetCookies(first_party, url);
+}
+
+bool ContentBrowserClientQt::AllowSetCookie(const GURL &url,
+ const GURL &first_party,
+ const std::string &cookie_line,
+ content::ResourceContext *context,
+ int /*render_process_id*/,
+ int /*render_frame_id*/,
+ const net::CookieOptions& /*options*/)
+{
+ NetworkDelegateQt *networkDelegate = static_cast<NetworkDelegateQt *>(context->GetRequestContext()->network_delegate());
+ return networkDelegate->canSetCookies(first_party, url, cookie_line);
+}
+
} // namespace QtWebEngineCore
DEFINE_WEB_CONTENTS_USER_DATA_KEY(QtWebEngineCore::ServiceDriver);