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_session_key.h"
11 QuicSessionKey::QuicSessionKey() {}
13 QuicSessionKey::QuicSessionKey(const HostPortPair& host_port_pair,
15 PrivacyMode privacy_mode)
16 : host_port_pair_(host_port_pair),
18 privacy_mode_(privacy_mode) {}
20 QuicSessionKey::QuicSessionKey(const string& host,
23 PrivacyMode privacy_mode)
24 : host_port_pair_(host, port),
26 privacy_mode_(privacy_mode) {}
28 QuicSessionKey::~QuicSessionKey() {}
30 bool QuicSessionKey::operator<(const QuicSessionKey& other) const {
31 if (!host_port_pair_.Equals(other.host_port_pair_)) {
32 return host_port_pair_ < other.host_port_pair_;
34 if (is_https_ != other.is_https_) {
35 return is_https_ < other.is_https_;
37 return privacy_mode_ < other.privacy_mode_;
40 bool QuicSessionKey::operator==(const QuicSessionKey& other) const {
41 return is_https_ == other.is_https_ &&
42 privacy_mode_ == other.privacy_mode_ &&
43 host_port_pair_.Equals(other.host_port_pair_);
46 string QuicSessionKey::ToString() const {
47 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString() +
48 (privacy_mode_ == kPrivacyModeEnabled ? "/private" : "");