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" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 GetSocketPoolForHTTPProxy(proxy_server), ssl_config_service_.get(), | 317 GetSocketPoolForHTTPProxy(proxy_server), ssl_config_service_.get(), |
318 net_log_); | 318 net_log_); |
319 | 319 |
320 std::pair<SSLSocketPoolMap::iterator, bool> ret = | 320 std::pair<SSLSocketPoolMap::iterator, bool> ret = |
321 ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server, | 321 ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server, |
322 new_pool)); | 322 new_pool)); |
323 | 323 |
324 return ret.first->second; | 324 return ret.first->second; |
325 } | 325 } |
326 | 326 |
327 base::Value* ClientSocketPoolManagerImpl::SocketPoolInfoToValue() const { | 327 scoped_ptr<base::Value> ClientSocketPoolManagerImpl::SocketPoolInfoToValue() |
328 base::ListValue* list = new base::ListValue(); | 328 const { |
| 329 scoped_ptr<base::ListValue> list(new base::ListValue()); |
329 list->Append(transport_socket_pool_->GetInfoAsValue("transport_socket_pool", | 330 list->Append(transport_socket_pool_->GetInfoAsValue("transport_socket_pool", |
330 "transport_socket_pool", | 331 "transport_socket_pool", |
331 false)); | 332 false)); |
332 // Third parameter is false because |ssl_socket_pool_| uses | 333 // Third parameter is false because |ssl_socket_pool_| uses |
333 // |transport_socket_pool_| internally, and do not want to add it a second | 334 // |transport_socket_pool_| internally, and do not want to add it a second |
334 // time. | 335 // time. |
335 list->Append(ssl_socket_pool_->GetInfoAsValue("ssl_socket_pool", | 336 list->Append(ssl_socket_pool_->GetInfoAsValue("ssl_socket_pool", |
336 "ssl_socket_pool", | 337 "ssl_socket_pool", |
337 false)); | 338 false)); |
338 AddSocketPoolsToList(list, | 339 AddSocketPoolsToList(list.get(), http_proxy_socket_pools_, |
339 http_proxy_socket_pools_, | 340 "http_proxy_socket_pool", true); |
340 "http_proxy_socket_pool", | 341 AddSocketPoolsToList(list.get(), socks_socket_pools_, "socks_socket_pool", |
341 true); | |
342 AddSocketPoolsToList(list, | |
343 socks_socket_pools_, | |
344 "socks_socket_pool", | |
345 true); | 342 true); |
346 | 343 |
347 // Third parameter is false because |ssl_socket_pools_for_proxies_| use | 344 // Third parameter is false because |ssl_socket_pools_for_proxies_| use |
348 // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. | 345 // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. |
349 AddSocketPoolsToList(list, | 346 AddSocketPoolsToList(list.get(), ssl_socket_pools_for_proxies_, |
350 ssl_socket_pools_for_proxies_, | 347 "ssl_socket_pool_for_proxies", false); |
351 "ssl_socket_pool_for_proxies", | 348 return list.Pass(); |
352 false); | |
353 return list; | |
354 } | 349 } |
355 | 350 |
356 void ClientSocketPoolManagerImpl::OnCertAdded(const X509Certificate* cert) { | 351 void ClientSocketPoolManagerImpl::OnCertAdded(const X509Certificate* cert) { |
357 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); | 352 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); |
358 } | 353 } |
359 | 354 |
360 void ClientSocketPoolManagerImpl::OnCACertChanged( | 355 void ClientSocketPoolManagerImpl::OnCACertChanged( |
361 const X509Certificate* cert) { | 356 const X509Certificate* cert) { |
362 // We should flush the socket pools if we removed trust from a | 357 // We should flush the socket pools if we removed trust from a |
363 // cert, because a previously trusted server may have become | 358 // cert, because a previously trusted server may have become |
364 // untrusted. | 359 // untrusted. |
365 // | 360 // |
366 // We should not flush the socket pools if we added trust to a | 361 // We should not flush the socket pools if we added trust to a |
367 // cert. | 362 // cert. |
368 // | 363 // |
369 // Since the OnCACertChanged method doesn't tell us what | 364 // Since the OnCACertChanged method doesn't tell us what |
370 // kind of change it is, we have to flush the socket | 365 // kind of change it is, we have to flush the socket |
371 // pools to be safe. | 366 // pools to be safe. |
372 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); | 367 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); |
373 } | 368 } |
374 | 369 |
375 } // namespace net | 370 } // namespace net |
OLD | NEW |