OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ | 5 #ifndef NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ |
6 #define NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ | 6 #define NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ |
7 | 7 |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "net/base/ssl_config_service.h" | 9 #include "net/base/ssl_config_service.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 // This class is responsible for getting and setting the SSL configuration on | 13 // This class is responsible for getting and setting the SSL configuration on |
14 // Mac OS X. | 14 // Mac OS X. |
15 class SSLConfigServiceMac : public SSLConfigService { | 15 class SSLConfigServiceMac : public SSLConfigService { |
16 public: | 16 public: |
17 SSLConfigServiceMac(); | 17 SSLConfigServiceMac(); |
18 explicit SSLConfigServiceMac(base::TimeTicks now); // Used for testing. | 18 explicit SSLConfigServiceMac(base::TimeTicks now); // Used for testing. |
19 virtual ~SSLConfigServiceMac() {} | |
20 | 19 |
21 // Get the current SSL configuration settings. Can be called on any | 20 // Get the current SSL configuration settings. Can be called on any |
22 // thread. | 21 // thread. |
23 static bool GetSSLConfigNow(SSLConfig* config); | 22 static bool GetSSLConfigNow(SSLConfig* config); |
24 | 23 |
25 // Setters. Can be called on any thread. | 24 // Setters. Can be called on any thread. |
26 static void SetRevCheckingEnabled(bool enabled); | 25 static void SetRevCheckingEnabled(bool enabled); |
27 static void SetSSL2Enabled(bool enabled); | 26 static void SetSSL2Enabled(bool enabled); |
28 static void SetSSL3Enabled(bool enabled); | 27 static void SetSSL3Enabled(bool enabled); |
29 static void SetTLS1Enabled(bool enabled); | 28 static void SetTLS1Enabled(bool enabled); |
30 | 29 |
31 // Get the (cached) SSL configuration settings that are fresh within 10 | 30 // Get the (cached) SSL configuration settings that are fresh within 10 |
32 // seconds. This is cheaper than GetSSLConfigNow and is suitable when | 31 // seconds. This is cheaper than GetSSLConfigNow and is suitable when |
33 // we don't need the absolutely current configuration settings. This | 32 // we don't need the absolutely current configuration settings. This |
34 // method is not thread-safe, so it must be called on the same thread. | 33 // method is not thread-safe, so it must be called on the same thread. |
35 void GetSSLConfig(SSLConfig* config) { | 34 void GetSSLConfig(SSLConfig* config) { |
36 GetSSLConfigAt(config, base::TimeTicks::Now()); | 35 GetSSLConfigAt(config, base::TimeTicks::Now()); |
37 } | 36 } |
38 | 37 |
39 // Used for testing. | 38 // Used for testing. |
40 void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); | 39 void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); |
41 | 40 |
42 private: | 41 private: |
| 42 virtual ~SSLConfigServiceMac() {} |
| 43 |
43 void UpdateConfig(base::TimeTicks now); | 44 void UpdateConfig(base::TimeTicks now); |
44 | 45 |
45 // We store the system SSL config and the time that we fetched it. | 46 // We store the system SSL config and the time that we fetched it. |
46 SSLConfig config_info_; | 47 SSLConfig config_info_; |
47 base::TimeTicks config_time_; | 48 base::TimeTicks config_time_; |
48 bool ever_updated_; | 49 bool ever_updated_; |
49 | 50 |
50 DISALLOW_EVIL_CONSTRUCTORS(SSLConfigServiceMac); | 51 DISALLOW_EVIL_CONSTRUCTORS(SSLConfigServiceMac); |
51 }; | 52 }; |
52 | 53 |
53 } // namespace net | 54 } // namespace net |
54 | 55 |
55 #endif // NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ | 56 #endif // NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ |
OLD | NEW |