Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/chromeos/policy/user_network_configuration_updater.h

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed another bug for OTRProfile. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_USER_NETWORK_CONFIGURATION_UPDATER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_
7 7
8 #include <set>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" 15 #include "chrome/browser/chromeos/policy/network_configuration_updater.h"
15 16
16 namespace chromeos { 17 namespace chromeos {
17 class User; 18 class User;
(...skipping 22 matching lines...) Expand all
40 // each policy change. Imported certificates, that request it, are only 41 // each policy change. Imported certificates, that request it, are only
41 // granted Web trust if |allow_trusted_certs_from_policy| is true. A reference 42 // granted Web trust if |allow_trusted_certs_from_policy| is true. A reference
42 // to |user| is stored. It must outlive the returned updater. 43 // to |user| is stored. It must outlive the returned updater.
43 static scoped_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy( 44 static scoped_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy(
44 bool allow_trusted_certs_from_policy, 45 bool allow_trusted_certs_from_policy,
45 const chromeos::User& user, 46 const chromeos::User& user,
46 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer, 47 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
47 PolicyService* policy_service, 48 PolicyService* policy_service,
48 chromeos::ManagedNetworkConfigurationHandler* network_config_handler); 49 chromeos::ManagedNetworkConfigurationHandler* network_config_handler);
49 50
50 // Sets the CertVerifier on which the current list of Web trusted server and 51 // Adds a CertVerifier on which the current list of Web trusted server and
51 // CA certificates will be set. Policy updates will trigger further calls to 52 // CA certificates will be set. Policy updates will trigger further calls to
52 // |cert_verifier| later. |cert_verifier| must be valid until 53 // |cert_verifier| later. |cert_verifier| must be valid until it's removed
53 // SetPolicyCertVerifier is called again (with another CertVerifier or NULL) 54 // with RemovePolicyCertVerifier. Calls to |cert_verifier| will happen on the
54 // or until this Updater is destructed. |cert_verifier|'s methods are only 55 // IO thread. This function must be called on the UI thread.
55 // called on the IO thread. This function must be called on the UI thread. 56 void AddPolicyCertVerifier(PolicyCertVerifier* cert_verifier);
56 void SetPolicyCertVerifier(PolicyCertVerifier* cert_verifier); 57
58 // Removes |cert_verifier| from further notifications.
59 void RemovePolicyCertVerifier(PolicyCertVerifier* cert_verifier);
57 60
58 // Sets |certs| to the list of Web trusted server and CA certificates from the 61 // Sets |certs| to the list of Web trusted server and CA certificates from the
59 // last received policy. 62 // last received policy.
60 void GetWebTrustedCertificates(net::CertificateList* certs) const; 63 void GetWebTrustedCertificates(net::CertificateList* certs) const;
61 64
62 private: 65 private:
63 class CrosTrustAnchorProvider; 66 class CrosTrustAnchorProvider;
64 67
65 UserNetworkConfigurationUpdater( 68 UserNetworkConfigurationUpdater(
66 bool allow_trusted_certs_from_policy, 69 bool allow_trusted_certs_from_policy,
67 const chromeos::User& user, 70 const chromeos::User& user,
68 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer, 71 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
69 PolicyService* policy_service, 72 PolicyService* policy_service,
70 chromeos::ManagedNetworkConfigurationHandler* network_config_handler); 73 chromeos::ManagedNetworkConfigurationHandler* network_config_handler);
71 74
72 virtual void ImportCertificates( 75 virtual void ImportCertificates(
73 const base::ListValue& certificates_onc) OVERRIDE; 76 const base::ListValue& certificates_onc) OVERRIDE;
74 77
75 virtual void ApplyNetworkPolicy( 78 virtual void ApplyNetworkPolicy(
76 base::ListValue* network_configs_onc, 79 base::ListValue* network_configs_onc,
77 base::DictionaryValue* global_network_config) OVERRIDE; 80 base::DictionaryValue* global_network_config) OVERRIDE;
78 81
79 // Push |web_trust_certs_| to |cert_verifier_| if necessary. 82 // Push |web_trust_certs_| to |cert_verifiers_| if necessary.
80 void SetTrustAnchors(); 83 void SetTrustAnchors();
81 84
82 // Whether Web trust is allowed or not. Only relevant for user policies. 85 // Whether Web trust is allowed or not. Only relevant for user policies.
83 bool allow_trusted_certificates_from_policy_; 86 bool allow_trusted_certificates_from_policy_;
84 87
85 // The user for whom the user policy will be applied. Is NULL if this Updater 88 // The user for whom the user policy will be applied. Is NULL if this Updater
86 // is used for device policy. 89 // is used for device policy.
87 const chromeos::User* user_; 90 const chromeos::User* user_;
88 91
89 // Calls to this object are only allowed on the IO Thread. 92 // Calls to these objects are only allowed on the IO Thread.
90 PolicyCertVerifier* cert_verifier_; 93 std::set<PolicyCertVerifier*> cert_verifiers_;
91 94
92 // Contains the certificates of the last import that requested web trust. Must 95 // Contains the certificates of the last import that requested web trust. Must
93 // be empty if Web trust from policy is not allowed. 96 // be empty if Web trust from policy is not allowed.
94 net::CertificateList web_trust_certs_; 97 net::CertificateList web_trust_certs_;
95 98
96 DISALLOW_COPY_AND_ASSIGN(UserNetworkConfigurationUpdater); 99 DISALLOW_COPY_AND_ASSIGN(UserNetworkConfigurationUpdater);
97 }; 100 };
98 101
99 } // namespace policy 102 } // namespace policy
100 103
101 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_ 104 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698