OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_stream_factory.h" | 5 #include "net/http/http_stream_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY | 161 // TODO(rtenneti): bug 116575 - consider using same strings/enums for SPDY |
162 // versions in next_protos and kAlternateProtocolStrings. | 162 // versions in next_protos and kAlternateProtocolStrings. |
163 for (uint32 i = 0; i < value.size(); ++i) { | 163 for (uint32 i = 0; i < value.size(); ++i) { |
164 if (value[i] == "spdy/1") { | 164 if (value[i] == "spdy/1") { |
165 enabled_protocols_[NPN_SPDY_1] = true; | 165 enabled_protocols_[NPN_SPDY_1] = true; |
166 } else if (value[i] == "spdy/2") { | 166 } else if (value[i] == "spdy/2") { |
167 enabled_protocols_[NPN_SPDY_2] = true; | 167 enabled_protocols_[NPN_SPDY_2] = true; |
168 } else if (value[i] == "spdy/2.1") { | 168 } else if (value[i] == "spdy/2.1") { |
169 enabled_protocols_[NPN_SPDY_21] = true; | 169 enabled_protocols_[NPN_SPDY_21] = true; |
| 170 } else if (value[i] == "spdy/3") { |
| 171 enabled_protocols_[NPN_SPDY_3] = true; |
170 } | 172 } |
171 } | 173 } |
172 enabled_protocols_[NPN_SPDY_1] = false; | 174 enabled_protocols_[NPN_SPDY_1] = false; |
173 } | 175 } |
174 | 176 |
175 // static | 177 // static |
176 void HttpStreamFactory::SetHostMappingRules(const std::string& rules) { | 178 void HttpStreamFactory::SetHostMappingRules(const std::string& rules) { |
177 HostMappingRules* host_mapping_rules = new HostMappingRules; | 179 HostMappingRules* host_mapping_rules = new HostMappingRules; |
178 host_mapping_rules->SetRulesFromString(rules); | 180 host_mapping_rules->SetRulesFromString(rules); |
179 delete host_mapping_rules_; | 181 delete host_mapping_rules_; |
180 host_mapping_rules_ = host_mapping_rules; | 182 host_mapping_rules_ = host_mapping_rules; |
181 } | 183 } |
182 | 184 |
183 HttpStreamFactory::HttpStreamFactory() {} | 185 HttpStreamFactory::HttpStreamFactory() {} |
184 | 186 |
185 // static | 187 // static |
186 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { | 188 const HostMappingRules& HttpStreamFactory::host_mapping_rules() { |
187 if (!host_mapping_rules_) | 189 if (!host_mapping_rules_) |
188 host_mapping_rules_ = new HostMappingRules; | 190 host_mapping_rules_ = new HostMappingRules; |
189 return *host_mapping_rules_; | 191 return *host_mapping_rules_; |
190 } | 192 } |
191 | 193 |
192 } // namespace net | 194 } // namespace net |
OLD | NEW |