summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-08-31 17:12:37 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-29 08:36:51 +0000
commit05574185dab53476294cf62f2067a4147aa0b6eb (patch)
treed5117bbae4b3a4417173d6c969640e79c130b587 /src/core/web_contents_adapter.cpp
parent5480a26d2f16dacfbce47da337559b5bcfb3d45e (diff)
Expose an option to hide internal IP addresses from WebRTC
Task-number: QTBUG-57505 Change-Id: I8d8f906311ce94b2d9df67cb4479b70c8961c3a6 Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index effd6e340..6576a9c3b 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -60,7 +60,8 @@
#include "web_engine_context.h"
#include "web_engine_settings.h"
-#include <base/run_loop.h>
+#include "base/command_line.h"
+#include "base/run_loop.h"
#include "base/values.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -80,6 +81,7 @@
#include "content/public/common/resource_request_body.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h"
+#include "content/public/common/webrtc_ip_handling_policy.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "printing/features/features.h"
#include "ui/base/clipboard/clipboard.h"
@@ -428,10 +430,14 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient)
rendererPrefs->caret_blink_interval = 0.5 * static_cast<double>(qtCursorFlashTime) / 1000;
rendererPrefs->user_agent_override = d->browserContextAdapter->httpUserAgent().toStdString();
rendererPrefs->accept_languages = d->browserContextAdapter->httpAcceptLanguageWithoutQualities().toStdString();
-#if defined(ENABLE_WEBRTC)
+#if BUILDFLAG(ENABLE_WEBRTC)
base::CommandLine* commandLine = base::CommandLine::ForCurrentProcess();
if (commandLine->HasSwitch(switches::kForceWebRtcIPHandlingPolicy))
rendererPrefs->webrtc_ip_handling_policy = commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy);
+ else
+ rendererPrefs->webrtc_ip_handling_policy = adapterClient->webEngineSettings()->testAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly)
+ ? content::kWebRTCIPHandlingDefaultPublicInterfaceOnly
+ : content::kWebRTCIPHandlingDefault;
#endif
// Set web-contents font settings to the default font settings as Chromium constantly overrides
// the global font defaults with the font settings of the latest web-contents created.