Add new methods to QuicFramer for controlling decrypters

This CL is a roll forward of cl/243273832. David had to make test-only changes to fix the broken test //third_party/quic/core:tls_handshaker_test. And the chromium patch is ready.

gfe-relnote: Protected behind QUIC_VERSION_99 and quic_supports_tls_handshake
PiperOrigin-RevId: 243344023
Change-Id: Ia845325b55557d4d8811d6641ae5b50bdf2aed45
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 8546076..307104d 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -388,8 +388,7 @@
   }
   QUIC_DLOG(INFO) << ENDPOINT
                   << "Created connection with connection_id: " << connection_id
-                  << " and version: "
-                  << QuicVersionToString(transport_version());
+                  << " and version: " << ParsedQuicVersionToString(version());
 
   QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(connection_id,
                                                         transport_version()))
@@ -2884,6 +2883,20 @@
   }
 }
 
+void QuicConnection::InstallDecrypter(
+    EncryptionLevel level,
+    std::unique_ptr<QuicDecrypter> decrypter) {
+  framer_.InstallDecrypter(level, std::move(decrypter));
+  if (!undecryptable_packets_.empty() &&
+      !process_undecryptable_packets_alarm_->IsSet()) {
+    process_undecryptable_packets_alarm_->Set(clock_->ApproximateNow());
+  }
+}
+
+void QuicConnection::RemoveDecrypter(EncryptionLevel level) {
+  framer_.RemoveDecrypter(level);
+}
+
 const QuicDecrypter* QuicConnection::decrypter() const {
   return framer_.decrypter();
 }
@@ -3907,6 +3920,13 @@
   return packet_generator_.GetGuaranteedLargestMessagePayload();
 }
 
+uint32_t QuicConnection::cipher_id() const {
+  if (version().KnowsWhichDecrypterToUse()) {
+    return framer_.GetDecrypter(last_decrypted_packet_level_)->cipher_id();
+  }
+  return framer_.decrypter()->cipher_id();
+}
+
 bool QuicConnection::ShouldSetAckAlarm() const {
   DCHECK(ack_frame_updated());
   if (ack_alarm_->IsSet()) {