OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/ssl/ssl_socket_config_service.h" |
| 6 |
| 7 #include <string> |
| 8 #include "net/base/host_port_pair.h" |
| 9 |
| 10 namespace { |
| 11 const char* kGoogleDomain = ".google.com"; |
| 12 } |
| 13 |
| 14 namespace net { |
| 15 |
| 16 void SSLSocketConfigService::EnableFastRadioPadding() { |
| 17 enabled_ = true; |
| 18 } |
| 19 |
| 20 void SSLSocketConfigService::DisableFastRadioPadding() { |
| 21 enabled_ = false; |
| 22 } |
| 23 |
| 24 bool SSLSocketConfigService::UseFastRadioPadding( |
| 25 const HostPortPair& host_and_port) { |
| 26 if (!enabled_) |
| 27 return false; |
| 28 |
| 29 return IsGoogle(host_and_port); |
| 30 } |
| 31 |
| 32 bool SSLSocketConfigService::IsGoogle(const HostPortPair& host_and_port) { |
| 33 const std::string& host = host_and_port.host(); |
| 34 bool is_google = |
| 35 host == kGoogleDomain || |
| 36 (host.size() > 11 && host.rfind(kGoogleDomain) == host.size() - 11); |
| 37 return is_google; |
| 38 } |
| 39 |
| 40 } // namespace net |
OLD | NEW |