[chromecast] Allow launching app with WebRTC legacy TLS supports

Bug: internal b/179509871
Test: Manual test on device
Change-Id: I2befeee540c4b495418f105e3b8e6de567d877db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2686586
Reviewed-by: Luke Halliwell (slow) <[email protected]>
Commit-Queue: Peter Qiu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#852721}
diff --git a/chromecast/browser/cast_web_contents.h b/chromecast/browser/cast_web_contents.h
index b7fa8fb..437613d 100644
--- a/chromecast/browser/cast_web_contents.h
+++ b/chromecast/browser/cast_web_contents.h
@@ -233,6 +233,9 @@
     // activity hosted by this CastWebContents.
     // No filters implies no restrictions.
     base::Optional<std::vector<std::string>> url_filters = base::nullopt;
+    // Whether WebRTC peer connections are allowed to use legacy versions of the
+    // TLS/DTLS protocols.
+    bool webrtc_allow_legacy_tls_protocols = false;
 
     InitParams();
     InitParams(const InitParams& other);
diff --git a/chromecast/browser/cast_web_contents_impl.cc b/chromecast/browser/cast_web_contents_impl.cc
index 46052f0..046ef39 100644
--- a/chromecast/browser/cast_web_contents_impl.cc
+++ b/chromecast/browser/cast_web_contents_impl.cc
@@ -37,6 +37,7 @@
 #include "net/base/net_errors.h"
 #include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
+#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
 #include "third_party/blink/public/mojom/autoplay/autoplay.mojom.h"
 #include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
 #include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
@@ -161,6 +162,11 @@
       renderer_type_ == content::mojom::RendererType::MOJO_RENDERER) {
     renderer_type_ = content::mojom::RendererType::DEFAULT_RENDERER;
   }
+
+  if (init_params.webrtc_allow_legacy_tls_protocols) {
+    web_contents_->GetMutableRendererPrefs()
+        ->webrtc_allow_legacy_tls_protocols = true;
+  }
 }
 
 CastWebContentsImpl::~CastWebContentsImpl() {