OLD | NEW |
1 // Copyright (c) 2006-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_WIN_H_ | 5 #ifndef NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ |
6 #define NET_BASE_SSL_CONFIG_SERVICE_WIN_H_ | 6 #define NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ |
7 | |
8 #include <set> | |
9 | 7 |
10 #include "base/time.h" | 8 #include "base/time.h" |
11 #include "net/base/ssl_config_service.h" | 9 #include "net/base/ssl_config_service.h" |
12 | 10 |
13 namespace net { | 11 namespace net { |
14 | 12 |
15 // 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 |
16 // Windows. | 14 // Mac OS X. |
17 // | 15 class SSLConfigServiceMac : public SSLConfigService { |
18 // We think the SSL configuration settings should apply to all applications | |
19 // used by the user. We consider IE's Internet Options as the de facto | |
20 // system-wide network configuration settings, so we just use the values | |
21 // from IE's Internet Settings registry key. | |
22 class SSLConfigServiceWin : public SSLConfigService { | |
23 public: | 16 public: |
24 SSLConfigServiceWin(); | 17 SSLConfigServiceMac(); |
25 explicit SSLConfigServiceWin(base::TimeTicks now); // Used for testing. | 18 explicit SSLConfigServiceMac(base::TimeTicks now); // Used for testing. |
26 virtual ~SSLConfigServiceWin() {} | 19 virtual ~SSLConfigServiceMac() {} |
27 | 20 |
28 // Get the current SSL configuration settings. Can be called on any | 21 // Get the current SSL configuration settings. Can be called on any |
29 // thread. | 22 // thread. |
30 static bool GetSSLConfigNow(SSLConfig* config); | 23 static bool GetSSLConfigNow(SSLConfig* config); |
31 | 24 |
32 // Setters. Can be called on any thread. | 25 // Setters. Can be called on any thread. |
33 static void SetRevCheckingEnabled(bool enabled); | 26 static void SetRevCheckingEnabled(bool enabled); |
34 static void SetSSL2Enabled(bool enabled); | 27 static void SetSSL2Enabled(bool enabled); |
| 28 static void SetSSL3Enabled(bool enabled); |
| 29 static void SetTLS1Enabled(bool enabled); |
35 | 30 |
36 // Get the (cached) SSL configuration settings that are fresh within 10 | 31 // Get the (cached) SSL configuration settings that are fresh within 10 |
37 // seconds. This is cheaper than GetSSLConfigNow and is suitable when | 32 // seconds. This is cheaper than GetSSLConfigNow and is suitable when |
38 // we don't need the absolutely current configuration settings. This | 33 // we don't need the absolutely current configuration settings. This |
39 // method is not thread-safe, so it must be called on the same thread. | 34 // method is not thread-safe, so it must be called on the same thread. |
40 void GetSSLConfig(SSLConfig* config) { | 35 void GetSSLConfig(SSLConfig* config) { |
41 GetSSLConfigAt(config, base::TimeTicks::Now()); | 36 GetSSLConfigAt(config, base::TimeTicks::Now()); |
42 } | 37 } |
43 | 38 |
44 // Used for testing. | 39 // Used for testing. |
45 void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); | 40 void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); |
46 | 41 |
47 private: | 42 private: |
48 void UpdateConfig(base::TimeTicks now); | 43 void UpdateConfig(base::TimeTicks now); |
49 | 44 |
50 // We store the IE SSL config and the time that we fetched it. | 45 // We store the system SSL config and the time that we fetched it. |
51 SSLConfig config_info_; | 46 SSLConfig config_info_; |
52 base::TimeTicks config_time_; | 47 base::TimeTicks config_time_; |
53 bool ever_updated_; | 48 bool ever_updated_; |
54 | 49 |
55 DISALLOW_EVIL_CONSTRUCTORS(SSLConfigServiceWin); | 50 DISALLOW_EVIL_CONSTRUCTORS(SSLConfigServiceMac); |
56 }; | 51 }; |
57 | 52 |
58 } // namespace net | 53 } // namespace net |
59 | 54 |
60 #endif // NET_BASE_SSL_CONFIG_SERVICE_WIN_H_ | 55 #endif // NET_BASE_SSL_CONFIG_SERVICE_MAC_H_ |
OLD | NEW |