OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "net/cert/x509_certificate.h" | |
9 | 11 |
10 namespace net { | 12 namespace net { |
11 class CertTrustAnchorProvider; | 13 class CertTrustAnchorProvider; |
12 } | 14 } |
13 | 15 |
14 namespace policy { | 16 namespace policy { |
15 | 17 |
16 // Keeps track of the network configuration policy settings and pushes changes | 18 // Keeps track of the network configuration policy settings and pushes changes |
17 // to the respective configuration backend, which in turn writes configurations | 19 // to the respective configuration backend, which in turn writes configurations |
18 // to Shill. | 20 // to Shill. |
19 class NetworkConfigurationUpdater { | 21 class NetworkConfigurationUpdater { |
20 public: | 22 public: |
21 NetworkConfigurationUpdater() {} | 23 NetworkConfigurationUpdater(); |
22 virtual ~NetworkConfigurationUpdater() {} | 24 virtual ~NetworkConfigurationUpdater(); |
23 | 25 |
24 // Notifies this updater that the user policy is initialized. Before this | 26 // Notifies this updater that the user policy is initialized. Before this |
25 // function is called, the user policy is not applied. This function may | 27 // function is called, the user policy is not applied. This function may |
26 // trigger immediate policy applications. | 28 // trigger immediate policy applications. |
27 virtual void OnUserPolicyInitialized() = 0; | 29 virtual void OnUserPolicyInitialized() = 0; |
28 | 30 |
29 // TODO(pneubeck): Extract the following two certificate related functions | |
30 // into a separate CertificateUpdater. | |
31 | |
32 // Web trust isn't given to certificates imported from ONC by default. Setting | 31 // Web trust isn't given to certificates imported from ONC by default. Setting |
33 // |allow| to true allows giving Web trust to the certificates that | 32 // |allow| to true allows giving Web trust to the certificates that |
34 // request it. | 33 // request it. |
35 virtual void set_allow_trusted_certificates_from_policy(bool allow) = 0; | 34 void set_allow_trusted_certificates_from_policy(bool allow) { |
35 allow_trusted_certificates_from_policy_ = allow; | |
36 } | |
36 | 37 |
37 // Returns a CertTrustAnchorProvider that provides the list of server and | 38 // Returns a CertTrustAnchorProvider that provides the list of server and |
38 // CA certificates with the Web trust flag set that were retrieved from the | 39 // CA certificates with the Web trust flag set that were retrieved from the |
39 // last user ONC policy update. | 40 // last user ONC policy update. |
40 // This getter must be used on the UI thread, and the provider must be used | 41 // This getter must be used on the UI thread, and the provider must be used |
41 // on the IO thread. It is only valid as long as the | 42 // on the IO thread. It is only valid as long as the |
42 // NetworkConfigurationUpdater is valid; the NetworkConfigurationUpdater | 43 // NetworkConfigurationUpdater is valid; the NetworkConfigurationUpdater |
43 // outlives all the profiles, and deletes the provider on the IO thread. | 44 // outlives all the profiles, and deletes the provider on the IO thread. |
44 virtual net::CertTrustAnchorProvider* GetCertTrustAnchorProvider() = 0; | 45 net::CertTrustAnchorProvider* GetCertTrustAnchorProvider(); |
46 | |
47 protected: | |
48 void SetTrustAnchors(scoped_ptr<net::CertificateList> web_trust_certs); | |
45 | 49 |
46 private: | 50 private: |
51 // Whether Web trust is allowed or not. | |
52 bool allow_trusted_certificates_from_policy_; | |
53 | |
54 // An implementation of CertTrustAnchorProvider. Owned by the updater, but | |
stevenjb
2013/04/22 16:53:41
s/the updater/this class/ (It wasn't immediately c
pneubeck (no reviews)
2013/04/23 18:05:25
Done.
| |
55 // lives on the IO thread. | |
stevenjb
2013/04/22 16:53:41
s/lives/runs (and is deleted)/ (or something more
pneubeck (no reviews)
2013/04/23 18:05:25
Done.
| |
56 net::CertTrustAnchorProvider* cert_trust_provider_; | |
57 | |
47 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); | 58 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); |
48 }; | 59 }; |
49 | 60 |
50 } // namespace policy | 61 } // namespace policy |
51 | 62 |
52 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 63 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ |
OLD | NEW |