Delete unused downloads page asset.
[chromium-blink-merge.git] / net / quic / quic_server_id.cc
blob15c9c5ce0672f35b352e5dda24817dca1a56206e
1 // Copyright 2014 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.
5 #include "net/quic/quic_server_id.h"
7 using std::string;
9 namespace net {
11 QuicServerId::QuicServerId()
12 : is_https_(false), privacy_mode_(PRIVACY_MODE_DISABLED) {
15 QuicServerId::QuicServerId(const HostPortPair& host_port_pair,
16 bool is_https,
17 PrivacyMode privacy_mode)
18 : host_port_pair_(host_port_pair),
19 is_https_(is_https),
20 privacy_mode_(privacy_mode) {}
22 QuicServerId::QuicServerId(const string& host,
23 uint16 port,
24 bool is_https)
25 : host_port_pair_(host, port),
26 is_https_(is_https),
27 privacy_mode_(PRIVACY_MODE_DISABLED) {}
29 QuicServerId::QuicServerId(const string& host,
30 uint16 port,
31 bool is_https,
32 PrivacyMode privacy_mode)
33 : host_port_pair_(host, port),
34 is_https_(is_https),
35 privacy_mode_(privacy_mode) {}
37 QuicServerId::~QuicServerId() {}
39 bool QuicServerId::operator<(const QuicServerId& other) const {
40 if (!host_port_pair_.Equals(other.host_port_pair_)) {
41 return host_port_pair_ < other.host_port_pair_;
43 if (is_https_ != other.is_https_) {
44 return is_https_ < other.is_https_;
46 return privacy_mode_ < other.privacy_mode_;
49 bool QuicServerId::operator==(const QuicServerId& other) const {
50 return is_https_ == other.is_https_ &&
51 privacy_mode_ == other.privacy_mode_ &&
52 host_port_pair_.Equals(other.host_port_pair_);
55 string QuicServerId::ToString() const {
56 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString() +
57 (privacy_mode_ == PRIVACY_MODE_ENABLED ? "/private" : "");
60 } // namespace net