| 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/socket/client_socket_pool_manager_impl.h" | 5 #include "net/socket/client_socket_pool_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "net/http/http_network_session.h" | 9 #include "net/http/http_network_session.h" |
| 10 #include "net/http/http_proxy_client_socket_pool.h" | 10 #include "net/http/http_proxy_client_socket_pool.h" |
| 11 #include "net/socket/socks_client_socket_pool.h" | 11 #include "net/socket/socks_client_socket_pool.h" |
| 12 #include "net/socket/ssl_client_socket_pool.h" | 12 #include "net/socket/ssl_client_socket_pool.h" |
| 13 #include "net/socket/transport_client_socket_pool.h" | 13 #include "net/socket/transport_client_socket_pool.h" |
| 14 #include "net/ssl/ssl_config_service.h" | 14 #include "net/ssl/ssl_config_service.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Appends information about all |socket_pools| to the end of |list|. | 20 // Appends information about all |socket_pools| to the end of |list|. |
| 21 template <class MapType> | 21 template <class MapType> |
| 22 void AddSocketPoolsToList(ListValue* list, | 22 void AddSocketPoolsToList(base::ListValue* list, |
| 23 const MapType& socket_pools, | 23 const MapType& socket_pools, |
| 24 const std::string& type, | 24 const std::string& type, |
| 25 bool include_nested_pools) { | 25 bool include_nested_pools) { |
| 26 for (typename MapType::const_iterator it = socket_pools.begin(); | 26 for (typename MapType::const_iterator it = socket_pools.begin(); |
| 27 it != socket_pools.end(); it++) { | 27 it != socket_pools.end(); it++) { |
| 28 list->Append(it->second->GetInfoAsValue(it->first.ToString(), | 28 list->Append(it->second->GetInfoAsValue(it->first.ToString(), |
| 29 type, | 29 type, |
| 30 include_nested_pools)); | 30 include_nested_pools)); |
| 31 } | 31 } |
| 32 } | 32 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 ssl_config_service_.get(), | 334 ssl_config_service_.get(), |
| 335 net_log_); | 335 net_log_); |
| 336 | 336 |
| 337 std::pair<SSLSocketPoolMap::iterator, bool> ret = | 337 std::pair<SSLSocketPoolMap::iterator, bool> ret = |
| 338 ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server, | 338 ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server, |
| 339 new_pool)); | 339 new_pool)); |
| 340 | 340 |
| 341 return ret.first->second; | 341 return ret.first->second; |
| 342 } | 342 } |
| 343 | 343 |
| 344 Value* ClientSocketPoolManagerImpl::SocketPoolInfoToValue() const { | 344 base::Value* ClientSocketPoolManagerImpl::SocketPoolInfoToValue() const { |
| 345 ListValue* list = new ListValue(); | 345 base::ListValue* list = new base::ListValue(); |
| 346 list->Append(transport_socket_pool_->GetInfoAsValue("transport_socket_pool", | 346 list->Append(transport_socket_pool_->GetInfoAsValue("transport_socket_pool", |
| 347 "transport_socket_pool", | 347 "transport_socket_pool", |
| 348 false)); | 348 false)); |
| 349 // Third parameter is false because |ssl_socket_pool_| uses | 349 // Third parameter is false because |ssl_socket_pool_| uses |
| 350 // |transport_socket_pool_| internally, and do not want to add it a second | 350 // |transport_socket_pool_| internally, and do not want to add it a second |
| 351 // time. | 351 // time. |
| 352 list->Append(ssl_socket_pool_->GetInfoAsValue("ssl_socket_pool", | 352 list->Append(ssl_socket_pool_->GetInfoAsValue("ssl_socket_pool", |
| 353 "ssl_socket_pool", | 353 "ssl_socket_pool", |
| 354 false)); | 354 false)); |
| 355 AddSocketPoolsToList(list, | 355 AddSocketPoolsToList(list, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 383 // We should not flush the socket pools if we added trust to a | 383 // We should not flush the socket pools if we added trust to a |
| 384 // cert. | 384 // cert. |
| 385 // | 385 // |
| 386 // Since the OnCertTrustChanged method doesn't tell us what | 386 // Since the OnCertTrustChanged method doesn't tell us what |
| 387 // kind of trust change it is, we have to flush the socket | 387 // kind of trust change it is, we have to flush the socket |
| 388 // pools to be safe. | 388 // pools to be safe. |
| 389 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); | 389 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace net | 392 } // namespace net |
| OLD | NEW |