| 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::GetInstance()->AddObserver(this); |
| 87 } | 87 } |
| 88 | 88 |
| 89 ClientSocketPoolManagerImpl::~ClientSocketPoolManagerImpl() { | 89 ClientSocketPoolManagerImpl::~ClientSocketPoolManagerImpl() { |
| 90 CertDatabase::RemoveObserver(this); | 90 CertDatabase::GetInstance()->RemoveObserver(this); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void ClientSocketPoolManagerImpl::FlushSocketPools() { | 93 void ClientSocketPoolManagerImpl::FlushSocketPools() { |
| 94 // Flush the highest level pools first, since higher level pools may release | 94 // Flush the highest level pools first, since higher level pools may release |
| 95 // stuff to the lower level pools. | 95 // stuff to the lower level pools. |
| 96 | 96 |
| 97 for (SSLSocketPoolMap::const_iterator it = | 97 for (SSLSocketPoolMap::const_iterator it = |
| 98 ssl_socket_pools_for_proxies_.begin(); | 98 ssl_socket_pools_for_proxies_.begin(); |
| 99 it != ssl_socket_pools_for_proxies_.end(); | 99 it != ssl_socket_pools_for_proxies_.end(); |
| 100 ++it) | 100 ++it) |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 // Third parameter is false because |ssl_socket_pools_for_proxies_| use | 365 // Third parameter is false because |ssl_socket_pools_for_proxies_| use |
| 366 // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. | 366 // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. |
| 367 AddSocketPoolsToList(list, | 367 AddSocketPoolsToList(list, |
| 368 ssl_socket_pools_for_proxies_, | 368 ssl_socket_pools_for_proxies_, |
| 369 "ssl_socket_pool_for_proxies", | 369 "ssl_socket_pool_for_proxies", |
| 370 false); | 370 false); |
| 371 return list; | 371 return list; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void ClientSocketPoolManagerImpl::OnUserCertAdded(const X509Certificate* cert) { | 374 void ClientSocketPoolManagerImpl::OnCertAdded(const X509Certificate* cert) { |
| 375 FlushSocketPools(); | 375 FlushSocketPools(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void ClientSocketPoolManagerImpl::OnCertTrustChanged( | 378 void ClientSocketPoolManagerImpl::OnCertTrustChanged( |
| 379 const X509Certificate* cert) { | 379 const X509Certificate* cert) { |
| 380 // We should flush the socket pools if we removed trust from a | 380 // We should flush the socket pools if we removed trust from a |
| 381 // cert, because a previously trusted server may have become | 381 // cert, because a previously trusted server may have become |
| 382 // untrusted. | 382 // untrusted. |
| 383 // | 383 // |
| 384 // We should not flush the socket pools if we added trust to a | 384 // We should not flush the socket pools if we added trust to a |
| 385 // cert. | 385 // cert. |
| 386 // | 386 // |
| 387 // Since the OnCertTrustChanged method doesn't tell us what | 387 // Since the OnCertTrustChanged method doesn't tell us what |
| 388 // kind of trust change it is, we have to flush the socket | 388 // kind of trust change it is, we have to flush the socket |
| 389 // pools to be safe. | 389 // pools to be safe. |
| 390 FlushSocketPools(); | 390 FlushSocketPools(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace net | 393 } // namespace net |
| OLD | NEW |