gfe-relnote: Deprecate gfe2_reloadable_flag_quic_use_handshaker_delegate2.

PiperOrigin-RevId: 292927832
Change-Id: I2f73ae99e55284c911007609fa989b7e82fb4596
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index c446160..dd73b93 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -704,11 +704,6 @@
   return static_cast<QuicSpdyStream*>(stream);
 }
 
-void QuicSpdySession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
-  QuicSession::OnCryptoHandshakeEvent(event);
-  SendInitialData();
-}
-
 void QuicSpdySession::SetDefaultEncryptionLevel(quic::EncryptionLevel level) {
   QuicSession::SetDefaultEncryptionLevel(level);
   SendInitialData();
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index 71a5c61..c9bfb27 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -322,7 +322,6 @@
       bool exclusive,
       QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener);
 
-  void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
   void SetDefaultEncryptionLevel(quic::EncryptionLevel level) override;
 
   bool supports_push_promise() { return supports_push_promise_; }
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index b813d43..6ce22a9 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -103,14 +103,8 @@
     }
     EXPECT_THAT(error, IsQuicNoError());
     session()->OnConfigNegotiated();
-    if (session()->use_handshake_delegate()) {
-      session()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-      session()->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
-    } else {
-      session()->connection()->SetDefaultEncryptionLevel(
-          ENCRYPTION_FORWARD_SECURE);
-      session()->OnCryptoHandshakeEvent(QuicSession::EVENT_HANDSHAKE_CONFIRMED);
-    }
+    session()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+    session()->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
   }
 
   // QuicCryptoStream implementation
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 9f7e894..dd08b20 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -223,8 +223,7 @@
         session_->config(), kMinimumFlowControlSendWindow);
     QuicConfigPeer::SetReceivedMaxUnidirectionalStreams(session_->config(), 10);
     session_->OnConfigNegotiated();
-    if (!session_->use_handshake_delegate() ||
-        session_->perspective() == Perspective::IS_CLIENT) {
+    if (session_->perspective() == Perspective::IS_CLIENT) {
       EXPECT_CALL(*connection_, OnCanWrite());
     }
     if (UsesHttp3()) {
@@ -248,13 +247,8 @@
       EXPECT_CALL(*session_, WritevData(qpack_encoder_stream,
                                         qpack_encoder_stream->id(), 1, 0, _));
     }
-    if (session_->use_handshake_delegate()) {
-      static_cast<QuicSession*>(session_.get())
-          ->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
-    } else {
-      static_cast<QuicSession*>(session_.get())
-          ->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_ESTABLISHED);
-    }
+    static_cast<QuicSession*>(session_.get())
+        ->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
   }
 
   QuicHeaderList ProcessHeaders(bool fin, const SpdyHeaderBlock& headers) {
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 9ad0190..30dd1d7 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -333,9 +333,6 @@
       bytes_received_before_address_validation_(0),
       bytes_sent_before_address_validation_(0),
       address_validated_(false),
-      use_handshake_delegate_(
-          GetQuicReloadableFlag(quic_use_handshaker_delegate2) ||
-          version().handshake_protocol == PROTOCOL_TLS1_3),
       check_handshake_timeout_before_idle_timeout_(GetQuicReloadableFlag(
           quic_check_handshake_timeout_before_idle_timeout)),
       batch_writer_flush_after_mtu_probe_(
@@ -351,10 +348,6 @@
       << "QuicConnection: attempted to use server connection ID "
       << server_connection_id << " which is invalid with version "
       << QuicVersionToString(transport_version());
-  if (use_handshake_delegate_) {
-    QUIC_RELOADABLE_FLAG_COUNT(quic_use_handshaker_delegate2);
-  }
-
   if (check_handshake_timeout_before_idle_timeout_) {
     QUIC_RELOADABLE_FLAG_COUNT(
         quic_check_handshake_timeout_before_idle_timeout);
@@ -813,17 +806,7 @@
     address_validated_ = true;
   }
 
-  if (use_handshake_delegate_) {
-    visitor_->OnPacketDecrypted(level);
-    return;
-  }
-
-  // Once the server receives a forward secure packet, the handshake is
-  // confirmed.
-  if (level == ENCRYPTION_FORWARD_SECURE &&
-      perspective_ == Perspective::IS_SERVER) {
-    OnHandshakeComplete();
-  }
+  visitor_->OnPacketDecrypted(level);
 }
 
 QuicSocketAddress QuicConnection::GetEffectivePeerAddressFromCurrentPacket()
@@ -4079,8 +4062,7 @@
 }
 
 bool QuicConnection::IsHandshakeComplete() const {
-  if (use_handshake_delegate_ &&
-      GetQuicReloadableFlag(quic_use_get_handshake_state)) {
+  if (GetQuicReloadableFlag(quic_use_get_handshake_state)) {
     QUIC_RELOADABLE_FLAG_COUNT(quic_use_get_handshake_state);
     return visitor_->GetHandshakeState() >= HANDSHAKE_COMPLETE;
   }
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 6a4d007..56d88a3 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -907,8 +907,6 @@
   // Called when version is considered negotiated.
   void OnSuccessfulVersionNegotiation();
 
-  bool use_handshake_delegate() const { return use_handshake_delegate_; }
-
  protected:
   // Calls cancel() on all the alarms owned by this connection.
   void CancelAllAlarms();
@@ -1515,9 +1513,6 @@
 
   QuicConnectionMtuDiscoverer mtu_discoverer_;
 
-  // Latched value of quic_use_handshaker_delegate2.
-  const bool use_handshake_delegate_;
-
   // Latched value of quic_check_handshake_timeout_before_idle_timeout.
   const bool check_handshake_timeout_before_idle_timeout_;
 
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 8f02bbb..91d7a9d 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -8015,8 +8015,7 @@
   EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0);
   ASSERT_EQ(0u, connection_.GetStats().packets_sent);
   connection_.set_fill_up_link_during_probing(true);
-  if (GetQuicReloadableFlag(quic_use_handshaker_delegate2) &&
-      GetQuicReloadableFlag(quic_use_get_handshake_state)) {
+  if (GetQuicReloadableFlag(quic_use_get_handshake_state)) {
     EXPECT_CALL(visitor_, GetHandshakeState())
         .WillRepeatedly(Return(HANDSHAKE_COMPLETE));
   }
diff --git a/quic/core/quic_crypto_client_handshaker.cc b/quic/core/quic_crypto_client_handshaker.cc
index 982d070..b815dfe 100644
--- a/quic/core/quic_crypto_client_handshaker.cc
+++ b/quic/core/quic_crypto_client_handshaker.cc
@@ -327,36 +327,14 @@
       crypto_config_->pad_full_hello());
   SendHandshakeMessage(out);
   // Be prepared to decrypt with the new server write key.
-  if (session()->use_handshake_delegate()) {
-    delegate_->OnNewKeysAvailable(
-        ENCRYPTION_ZERO_RTT,
-        std::move(crypto_negotiated_params_->initial_crypters.decrypter),
-        /*set_alternative_decrypter=*/true,
-        /*latch_once_used=*/true,
-        std::move(crypto_negotiated_params_->initial_crypters.encrypter));
-    encryption_established_ = true;
-    delegate_->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
-    return;
-  }
-  if (session()->connection()->version().KnowsWhichDecrypterToUse()) {
-    session()->connection()->InstallDecrypter(
-        ENCRYPTION_ZERO_RTT,
-        std::move(crypto_negotiated_params_->initial_crypters.decrypter));
-  } else {
-    session()->connection()->SetAlternativeDecrypter(
-        ENCRYPTION_ZERO_RTT,
-        std::move(crypto_negotiated_params_->initial_crypters.decrypter),
-        true /* latch once used */);
-  }
-  // Send subsequent packets under encryption on the assumption that the
-  // server will accept the handshake.
-  session()->connection()->SetEncrypter(
+  delegate_->OnNewKeysAvailable(
       ENCRYPTION_ZERO_RTT,
+      std::move(crypto_negotiated_params_->initial_crypters.decrypter),
+      /*set_alternative_decrypter=*/true,
+      /*latch_once_used=*/true,
       std::move(crypto_negotiated_params_->initial_crypters.encrypter));
-  session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
-
   encryption_established_ = true;
-  session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_ESTABLISHED);
+  delegate_->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
 }
 
 void QuicCryptoClientHandshaker::DoReceiveREJ(
@@ -397,11 +375,7 @@
 
   // Receipt of a REJ message means that the server received the CHLO
   // so we can cancel and retransmissions.
-  if (session()->use_handshake_delegate()) {
-    delegate_->NeuterUnencryptedData();
-  } else {
-    session()->NeuterUnencryptedData();
-  }
+  delegate_->NeuterUnencryptedData();
 
   std::string error_details;
   QuicErrorCode error = crypto_config_->ProcessRejection(
@@ -563,33 +537,14 @@
   // has been floated that the server shouldn't send packets encrypted
   // with the FORWARD_SECURE key until it receives a FORWARD_SECURE
   // packet from the client.
-  if (session()->use_handshake_delegate()) {
-    delegate_->OnNewKeysAvailable(
-        ENCRYPTION_FORWARD_SECURE, std::move(crypters->decrypter),
-        /*set_alternative_decrypter=*/true,
-        /*latch_once_used=*/false, std::move(crypters->encrypter));
-    one_rtt_keys_available_ = true;
-    delegate_->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-    delegate_->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
-    delegate_->NeuterHandshakeData();
-    return;
-  }
-
-  if (session()->connection()->version().KnowsWhichDecrypterToUse()) {
-    session()->connection()->InstallDecrypter(ENCRYPTION_FORWARD_SECURE,
-                                              std::move(crypters->decrypter));
-  } else {
-    session()->connection()->SetAlternativeDecrypter(
-        ENCRYPTION_FORWARD_SECURE, std::move(crypters->decrypter),
-        false /* don't latch */);
-  }
-  session()->connection()->SetEncrypter(ENCRYPTION_FORWARD_SECURE,
-                                        std::move(crypters->encrypter));
-  session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-
+  delegate_->OnNewKeysAvailable(
+      ENCRYPTION_FORWARD_SECURE, std::move(crypters->decrypter),
+      /*set_alternative_decrypter=*/true,
+      /*latch_once_used=*/false, std::move(crypters->encrypter));
   one_rtt_keys_available_ = true;
-  session()->OnCryptoHandshakeEvent(QuicSession::EVENT_HANDSHAKE_CONFIRMED);
-  session()->connection()->OnHandshakeComplete();
+  delegate_->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+  delegate_->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
+  delegate_->NeuterHandshakeData();
 }
 
 void QuicCryptoClientHandshaker::DoInitializeServerConfigUpdate(
diff --git a/quic/core/quic_crypto_server_handshaker.cc b/quic/core/quic_crypto_server_handshaker.cc
index d18537c..4b2a7fa 100644
--- a/quic/core/quic_crypto_server_handshaker.cc
+++ b/quic/core/quic_crypto_server_handshaker.cc
@@ -200,73 +200,29 @@
   // write key.
   //
   // NOTE: the SHLO will be encrypted with the new server write key.
-  if (session()->use_handshake_delegate()) {
-    delegate_->OnNewKeysAvailable(
-        ENCRYPTION_ZERO_RTT,
-        std::move(crypto_negotiated_params_->initial_crypters.decrypter),
-        /*set_alternative_decrypter=*/false,
-        /*latch_once_used=*/false,
-        std::move(crypto_negotiated_params_->initial_crypters.encrypter));
-    delegate_->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
-    delegate_->DiscardOldDecryptionKey(ENCRYPTION_INITIAL);
-  } else {
-    session()->connection()->SetEncrypter(
-        ENCRYPTION_ZERO_RTT,
-        std::move(crypto_negotiated_params_->initial_crypters.encrypter));
-    session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
-    // Set the decrypter immediately so that we no longer accept unencrypted
-    // packets.
-    if (session()->connection()->version().KnowsWhichDecrypterToUse()) {
-      session()->connection()->InstallDecrypter(
-          ENCRYPTION_ZERO_RTT,
-          std::move(crypto_negotiated_params_->initial_crypters.decrypter));
-      session()->connection()->RemoveDecrypter(ENCRYPTION_INITIAL);
-    } else {
-      session()->connection()->SetDecrypter(
-          ENCRYPTION_ZERO_RTT,
-          std::move(crypto_negotiated_params_->initial_crypters.decrypter));
-    }
-  }
+  delegate_->OnNewKeysAvailable(
+      ENCRYPTION_ZERO_RTT,
+      std::move(crypto_negotiated_params_->initial_crypters.decrypter),
+      /*set_alternative_decrypter=*/false,
+      /*latch_once_used=*/false,
+      std::move(crypto_negotiated_params_->initial_crypters.encrypter));
+  delegate_->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
+  delegate_->DiscardOldDecryptionKey(ENCRYPTION_INITIAL);
   session()->connection()->SetDiversificationNonce(*diversification_nonce);
 
   session()->connection()->set_fully_pad_crypto_handshake_packets(
       crypto_config_->pad_shlo());
   SendHandshakeMessage(*reply);
-  if (session()->use_handshake_delegate()) {
-    delegate_->OnNewKeysAvailable(
-        ENCRYPTION_FORWARD_SECURE,
-        std::move(crypto_negotiated_params_->forward_secure_crypters.decrypter),
-        /*set_alternative_decrypter=*/true,
-        /*latch_once_used=*/false,
-        std::move(
-            crypto_negotiated_params_->forward_secure_crypters.encrypter));
-    encryption_established_ = true;
-    one_rtt_keys_available_ = true;
-    delegate_->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-    delegate_->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
-    return;
-  }
-
-  session()->connection()->SetEncrypter(
+  delegate_->OnNewKeysAvailable(
       ENCRYPTION_FORWARD_SECURE,
+      std::move(crypto_negotiated_params_->forward_secure_crypters.decrypter),
+      /*set_alternative_decrypter=*/true,
+      /*latch_once_used=*/false,
       std::move(crypto_negotiated_params_->forward_secure_crypters.encrypter));
-  session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-
-  if (session()->connection()->version().KnowsWhichDecrypterToUse()) {
-    session()->connection()->InstallDecrypter(
-        ENCRYPTION_FORWARD_SECURE,
-        std::move(
-            crypto_negotiated_params_->forward_secure_crypters.decrypter));
-  } else {
-    session()->connection()->SetAlternativeDecrypter(
-        ENCRYPTION_FORWARD_SECURE,
-        std::move(crypto_negotiated_params_->forward_secure_crypters.decrypter),
-        false /* don't latch */);
-  }
-
   encryption_established_ = true;
   one_rtt_keys_available_ = true;
-  session()->OnCryptoHandshakeEvent(QuicSession::EVENT_HANDSHAKE_CONFIRMED);
+  delegate_->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+  delegate_->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
 }
 
 void QuicCryptoServerHandshaker::SendServerConfigUpdate(
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 600e3f3..d12d024 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -1264,36 +1264,11 @@
   flow_controller_.UpdateSendWindowOffset(new_window);
 }
 
-void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
-  DCHECK(!use_handshake_delegate());
-  switch (event) {
-    case ENCRYPTION_ESTABLISHED:
-      // Retransmit originally packets that were sent, since they can't be
-      // decrypted by the peer.
-      connection_->RetransmitUnackedPackets(ALL_INITIAL_RETRANSMISSION);
-      // Given any streams blocked by encryption a chance to write.
-      OnCanWrite();
-      break;
-
-    case EVENT_HANDSHAKE_CONFIRMED:
-      QUIC_BUG_IF(!config_.negotiated())
-          << ENDPOINT << "Handshake confirmed without parameter negotiation.";
-      // Discard originally encrypted packets, since they can't be decrypted by
-      // the peer.
-      NeuterUnencryptedData();
-      break;
-
-    default:
-      QUIC_LOG(ERROR) << ENDPOINT << "Got unknown handshake event: " << event;
-  }
-}
-
 void QuicSession::OnNewKeysAvailable(EncryptionLevel level,
                                      std::unique_ptr<QuicDecrypter> decrypter,
                                      bool set_alternative_decrypter,
                                      bool latch_once_used,
                                      std::unique_ptr<QuicEncrypter> encrypter) {
-  DCHECK(use_handshake_delegate());
   // Install new keys.
   connection()->SetEncrypter(level, std::move(encrypter));
   if (connection()->version().KnowsWhichDecrypterToUse()) {
@@ -1309,7 +1284,6 @@
 }
 
 void QuicSession::SetDefaultEncryptionLevel(EncryptionLevel level) {
-  DCHECK(use_handshake_delegate());
   QUIC_DVLOG(1) << ENDPOINT << "Set default encryption level to "
                 << EncryptionLevelToString(level);
   connection()->SetDefaultEncryptionLevel(level);
@@ -1350,7 +1324,6 @@
 }
 
 void QuicSession::DiscardOldDecryptionKey(EncryptionLevel level) {
-  DCHECK(use_handshake_delegate());
   if (!connection()->version().KnowsWhichDecrypterToUse()) {
     // TODO(fayang): actually discard keys.
     return;
@@ -1359,7 +1332,6 @@
 }
 
 void QuicSession::DiscardOldEncryptionKey(EncryptionLevel level) {
-  DCHECK(use_handshake_delegate());
   QUIC_DVLOG(1) << ENDPOINT << "Discard keys of "
                 << EncryptionLevelToString(level);
   // TODO(fayang): actually discard keys.
@@ -1382,7 +1354,6 @@
 }
 
 void QuicSession::NeuterHandshakeData() {
-  DCHECK(use_handshake_delegate());
   connection()->OnHandshakeComplete();
 }
 
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index f17eabc..a6501c2 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -76,18 +76,6 @@
     virtual void OnStopSendingReceived(const QuicStopSendingFrame& frame) = 0;
   };
 
-  // CryptoHandshakeEvent enumerates the events generated by a QuicCryptoStream.
-  // TODO(fayang): Replace this enum and with HandshakeState.
-  enum CryptoHandshakeEvent {
-    // ENCRYPTION_ESTABLISHED indicates that a client hello has been sent and
-    // subsequent packets will be encrypted. (Client only.)
-    ENCRYPTION_ESTABLISHED,
-    // EVENT_HANDSHAKE_CONFIRMED, in a client, indicates the server has accepted
-    // our handshake. In a server it indicates that a full, valid client hello
-    // has been received. (Client and server.)
-    EVENT_HANDSHAKE_CONFIRMED,
-  };
-
   // Does not take ownership of |connection| or |visitor|.
   QuicSession(QuicConnection* connection,
               Visitor* owner,
@@ -254,15 +242,6 @@
   // Called by the QuicCryptoStream when a new QuicConfig has been negotiated.
   virtual void OnConfigNegotiated();
 
-  // Called by the QuicCryptoStream when the handshake enters a new state.
-  //
-  // Clients will call this function in the order:
-  //   zero or more ENCRYPTION_ESTABLISHED
-  //   EVENT_HANDSHAKE_CONFIRMED
-  //
-  // Servers will simply call it once with EVENT_HANDSHAKE_CONFIRMED.
-  virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event);
-
   // From HandshakerDelegateInterface
   void OnNewKeysAvailable(EncryptionLevel level,
                           std::unique_ptr<QuicDecrypter> decrypter,
@@ -460,10 +439,6 @@
     return use_http2_priority_write_scheduler_;
   }
 
-  bool use_handshake_delegate() const {
-    return connection_->use_handshake_delegate();
-  }
-
   bool is_configured() const { return is_configured_; }
 
   QuicStreamCount num_expected_unidirectional_static_streams() const {
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index a287f55..5bfa76b 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -90,14 +90,8 @@
     }
     EXPECT_THAT(error, IsQuicNoError());
     session()->OnConfigNegotiated();
-    if (session()->use_handshake_delegate()) {
-      session()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-      session()->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
-    } else {
-      session()->connection()->SetDefaultEncryptionLevel(
-          ENCRYPTION_FORWARD_SECURE);
-      session()->OnCryptoHandshakeEvent(QuicSession::EVENT_HANDSHAKE_CONFIRMED);
-    }
+    session()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+    session()->DiscardOldEncryptionKey(ENCRYPTION_INITIAL);
   }
 
   // QuicCryptoStream implementation
diff --git a/quic/quartc/quartc_session.cc b/quic/quartc/quartc_session.cc
index 86e1f91..9efe659 100644
--- a/quic/quartc/quartc_session.cc
+++ b/quic/quartc/quartc_session.cc
@@ -155,27 +155,6 @@
   return true;
 }
 
-void QuartcSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
-  QuicSession::OnCryptoHandshakeEvent(event);
-  switch (event) {
-    case ENCRYPTION_ESTABLISHED:
-      DCHECK(IsEncryptionEstablished());
-      DCHECK(session_delegate_);
-      session_delegate_->OnConnectionWritable();
-      break;
-    case EVENT_HANDSHAKE_CONFIRMED:
-      // On the server, handshake confirmed is the first time when you can start
-      // writing packets.
-      DCHECK(IsEncryptionEstablished());
-      DCHECK(OneRttKeysAvailable());
-
-      DCHECK(session_delegate_);
-      session_delegate_->OnConnectionWritable();
-      session_delegate_->OnCryptoHandshakeComplete();
-      break;
-  }
-}
-
 void QuartcSession::SetDefaultEncryptionLevel(EncryptionLevel level) {
   QuicSession::SetDefaultEncryptionLevel(level);
   switch (level) {
diff --git a/quic/quartc/quartc_session.h b/quic/quartc/quartc_session.h
index 6e00fcf..08e5719 100644
--- a/quic/quartc/quartc_session.h
+++ b/quic/quartc/quartc_session.h
@@ -74,7 +74,6 @@
     return VersionSupportsMessageFrames(transport_version());
   }
 
-  void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
   void SetDefaultEncryptionLevel(EncryptionLevel level) override;
 
   // QuicConnectionVisitorInterface overrides.
diff --git a/quic/quic_transport/quic_transport_client_session.cc b/quic/quic_transport/quic_transport_client_session.cc
index 31ad462..132afd5 100644
--- a/quic/quic_transport/quic_transport_client_session.cc
+++ b/quic/quic_transport/quic_transport_client_session.cc
@@ -97,16 +97,6 @@
   return stream;
 }
 
-void QuicTransportClientSession::OnCryptoHandshakeEvent(
-    CryptoHandshakeEvent event) {
-  QuicSession::OnCryptoHandshakeEvent(event);
-  if (event != EVENT_HANDSHAKE_CONFIRMED) {
-    return;
-  }
-
-  SendClientIndication();
-}
-
 void QuicTransportClientSession::SetDefaultEncryptionLevel(
     EncryptionLevel level) {
   QuicSession::SetDefaultEncryptionLevel(level);
diff --git a/quic/quic_transport/quic_transport_client_session.h b/quic/quic_transport/quic_transport_client_session.h
index e2bee49..1e00a28 100644
--- a/quic/quic_transport/quic_transport_client_session.h
+++ b/quic/quic_transport/quic_transport_client_session.h
@@ -95,7 +95,6 @@
     return nullptr;
   }
 
-  void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
   void SetDefaultEncryptionLevel(EncryptionLevel level) override;
   void OnMessageReceived(quiche::QuicheStringPiece message) override;
 
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index 6348eb3..dbb4165 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -676,11 +676,6 @@
                                   &helper_);
 }
 
-void TestQuicSpdyServerSession::OnCryptoHandshakeEvent(
-    CryptoHandshakeEvent event) {
-  QuicSession::OnCryptoHandshakeEvent(event);
-}
-
 QuicCryptoServerStreamBase*
 TestQuicSpdyServerSession::GetMutableCryptoStream() {
   return QuicServerSessionBase::GetMutableCryptoStream();
@@ -713,11 +708,6 @@
   return true;
 }
 
-void TestQuicSpdyClientSession::OnCryptoHandshakeEvent(
-    CryptoHandshakeEvent event) {
-  QuicSession::OnCryptoHandshakeEvent(event);
-}
-
 QuicCryptoClientStream* TestQuicSpdyClientSession::GetMutableCryptoStream() {
   return crypto_stream_.get();
 }
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 974d9e2..8ca2884 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -657,7 +657,6 @@
                void(QuicStreamId stream_id, bool fin, size_t frame_len));
   MOCK_CONST_METHOD0(ShouldKeepConnectionAlive, bool());
   MOCK_METHOD2(SendStopSending, void(uint16_t code, QuicStreamId stream_id));
-  MOCK_METHOD1(OnCryptoHandshakeEvent, void(QuicSession::CryptoHandshakeEvent));
   MOCK_CONST_METHOD0(GetAlpnsToOffer, std::vector<std::string>());
   MOCK_CONST_METHOD1(SelectAlpn,
                      std::vector<quiche::QuicheStringPiece>::const_iterator(
@@ -812,9 +811,6 @@
       const QuicCryptoServerConfig* crypto_config,
       QuicCompressedCertsCache* compressed_certs_cache) override;
 
-  // Override to not send max header list size.
-  void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
-
   QuicCryptoServerStreamBase* GetMutableCryptoStream() override;
 
   const QuicCryptoServerStreamBase* GetCryptoStream() const override;
@@ -878,8 +874,6 @@
   MOCK_METHOD0(ShouldCreateOutgoingUnidirectionalStream, bool());
   MOCK_CONST_METHOD0(GetAlpnsToOffer, std::vector<std::string>());
 
-  // Override to not send max header list size.
-  void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
   QuicCryptoClientStream* GetMutableCryptoStream() override;
   const QuicCryptoClientStream* GetCryptoStream() const override;