| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_SSL_SSL_CONFIG_SERVICE_H_ | |
| 6 #define NET_SSL_SSL_CONFIG_SERVICE_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/observer_list.h" | |
| 12 #include "net/base/net_export.h" | |
| 13 #include "net/cert/crl_set.h" | |
| 14 #include "net/cert/ct_ev_whitelist.h" | |
| 15 #include "net/ssl/ssl_config.h" | |
| 16 | |
| 17 class GURL; | |
| 18 | |
| 19 namespace net { | |
| 20 | |
| 21 // The interface for retrieving the SSL configuration. This interface | |
| 22 // does not cover setting the SSL configuration, as on some systems, the | |
| 23 // SSLConfigService objects may not have direct access to the configuration, or | |
| 24 // live longer than the configuration preferences. | |
| 25 class NET_EXPORT SSLConfigService | |
| 26 : public base::RefCountedThreadSafe<SSLConfigService> { | |
| 27 public: | |
| 28 // Observer is notified when SSL config settings have changed. | |
| 29 class NET_EXPORT Observer { | |
| 30 public: | |
| 31 // Notify observers if SSL settings have changed. We don't check all of the | |
| 32 // data in SSLConfig, just those that qualify as a user config change. | |
| 33 // The following settings are considered user changes: | |
| 34 // rev_checking_enabled | |
| 35 // version_min | |
| 36 // version_max | |
| 37 // disabled_cipher_suites | |
| 38 // channel_id_enabled | |
| 39 // false_start_enabled | |
| 40 // require_forward_secrecy | |
| 41 virtual void OnSSLConfigChanged() = 0; | |
| 42 | |
| 43 protected: | |
| 44 virtual ~Observer() {} | |
| 45 }; | |
| 46 | |
| 47 SSLConfigService(); | |
| 48 | |
| 49 // May not be thread-safe, should only be called on the IO thread. | |
| 50 virtual void GetSSLConfig(SSLConfig* config) = 0; | |
| 51 | |
| 52 // Sets and gets the current, global CRL set. | |
| 53 static void SetCRLSet(scoped_refptr<CRLSet> crl_set); | |
| 54 static scoped_refptr<CRLSet> GetCRLSet(); | |
| 55 | |
| 56 // Sets and gets the current, global EV certificates whitelist | |
| 57 static void SetEVCertsWhitelist( | |
| 58 scoped_refptr<ct::EVCertsWhitelist> ev_whitelist); | |
| 59 static scoped_refptr<ct::EVCertsWhitelist> GetEVCertsWhitelist(); | |
| 60 | |
| 61 // Add an observer of this service. | |
| 62 void AddObserver(Observer* observer); | |
| 63 | |
| 64 // Remove an observer of this service. | |
| 65 void RemoveObserver(Observer* observer); | |
| 66 | |
| 67 // Calls the OnSSLConfigChanged method of registered observers. Should only be | |
| 68 // called on the IO thread. | |
| 69 void NotifySSLConfigChange(); | |
| 70 | |
| 71 // Returns true if the |url| should use fastradio padding. | |
| 72 virtual bool SupportsFastradioPadding(const GURL& url); | |
| 73 | |
| 74 protected: | |
| 75 friend class base::RefCountedThreadSafe<SSLConfigService>; | |
| 76 | |
| 77 virtual ~SSLConfigService(); | |
| 78 | |
| 79 // Process before/after config update. | |
| 80 void ProcessConfigUpdate(const SSLConfig& orig_config, | |
| 81 const SSLConfig& new_config); | |
| 82 | |
| 83 private: | |
| 84 ObserverList<Observer> observer_list_; | |
| 85 }; | |
| 86 | |
| 87 } // namespace net | |
| 88 | |
| 89 #endif // NET_SSL_SSL_CONFIG_SERVICE_H_ | |
| OLD | NEW |