| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_H__ | 5 #ifndef NET_BASE_SSL_CONFIG_SERVICE_H__ |
| 6 #define NET_BASE_SSL_CONFIG_SERVICE_H__ | 6 #define NET_BASE_SSL_CONFIG_SERVICE_H__ |
| 7 | 7 |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // This class is responsible for getting and setting the SSL configuration. | 28 // This class is responsible for getting and setting the SSL configuration. |
| 29 // | 29 // |
| 30 // We think the SSL configuration settings should apply to all applications | 30 // We think the SSL configuration settings should apply to all applications |
| 31 // used by the user. We consider IE's Internet Options as the de facto | 31 // used by the user. We consider IE's Internet Options as the de facto |
| 32 // system-wide network configuration settings, so we just use the values | 32 // system-wide network configuration settings, so we just use the values |
| 33 // from IE's Internet Settings registry key. | 33 // from IE's Internet Settings registry key. |
| 34 class SSLConfigService { | 34 class SSLConfigService { |
| 35 public: | 35 public: |
| 36 SSLConfigService(); | 36 SSLConfigService(); |
| 37 explicit SSLConfigService(TimeTicks now); // Used for testing. | 37 explicit SSLConfigService(base::TimeTicks now); // Used for testing. |
| 38 ~SSLConfigService() { } | 38 ~SSLConfigService() { } |
| 39 | 39 |
| 40 // Get the current SSL configuration settings. Can be called on any | 40 // Get the current SSL configuration settings. Can be called on any |
| 41 // thread. | 41 // thread. |
| 42 static bool GetSSLConfigNow(SSLConfig* config); | 42 static bool GetSSLConfigNow(SSLConfig* config); |
| 43 | 43 |
| 44 // Setters. Can be called on any thread. | 44 // Setters. Can be called on any thread. |
| 45 static void SetRevCheckingEnabled(bool enabled); | 45 static void SetRevCheckingEnabled(bool enabled); |
| 46 static void SetSSL2Enabled(bool enabled); | 46 static void SetSSL2Enabled(bool enabled); |
| 47 | 47 |
| 48 // Get the (cached) SSL configuration settings that are fresh within 10 | 48 // Get the (cached) SSL configuration settings that are fresh within 10 |
| 49 // seconds. This is cheaper than GetSSLConfigNow and is suitable when | 49 // seconds. This is cheaper than GetSSLConfigNow and is suitable when |
| 50 // we don't need the absolutely current configuration settings. This | 50 // we don't need the absolutely current configuration settings. This |
| 51 // method is not thread-safe, so it must be called on the same thread. | 51 // method is not thread-safe, so it must be called on the same thread. |
| 52 void GetSSLConfig(SSLConfig* config) { | 52 void GetSSLConfig(SSLConfig* config) { |
| 53 GetSSLConfigAt(config, TimeTicks::Now()); | 53 GetSSLConfigAt(config, base::TimeTicks::Now()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Used for testing. | 56 // Used for testing. |
| 57 void GetSSLConfigAt(SSLConfig* config, TimeTicks now); | 57 void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 void UpdateConfig(TimeTicks now); | 60 void UpdateConfig(base::TimeTicks now); |
| 61 | 61 |
| 62 // We store the IE SSL config and the time that we fetched it. | 62 // We store the IE SSL config and the time that we fetched it. |
| 63 SSLConfig config_info_; | 63 SSLConfig config_info_; |
| 64 TimeTicks config_time_; | 64 base::TimeTicks config_time_; |
| 65 | 65 |
| 66 DISALLOW_EVIL_CONSTRUCTORS(SSLConfigService); | 66 DISALLOW_EVIL_CONSTRUCTORS(SSLConfigService); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace net | 69 } // namespace net |
| 70 | 70 |
| 71 #endif // NET_BASE_SSL_CONFIG_SERVICE_H__ | 71 #endif // NET_BASE_SSL_CONFIG_SERVICE_H__ |
| 72 | 72 |
| OLD | NEW |