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