Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / net / ssl / ssl_config_service.h
blobdd3236d2a5811fda566e4c9ab7bc4322f3cb23a4
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.
5 #ifndef NET_SSL_SSL_CONFIG_SERVICE_H_
6 #define NET_SSL_SSL_CONFIG_SERVICE_H_
8 #include <vector>
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"
17 class GURL;
19 namespace net {
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;
43 protected:
44 virtual ~Observer() {}
47 SSLConfigService();
49 // May not be thread-safe, should only be called on the IO thread.
50 virtual void GetSSLConfig(SSLConfig* config) = 0;
52 // Sets and gets the current, global CRL set.
53 static void SetCRLSet(scoped_refptr<CRLSet> crl_set);
54 static scoped_refptr<CRLSet> GetCRLSet();
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();
61 // Add an observer of this service.
62 void AddObserver(Observer* observer);
64 // Remove an observer of this service.
65 void RemoveObserver(Observer* observer);
67 // Calls the OnSSLConfigChanged method of registered observers. Should only be
68 // called on the IO thread.
69 void NotifySSLConfigChange();
71 // Returns true if the |url| should use fastradio padding.
72 virtual bool SupportsFastradioPadding(const GURL& url);
74 protected:
75 friend class base::RefCountedThreadSafe<SSLConfigService>;
77 virtual ~SSLConfigService();
79 // Process before/after config update.
80 void ProcessConfigUpdate(const SSLConfig& orig_config,
81 const SSLConfig& new_config);
83 private:
84 ObserverList<Observer> observer_list_;
87 } // namespace net
89 #endif // NET_SSL_SSL_CONFIG_SERVICE_H_