190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file. 490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "net/spdy/spdy_session_key.h" 690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/logging.h" 890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace net { 1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 11e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen MurdochSpdySessionKey::SpdySessionKey() : privacy_mode_(PRIVACY_MODE_DISABLED) { 1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SpdySessionKey::SpdySessionKey(const HostPortPair& host_port_pair, 1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const ProxyServer& proxy_server, 1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) PrivacyMode privacy_mode) 1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) : host_port_proxy_pair_(host_port_pair, proxy_server), 1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) privacy_mode_(privacy_mode) { 1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) DVLOG(1) << "SpdySessionKey(host=" << host_port_pair.ToString() 2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) << ", proxy=" << proxy_server.ToURI() 2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) << ", privacy=" << privacy_mode; 2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SpdySessionKey::SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair, 2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) PrivacyMode privacy_mode) 2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) : host_port_proxy_pair_(host_port_proxy_pair), 2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) privacy_mode_(privacy_mode) { 2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) DVLOG(1) << "SpdySessionKey(hppp=" << host_port_proxy_pair.first.ToString() 2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) << "," << host_port_proxy_pair.second.ToURI() 3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) << ", privacy=" << privacy_mode; 3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)SpdySessionKey::~SpdySessionKey() {} 3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool SpdySessionKey::operator<(const SpdySessionKey& other) const { 3690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (privacy_mode_ != other.privacy_mode_) 3790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return privacy_mode_ < other.privacy_mode_; 3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) if (!host_port_proxy_pair_.first.Equals(other.host_port_proxy_pair_.first)) 3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return host_port_proxy_pair_.first < other.host_port_proxy_pair_.first; 4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return host_port_proxy_pair_.second < other.host_port_proxy_pair_.second; 4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 4390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)bool SpdySessionKey::Equals(const SpdySessionKey& other) const { 4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return privacy_mode_ == other.privacy_mode_ && 4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) host_port_proxy_pair_.first.Equals(other.host_port_proxy_pair_.first) && 4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) host_port_proxy_pair_.second == other.host_port_proxy_pair_.second; 4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} // namespace net 5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 51