Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: net/base/host_port_pair.h

Issue 1755005: SPDY: Fix Alternate-Protocol. (Closed)
Patch Set: Address mbelshe's comments. Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/base/host_port_pair.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_BASE_HOST_PORT_PAIR_H_ 5 #ifndef NET_BASE_HOST_PORT_PAIR_H_
6 #define NET_BASE_HOST_PORT_PAIR_H_ 6 #define NET_BASE_HOST_PORT_PAIR_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 struct HostPortPair { 13 struct HostPortPair {
14 HostPortPair() {} 14 HostPortPair();
15 HostPortPair(const std::string& in_host, uint16 in_port) 15 // If |in_host| represents an IPv6 address, it should not bracket the address.
16 : host(in_host), port(in_port) {} 16 HostPortPair(const std::string& in_host, uint16 in_port);
17 17
18 // Comparator function so this can be placed in a std::map. 18 // Comparator function so this can be placed in a std::map.
19 bool operator<(const HostPortPair& other) const { 19 bool operator<(const HostPortPair& other) const {
20 if (host != other.host) 20 if (host != other.host)
21 return host < other.host; 21 return host < other.host;
22 return port < other.port; 22 return port < other.port;
23 } 23 }
24 24
25 // ToString() will convert the HostPortPair to "host:port". If |host| is an
26 // IPv6 literal, it will add brackets around |host|.
25 std::string ToString() const; 27 std::string ToString() const;
26 28
29 // If |host| represents an IPv6 address, this string will not contain brackets
30 // around the address.
27 std::string host; 31 std::string host;
28 uint16 port; 32 uint16 port;
29 }; 33 };
30 34
31 } // namespace net 35 } // namespace net
32 36
33 #endif // NET_BASE_HOST_PORT_PAIR_H_ 37 #endif // NET_BASE_HOST_PORT_PAIR_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/host_port_pair.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698