| OLD | NEW |
| 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 // 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 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 class HttpAlternateProtocols { | 22 class HttpAlternateProtocols { |
| 23 public: | 23 public: |
| 24 enum Protocol { | 24 enum Protocol { |
| 25 NPN_SPDY_1, | 25 NPN_SPDY_1, |
| 26 NPN_SPDY_2, | 26 NPN_SPDY_2, |
| 27 NUM_ALTERNATE_PROTOCOLS, | 27 NUM_ALTERNATE_PROTOCOLS, |
| 28 BROKEN, // The alternate protocol is known to be broken. | 28 BROKEN, // The alternate protocol is known to be broken. |
| 29 UNINITIALIZED, |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 struct PortProtocolPair { | 32 struct PortProtocolPair { |
| 32 bool Equals(const PortProtocolPair& other) const { | 33 bool Equals(const PortProtocolPair& other) const { |
| 33 return port == other.port && protocol == other.protocol; | 34 return port == other.port && protocol == other.protocol; |
| 34 } | 35 } |
| 35 | 36 |
| 36 uint16 port; | 37 uint16 port; |
| 37 Protocol protocol; | 38 Protocol protocol; |
| 38 }; | 39 }; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // The forced alternate protocol. If not-null, there is a protocol being | 78 // The forced alternate protocol. If not-null, there is a protocol being |
| 78 // forced. | 79 // forced. |
| 79 static PortProtocolPair* forced_alternate_protocol_; | 80 static PortProtocolPair* forced_alternate_protocol_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(HttpAlternateProtocols); | 82 DISALLOW_COPY_AND_ASSIGN(HttpAlternateProtocols); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace net | 85 } // namespace net |
| 85 | 86 |
| 86 #endif // NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 87 #endif // NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
| OLD | NEW |