Index: net/ssl/ssl_socket_config_service.cc |
diff --git a/net/ssl/ssl_socket_config_service.cc b/net/ssl/ssl_socket_config_service.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ae1925ed3da2e858ddbdc864045214ea3f69933 |
--- /dev/null |
+++ b/net/ssl/ssl_socket_config_service.cc |
@@ -0,0 +1,40 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/ssl/ssl_socket_config_service.h" |
+ |
+#include <string> |
+#include "net/base/host_port_pair.h" |
+ |
+namespace { |
+const char* kGoogleDomain = ".google.com"; |
+} |
+ |
+namespace net { |
+ |
+void SSLSocketConfigService::EnableFastRadioPadding() { |
+ enabled_ = true; |
+} |
+ |
+void SSLSocketConfigService::DisableFastRadioPadding() { |
+ enabled_ = false; |
+} |
+ |
+bool SSLSocketConfigService::UseFastRadioPadding( |
+ const HostPortPair& host_and_port) { |
+ if (!enabled_) |
+ return false; |
+ |
+ return IsGoogle(host_and_port); |
+} |
+ |
+bool SSLSocketConfigService::IsGoogle(const 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; |
+} |
+ |
+} // namespace net |