| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 NextProto protocol; | 108 NextProto protocol; |
| 109 std::string host; | 109 std::string host; |
| 110 uint16_t port; | 110 uint16_t port; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 NET_EXPORT_PRIVATE std::ostream& operator<<( | 113 NET_EXPORT_PRIVATE std::ostream& operator<<( |
| 114 std::ostream& os, | 114 std::ostream& os, |
| 115 const AlternativeService& alternative_service); | 115 const AlternativeService& alternative_service); |
| 116 | 116 |
| 117 struct NET_EXPORT AlternativeServiceInfo { | 117 class NET_EXPORT_PRIVATE AlternativeServiceInfo { |
| 118 AlternativeServiceInfo() : alternative_service() {} | 118 public: |
| 119 AlternativeServiceInfo(); |
| 119 | 120 |
| 120 AlternativeServiceInfo(const AlternativeService& alternative_service, | 121 AlternativeServiceInfo(const AlternativeService& alternative_service, |
| 121 base::Time expiration) | 122 base::Time expiration); |
| 122 : alternative_service(alternative_service), | |
| 123 expiration(expiration) {} | |
| 124 | 123 |
| 125 AlternativeServiceInfo(NextProto protocol, | 124 AlternativeServiceInfo(NextProto protocol, |
| 126 const std::string& host, | 125 const std::string& host, |
| 127 uint16_t port, | 126 uint16_t port, |
| 128 base::Time expiration) | 127 base::Time expiration); |
| 129 : alternative_service(protocol, host, port), expiration(expiration) {} | |
| 130 | 128 |
| 131 AlternativeServiceInfo( | 129 AlternativeServiceInfo( |
| 132 const AlternativeServiceInfo& alternative_service_info) = default; | 130 const AlternativeServiceInfo& alternative_service_info); |
| 133 AlternativeServiceInfo& operator=( | 131 AlternativeServiceInfo& operator=( |
| 134 const AlternativeServiceInfo& alternative_service_info) = default; | 132 const AlternativeServiceInfo& alternative_service_info); |
| 135 | 133 |
| 136 bool operator==(const AlternativeServiceInfo& other) const { | 134 bool operator==(const AlternativeServiceInfo& other) const { |
| 137 return alternative_service == other.alternative_service && | 135 return alternative_service_ == other.alternative_service() && |
| 138 expiration == other.expiration; | 136 expiration_ == other.expiration(); |
| 139 } | 137 } |
| 140 | 138 |
| 141 bool operator!=(const AlternativeServiceInfo& other) const { | 139 bool operator!=(const AlternativeServiceInfo& other) const { |
| 142 return !this->operator==(other); | 140 return !this->operator==(other); |
| 143 } | 141 } |
| 144 | 142 |
| 145 std::string ToString() const; | 143 std::string ToString() const; |
| 146 | 144 |
| 147 AlternativeService alternative_service; | 145 void set_alternative_service(const AlternativeService& alternative_service) { |
| 148 base::Time expiration; | 146 alternative_service_ = alternative_service; |
| 147 } |
| 148 |
| 149 void set_protocol(const NextProto& protocol) { |
| 150 alternative_service_.protocol = protocol; |
| 151 } |
| 152 |
| 153 void set_host(const std::string& host) { alternative_service_.host = host; } |
| 154 |
| 155 void set_port(uint16_t port) { alternative_service_.port = port; } |
| 156 |
| 157 void set_expiration(const base::Time& expiration) { |
| 158 expiration_ = expiration; |
| 159 } |
| 160 |
| 161 const AlternativeService& alternative_service() const { |
| 162 return alternative_service_; |
| 163 } |
| 164 |
| 165 base::Time expiration() const { return expiration_; } |
| 166 |
| 167 private: |
| 168 AlternativeService alternative_service_; |
| 169 base::Time expiration_; |
| 149 }; | 170 }; |
| 150 | 171 |
| 151 struct NET_EXPORT SupportsQuic { | 172 struct NET_EXPORT SupportsQuic { |
| 152 SupportsQuic() : used_quic(false) {} | 173 SupportsQuic() : used_quic(false) {} |
| 153 SupportsQuic(bool used_quic, const std::string& address) | 174 SupportsQuic(bool used_quic, const std::string& address) |
| 154 : used_quic(used_quic), | 175 : used_quic(used_quic), |
| 155 address(address) {} | 176 address(address) {} |
| 156 | 177 |
| 157 bool Equals(const SupportsQuic& other) const { | 178 bool Equals(const SupportsQuic& other) const { |
| 158 return used_quic == other.used_quic && address == other.address; | 179 return used_quic == other.used_quic && address == other.address; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // Returns whether HttpServerProperties is initialized. | 358 // Returns whether HttpServerProperties is initialized. |
| 338 virtual bool IsInitialized() const = 0; | 359 virtual bool IsInitialized() const = 0; |
| 339 | 360 |
| 340 private: | 361 private: |
| 341 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 362 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 342 }; | 363 }; |
| 343 | 364 |
| 344 } // namespace net | 365 } // namespace net |
| 345 | 366 |
| 346 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 367 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |