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_factory.h" | 5 #include "net/socket/client_socket_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 DefaultClientSocketFactory() { | 26 DefaultClientSocketFactory() { |
27 CertDatabase::GetInstance()->AddObserver(this); | 27 CertDatabase::GetInstance()->AddObserver(this); |
28 } | 28 } |
29 | 29 |
30 ~DefaultClientSocketFactory() override { | 30 ~DefaultClientSocketFactory() override { |
31 // Note: This code never runs, as the factory is defined as a Leaky | 31 // Note: This code never runs, as the factory is defined as a Leaky |
32 // singleton. | 32 // singleton. |
33 CertDatabase::GetInstance()->RemoveObserver(this); | 33 CertDatabase::GetInstance()->RemoveObserver(this); |
34 } | 34 } |
35 | 35 |
36 void OnCertAdded(const X509Certificate* cert) override { | 36 void OnCertDBChanged(const X509Certificate* cert) override { |
| 37 // Flush sockets whenever CA trust changes. |
37 ClearSSLSessionCache(); | 38 ClearSSLSessionCache(); |
38 } | 39 } |
39 | 40 |
40 void OnCACertChanged(const X509Certificate* cert) override { | |
41 // Per wtc, we actually only need to flush when trust is reduced. | |
42 // Always flush now because OnCACertChanged does not tell us this. | |
43 // See comments in ClientSocketPoolManager::OnCACertChanged. | |
44 ClearSSLSessionCache(); | |
45 } | |
46 | |
47 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 41 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
48 DatagramSocket::BindType bind_type, | 42 DatagramSocket::BindType bind_type, |
49 const RandIntCallback& rand_int_cb, | 43 const RandIntCallback& rand_int_cb, |
50 NetLog* net_log, | 44 NetLog* net_log, |
51 const NetLog::Source& source) override { | 45 const NetLog::Source& source) override { |
52 return std::unique_ptr<DatagramClientSocket>( | 46 return std::unique_ptr<DatagramClientSocket>( |
53 new UDPClientSocket(bind_type, rand_int_cb, net_log, source)); | 47 new UDPClientSocket(bind_type, rand_int_cb, net_log, source)); |
54 } | 48 } |
55 | 49 |
56 std::unique_ptr<StreamSocket> CreateTransportClientSocket( | 50 std::unique_ptr<StreamSocket> CreateTransportClientSocket( |
(...skipping 21 matching lines...) Expand all Loading... |
78 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; | 72 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; |
79 | 73 |
80 } // namespace | 74 } // namespace |
81 | 75 |
82 // static | 76 // static |
83 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 77 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
84 return g_default_client_socket_factory.Pointer(); | 78 return g_default_client_socket_factory.Pointer(); |
85 } | 79 } |
86 | 80 |
87 } // namespace net | 81 } // namespace net |
OLD | NEW |