| 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/callback.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 15 |
| 16 class PrefService; |
| 17 |
| 18 namespace chromeos { |
| 19 class User; |
| 20 } |
| 21 |
| 22 namespace net { |
| 23 class X509Certificate; |
| 24 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
| 25 } |
| 26 |
| 27 namespace policy { |
| 28 |
| 29 class PolicyCertVerifier; |
| 30 class PolicyService; |
| 31 class UserNetworkConfigurationUpdater; |
| 32 |
| 33 // This service manages the per-Profile network policy components, this includes |
| 34 // certificates. |
| 35 class NetworkPolicyService : public BrowserContextKeyedService { |
| 36 public: |
| 37 NetworkPolicyService(bool allow_trusted_certs_from_policy, |
| 38 const chromeos::User& user, |
| 39 PrefService* user_prefs, |
| 40 PolicyService* policy_service); |
| 41 virtual ~NetworkPolicyService(); |
| 42 |
| 43 // Adds a CertVerifier on which the current list of Web trusted server and |
| 44 // CA certificates will be set. Policy updates will trigger further calls to |
| 45 // |cert_verifier| later. |cert_verifier| must be valid until it's removed |
| 46 // with RemovePolicyCertVerifier. Calls to |cert_verifier| will happen on the |
| 47 // IO thread. This function must be called on the UI thread. |
| 48 void AddPolicyCertVerifier(PolicyCertVerifier* cert_verifier); |
| 49 |
| 50 // Removes |cert_verifier| from further notifications. |
| 51 void RemovePolicyCertVerifier(PolicyCertVerifier* cert_verifier); |
| 52 |
| 53 // Returns a callback that should be called if a policy installed certificate |
| 54 // was trusted for the associated profile. Must not be called after this |
| 55 // object is destructed. |
| 56 base::Closure GetPolicyCertTrustedCallback(); |
| 57 |
| 58 // Sets |certs| to the list of Web trusted server and CA certificates from the |
| 59 // last received ONC user policy. |
| 60 void GetWebTrustedCertificates(net::CertificateList* certs) const; |
| 61 |
| 62 // Returns true if the profile with |user_prefs| has used certificates |
| 63 // installed via policy to establish a secure connection before. This means |
| 64 // that it may have cached content from an untrusted source. |
| 65 bool UsedPolicyCertificates() const; |
| 66 |
| 67 // BrowserContextKeyedService: |
| 68 virtual void Shutdown() OVERRIDE; |
| 69 |
| 70 private: |
| 71 void SetUsedPolicyCertificatesOnce(); |
| 72 |
| 73 PrefService* user_prefs_; |
| 74 scoped_ptr<UserNetworkConfigurationUpdater> network_configuration_updater_; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(NetworkPolicyService); |
| 77 }; |
| 78 |
| 79 } // namespace policy |
| 80 |
| 81 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_ |
| OLD | NEW |