Index: chrome/browser/net/ssl_config_service_manager_pref.cc |
diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc |
index decd8951c11ef5829b8125a65b5634150749d906..1a853fe939510f0c71663c9c1155433b4aa11e74 100644 |
--- a/chrome/browser/net/ssl_config_service_manager_pref.cc |
+++ b/chrome/browser/net/ssl_config_service_manager_pref.cc |
@@ -20,6 +20,7 @@ |
#include "components/content_settings/core/browser/content_settings_utils.h" |
#include "components/content_settings/core/common/content_settings.h" |
#include "content/public/browser/browser_thread.h" |
+#include "net/base/host_port_pair.h" |
#include "net/socket/ssl_client_socket.h" |
#include "net/ssl/ssl_cipher_suite_names.h" |
#include "net/ssl/ssl_config_service.h" |
@@ -28,6 +29,11 @@ using content::BrowserThread; |
namespace { |
+// Field trial for ClientHello padding. |
+const char kClientHelloFieldTrialName[] = "FastRadioPadding"; |
+const char kClientHelloFieldTrialEnabledGroupName[] = "Enabled"; |
+const char* kGoogleDomain = ".google.com"; |
+ |
// Converts a ListValue of StringValues into a vector of strings. Any Values |
// which cannot be converted will be skipped. |
std::vector<std::string> ListValueToStringVector(const base::ListValue* value) { |
@@ -96,6 +102,9 @@ class SSLConfigServicePref : public net::SSLConfigService { |
// Store SSL config settings in |config|. Must only be called from IO thread. |
void GetSSLConfig(net::SSLConfig* config) override; |
+ bool SupportsFastradioPadding( |
+ const net::HostPortPair& host_and_port) override; |
+ |
private: |
// Allow the pref watcher to update our internal state. |
friend class SSLConfigServiceManagerPref; |
@@ -116,6 +125,15 @@ void SSLConfigServicePref::GetSSLConfig(net::SSLConfig* config) { |
*config = cached_config_; |
} |
+bool SSLConfigServicePref::SupportsFastradioPadding( |
+ const net::HostPortPair& host_and_port) { |
+ const std::string& host = host_and_port.host(); |
+ bool is_google = |
+ host == kGoogleDomain || |
+ (host.size() > 11 && host.rfind(kGoogleDomain) == host.size() - 11); |
+ return is_google; |
+} |
+ |
void SSLConfigServicePref::SetNewSSLConfig( |
const net::SSLConfig& new_config) { |
net::SSLConfig orig_config = cached_config_; |
@@ -286,6 +304,12 @@ void SSLConfigServiceManagerPref::GetSSLConfigFromPrefs( |
config->disabled_cipher_suites = disabled_cipher_suites_; |
// disabling False Start also happens to disable record splitting. |
config->false_start_enabled = !ssl_record_splitting_disabled_.GetValue(); |
+ |
+ base::StringPiece group = |
+ base::FieldTrialList::FindFullName(kClientHelloFieldTrialName); |
+ if (group.starts_with(kClientHelloFieldTrialEnabledGroupName)) { |
+ config->enable_fastradio_padding = true; |
+ } |
} |
void SSLConfigServiceManagerPref::OnDisabledCipherSuitesChange( |