OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // HttpAlternateProtocols is an in-memory data structure used for keeping track | 5 // HttpAlternateProtocols is an in-memory data structure used for keeping track |
6 // of which HTTP HostPortPairs have an alternate protocol that can be used | 6 // of which HTTP HostPortPairs have an alternate protocol that can be used |
7 // instead of HTTP on a different port. | 7 // instead of HTTP on a different port. |
8 | 8 |
9 #ifndef NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 9 #ifndef NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
10 #define NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 10 #define NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 #include <string> | 14 #include <string> |
15 #include <utility> | 15 #include <utility> |
16 | 16 |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
19 #include "net/base/net_api.h" | 19 #include "net/base/net_export.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class NET_API HttpAlternateProtocols { | 23 class NET_EXPORT HttpAlternateProtocols { |
24 public: | 24 public: |
25 enum Protocol { | 25 enum Protocol { |
26 NPN_SPDY_1, | 26 NPN_SPDY_1, |
27 NPN_SPDY_2, | 27 NPN_SPDY_2, |
28 NUM_ALTERNATE_PROTOCOLS, | 28 NUM_ALTERNATE_PROTOCOLS, |
29 BROKEN, // The alternate protocol is known to be broken. | 29 BROKEN, // The alternate protocol is known to be broken. |
30 UNINITIALIZED, | 30 UNINITIALIZED, |
31 }; | 31 }; |
32 | 32 |
33 struct NET_API PortProtocolPair { | 33 struct NET_EXPORT PortProtocolPair { |
34 bool Equals(const PortProtocolPair& other) const { | 34 bool Equals(const PortProtocolPair& other) const { |
35 return port == other.port && protocol == other.protocol; | 35 return port == other.port && protocol == other.protocol; |
36 } | 36 } |
37 | 37 |
38 std::string ToString() const; | 38 std::string ToString() const; |
39 | 39 |
40 uint16 port; | 40 uint16 port; |
41 Protocol protocol; | 41 Protocol protocol; |
42 }; | 42 }; |
43 | 43 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // The forced alternate protocol. If not-null, there is a protocol being | 85 // The forced alternate protocol. If not-null, there is a protocol being |
86 // forced. | 86 // forced. |
87 static PortProtocolPair* forced_alternate_protocol_; | 87 static PortProtocolPair* forced_alternate_protocol_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(HttpAlternateProtocols); | 89 DISALLOW_COPY_AND_ASSIGN(HttpAlternateProtocols); |
90 }; | 90 }; |
91 | 91 |
92 } // namespace net | 92 } // namespace net |
93 | 93 |
94 #endif // NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 94 #endif // NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
OLD | NEW |