OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "net/socket/next_proto.h" | 5 #include "net/socket/next_proto.h" |
6 | 6 |
7 namespace net { | 7 namespace net { |
8 | 8 |
9 NextProtoVector NextProtosHttpOnly() { | 9 NextProtoVector NextProtos(bool quic_enabled, |
10 bool spdy31_enabled, | |
11 bool h2_14_enabled, | |
12 bool h2_enabled) { | |
10 NextProtoVector next_protos; | 13 NextProtoVector next_protos; |
11 next_protos.push_back(kProtoHTTP11); | 14 next_protos.push_back(kProtoHTTP11); |
15 if (quic_enabled) | |
16 next_protos.push_back(kProtoQUIC1SPDY3); | |
17 if (spdy31_enabled) | |
18 next_protos.push_back(kProtoSPDY31); | |
19 if (h2_14_enabled) | |
20 next_protos.push_back(kProtoSPDY4_14); | |
21 if (h2_enabled) | |
22 next_protos.push_back(kProtoSPDY4); | |
12 return next_protos; | 23 return next_protos; |
13 } | 24 } |
14 | 25 |
15 NextProtoVector NextProtosDefaults() { | 26 NextProtoVector NextProtosDefaults() { |
16 NextProtoVector next_protos; | 27 return NextProtos(false, true, true, true); |
17 next_protos.push_back(kProtoHTTP11); | 28 } |
18 next_protos.push_back(kProtoSPDY31); | 29 |
19 next_protos.push_back(kProtoSPDY4_14); | 30 NextProtoVector NextProtosSpdy31() { |
20 next_protos.push_back(kProtoSPDY4); | 31 return NextProtos(true, true, false, false); |
Ryan Hamilton
2015/03/20 23:38:07
Lots of booleans is a recipe for typos. How about
Bence
2015/03/23 14:19:13
Okay, you convinced me. I'm moving the logic to i
| |
21 return next_protos; | |
22 } | 32 } |
23 | 33 |
24 NextProtoVector NextProtosWithSpdyAndQuic(bool spdy_enabled, | 34 NextProtoVector NextProtosWithSpdyAndQuic(bool spdy_enabled, |
25 bool quic_enabled) { | 35 bool quic_enabled) { |
26 NextProtoVector next_protos; | 36 return NextProtos(spdy_enabled, spdy_enabled, spdy_enabled, quic_enabled); |
27 next_protos.push_back(kProtoHTTP11); | |
28 if (quic_enabled) | |
29 next_protos.push_back(kProtoQUIC1SPDY3); | |
30 if (spdy_enabled) { | |
31 next_protos.push_back(kProtoSPDY31); | |
32 next_protos.push_back(kProtoSPDY4_14); | |
33 next_protos.push_back(kProtoSPDY4); | |
34 } | |
35 return next_protos; | |
36 } | |
37 | |
38 NextProtoVector NextProtosSpdy31() { | |
39 NextProtoVector next_protos; | |
40 next_protos.push_back(kProtoHTTP11); | |
41 next_protos.push_back(kProtoQUIC1SPDY3); | |
42 next_protos.push_back(kProtoSPDY31); | |
43 return next_protos; | |
44 } | |
45 | |
46 NextProtoVector NextProtosSpdy4Http2() { | |
47 NextProtoVector next_protos; | |
48 next_protos.push_back(kProtoHTTP11); | |
49 next_protos.push_back(kProtoQUIC1SPDY3); | |
50 next_protos.push_back(kProtoSPDY31); | |
51 next_protos.push_back(kProtoSPDY4_14); | |
52 next_protos.push_back(kProtoSPDY4); | |
53 return next_protos; | |
54 } | 37 } |
55 | 38 |
56 } // namespace net | 39 } // namespace net |
OLD | NEW |