Home | History | Annotate | Download | only in spdy
      1 // Copyright (c) 2013 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 #ifndef NET_SPDY_SPDY_SESSION_KEY_H_
      6 #define NET_SPDY_SPDY_SESSION_KEY_H_
      7 
      8 #include "net/base/privacy_mode.h"
      9 #include "net/proxy/proxy_server.h"
     10 
     11 namespace net {
     12 
     13 // SpdySessionKey is used as unique index for SpdySessionPool.
     14 class NET_EXPORT_PRIVATE SpdySessionKey {
     15  public:
     16   SpdySessionKey();
     17   SpdySessionKey(const HostPortPair& host_port_pair,
     18                  const ProxyServer& proxy_server,
     19                  PrivacyMode privacy_mode);
     20 
     21   // Temporary hack for implicit copy constructor
     22   SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair,
     23                  PrivacyMode privacy_mode);
     24 
     25   ~SpdySessionKey();
     26 
     27   // Comparator function so this can be placed in a std::map.
     28   bool operator<(const SpdySessionKey& other) const;
     29 
     30   // Equality test of contents. (Probably another violation of style guide).
     31   bool Equals(const SpdySessionKey& other) const;
     32 
     33   const HostPortProxyPair& host_port_proxy_pair() const {
     34     return host_port_proxy_pair_;
     35   }
     36 
     37   const HostPortPair& host_port_pair() const {
     38     return host_port_proxy_pair_.first;
     39   }
     40 
     41   const ProxyServer& proxy_server() const {
     42     return host_port_proxy_pair_.second;
     43   }
     44 
     45   PrivacyMode privacy_mode() const {
     46     return privacy_mode_;
     47   }
     48 
     49  private:
     50   HostPortProxyPair host_port_proxy_pair_;
     51   // If enabled, then session cannot be tracked by the server.
     52   PrivacyMode privacy_mode_;
     53 };
     54 
     55 }  // namespace net
     56 
     57 #endif  // NET_SPDY_SPDY_SESSION_KEY_H_
     58 
     59