OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h" | |
15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" | |
16 | |
17 class PrefService; | |
18 | |
19 namespace chromeos { | |
20 class User; | |
Joao da Silva
2013/11/11 12:38:19
not used
pneubeck (no reviews)
2013/11/12 10:07:53
Done.
| |
21 } | |
22 | |
23 namespace net { | |
24 class X509Certificate; | |
25 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | |
Joao da Silva
2013/11/11 12:38:19
#include ref_counted.h
pneubeck (no reviews)
2013/11/12 10:07:53
Done.
| |
26 } | |
27 | |
28 namespace policy { | |
29 | |
30 class PolicyCertVerifier; | |
31 class PolicyService; | |
Joao da Silva
2013/11/11 12:38:19
not used
pneubeck (no reviews)
2013/11/12 10:07:53
Done.
| |
32 | |
33 // This service is the counterpart of PolicyCertVerifier on the UI thread. It's | |
34 // responsible for pushing the current list of trust anchors to the CertVerifier | |
35 // and marking the profile's prefs if any of the trust anchors was used. | |
36 // Except for unit tests, PolicyCertVerifier should only be created through this | |
37 // class. | |
38 class NetworkPolicyService | |
39 : public BrowserContextKeyedService, | |
40 public UserNetworkConfigurationUpdater::WebTrustedCertsObserver { | |
41 public: | |
42 NetworkPolicyService(UserNetworkConfigurationUpdater* net_conf_updater, | |
43 PrefService* user_prefs); | |
44 virtual ~NetworkPolicyService(); | |
45 | |
46 // Creates an associated PolicyCertVerifier. The returned object must only be | |
47 // used on the IO thread and must outlive this object. | |
48 scoped_ptr<PolicyCertVerifier> CreatePolicyCertVerifier(); | |
49 | |
50 // Returns true if the profile with |user_prefs| has used certificates | |
51 // installed via policy to establish a secure connection before. This means | |
52 // that it may have cached content from an untrusted source. | |
53 bool UsedPolicyCertificates() const; | |
54 | |
55 // UserNetworkConfigurationUpdater::WebTrustedCertsObserver: | |
56 virtual void OnTrustAnchorsChanged(const net::CertificateList& trust_anchors) | |
57 OVERRIDE; | |
58 | |
59 // BrowserContextKeyedService: | |
60 virtual void Shutdown() OVERRIDE; | |
61 | |
62 private: | |
63 void SetUsedPolicyCertificatesOnce(); | |
64 | |
65 PolicyCertVerifier* cert_verifier_; | |
66 UserNetworkConfigurationUpdater* net_conf_updater_; | |
67 PrefService* user_prefs_; | |
68 | |
69 // Weak pointers to handle callbacks from PolicyCertVerifier on the IO thread. | |
70 // The factory and the created WeakPtrs must only be used on the UI thread. | |
71 base::WeakPtrFactory<NetworkPolicyService> weak_ptr_factory_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(NetworkPolicyService); | |
74 }; | |
75 | |
76 } // namespace policy | |
77 | |
78 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_ | |
OLD | NEW |