| 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/base/ssl_config_service.h" | 9 #include "net/base/ssl_config_service.h" |
| 10 #include "net/http/http_proxy_client_socket_pool.h" | 10 #include "net/http/http_proxy_client_socket_pool.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 NULL /* no http proxy */, | 76 NULL /* no http proxy */, |
| 77 ssl_config_service, | 77 ssl_config_service, |
| 78 net_log)), | 78 net_log)), |
| 79 transport_for_socks_pool_histograms_("TCPforSOCKS"), | 79 transport_for_socks_pool_histograms_("TCPforSOCKS"), |
| 80 socks_pool_histograms_("SOCK"), | 80 socks_pool_histograms_("SOCK"), |
| 81 transport_for_http_proxy_pool_histograms_("TCPforHTTPProxy"), | 81 transport_for_http_proxy_pool_histograms_("TCPforHTTPProxy"), |
| 82 transport_for_https_proxy_pool_histograms_("TCPforHTTPSProxy"), | 82 transport_for_https_proxy_pool_histograms_("TCPforHTTPSProxy"), |
| 83 ssl_for_https_proxy_pool_histograms_("SSLforHTTPSProxy"), | 83 ssl_for_https_proxy_pool_histograms_("SSLforHTTPSProxy"), |
| 84 http_proxy_pool_histograms_("HTTPProxy"), | 84 http_proxy_pool_histograms_("HTTPProxy"), |
| 85 ssl_socket_pool_for_proxies_histograms_("SSLForProxies") { | 85 ssl_socket_pool_for_proxies_histograms_("SSLForProxies") { |
| 86 CertDatabase::AddObserver(this); | 86 CertDatabase cert_db; |
| 87 cert_db.AddObserver(this); |
| 87 } | 88 } |
| 88 | 89 |
| 89 ClientSocketPoolManagerImpl::~ClientSocketPoolManagerImpl() { | 90 ClientSocketPoolManagerImpl::~ClientSocketPoolManagerImpl() { |
| 90 CertDatabase::RemoveObserver(this); | 91 CertDatabase cert_db; |
| 92 cert_db.RemoveObserver(this); |
| 91 } | 93 } |
| 92 | 94 |
| 93 void ClientSocketPoolManagerImpl::FlushSocketPools() { | 95 void ClientSocketPoolManagerImpl::FlushSocketPools() { |
| 94 // Flush the highest level pools first, since higher level pools may release | 96 // Flush the highest level pools first, since higher level pools may release |
| 95 // stuff to the lower level pools. | 97 // stuff to the lower level pools. |
| 96 | 98 |
| 97 for (SSLSocketPoolMap::const_iterator it = | 99 for (SSLSocketPoolMap::const_iterator it = |
| 98 ssl_socket_pools_for_proxies_.begin(); | 100 ssl_socket_pools_for_proxies_.begin(); |
| 99 it != ssl_socket_pools_for_proxies_.end(); | 101 it != ssl_socket_pools_for_proxies_.end(); |
| 100 ++it) | 102 ++it) |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 366 |
| 365 // Third parameter is false because |ssl_socket_pools_for_proxies_| use | 367 // Third parameter is false because |ssl_socket_pools_for_proxies_| use |
| 366 // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. | 368 // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. |
| 367 AddSocketPoolsToList(list, | 369 AddSocketPoolsToList(list, |
| 368 ssl_socket_pools_for_proxies_, | 370 ssl_socket_pools_for_proxies_, |
| 369 "ssl_socket_pool_for_proxies", | 371 "ssl_socket_pool_for_proxies", |
| 370 false); | 372 false); |
| 371 return list; | 373 return list; |
| 372 } | 374 } |
| 373 | 375 |
| 374 void ClientSocketPoolManagerImpl::OnUserCertAdded(const X509Certificate* cert) { | 376 void ClientSocketPoolManagerImpl::OnCertAdded(const X509Certificate* cert) { |
| 375 FlushSocketPools(); | 377 FlushSocketPools(); |
| 376 } | 378 } |
| 377 | 379 |
| 378 void ClientSocketPoolManagerImpl::OnCertTrustChanged( | 380 void ClientSocketPoolManagerImpl::OnCertTrustChanged( |
| 379 const X509Certificate* cert) { | 381 const X509Certificate* cert) { |
| 380 // We should flush the socket pools if we removed trust from a | 382 // We should flush the socket pools if we removed trust from a |
| 381 // cert, because a previously trusted server may have become | 383 // cert, because a previously trusted server may have become |
| 382 // untrusted. | 384 // untrusted. |
| 383 // | 385 // |
| 384 // We should not flush the socket pools if we added trust to a | 386 // We should not flush the socket pools if we added trust to a |
| 385 // cert. | 387 // cert. |
| 386 // | 388 // |
| 387 // Since the OnCertTrustChanged method doesn't tell us what | 389 // Since the OnCertTrustChanged method doesn't tell us what |
| 388 // kind of trust change it is, we have to flush the socket | 390 // kind of trust change it is, we have to flush the socket |
| 389 // pools to be safe. | 391 // pools to be safe. |
| 390 FlushSocketPools(); | 392 FlushSocketPools(); |
| 391 } | 393 } |
| 392 | 394 |
| 393 } // namespace net | 395 } // namespace net |
| OLD | NEW |