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

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

Issue 398753004: [cros] Move User class to user_manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months 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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" 16 #include "chrome/browser/chromeos/policy/network_configuration_updater.h"
17 #include "components/keyed_service/core/keyed_service.h" 17 #include "components/keyed_service/core/keyed_service.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 20
21 class Profile; 21 class Profile;
22 22
23 namespace base { 23 namespace base {
24 class ListValue; 24 class ListValue;
25 } 25 }
26 26
27 namespace user_manager {
28 class User;
29 }
30
27 namespace chromeos { 31 namespace chromeos {
28 class User;
29 32
30 namespace onc { 33 namespace onc {
31 class CertificateImporter; 34 class CertificateImporter;
32 } 35 }
33 } 36 }
34 37
35 namespace net { 38 namespace net {
36 class NSSCertDatabase; 39 class NSSCertDatabase;
37 class X509Certificate; 40 class X509Certificate;
38 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; 41 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
(...skipping 21 matching lines...) Expand all
60 virtual ~UserNetworkConfigurationUpdater(); 63 virtual ~UserNetworkConfigurationUpdater();
61 64
62 // Creates an updater that applies the ONC user policy from |policy_service| 65 // Creates an updater that applies the ONC user policy from |policy_service|
63 // for user |user| once the policy service is completely initialized and on 66 // for user |user| once the policy service is completely initialized and on
64 // each policy change. Imported certificates, that request it, are only 67 // each policy change. Imported certificates, that request it, are only
65 // granted Web trust if |allow_trusted_certs_from_policy| is true. A reference 68 // granted Web trust if |allow_trusted_certs_from_policy| is true. A reference
66 // to |user| is stored. It must outlive the returned updater. 69 // to |user| is stored. It must outlive the returned updater.
67 static scoped_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy( 70 static scoped_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy(
68 Profile* profile, 71 Profile* profile,
69 bool allow_trusted_certs_from_policy, 72 bool allow_trusted_certs_from_policy,
70 const chromeos::User& user, 73 const user_manager::User& user,
71 PolicyService* policy_service, 74 PolicyService* policy_service,
72 chromeos::ManagedNetworkConfigurationHandler* network_config_handler); 75 chromeos::ManagedNetworkConfigurationHandler* network_config_handler);
73 76
74 void AddTrustedCertsObserver(WebTrustedCertsObserver* observer); 77 void AddTrustedCertsObserver(WebTrustedCertsObserver* observer);
75 void RemoveTrustedCertsObserver(WebTrustedCertsObserver* observer); 78 void RemoveTrustedCertsObserver(WebTrustedCertsObserver* observer);
76 79
77 // Sets |certs| to the list of Web trusted server and CA certificates from the 80 // Sets |certs| to the list of Web trusted server and CA certificates from the
78 // last received policy. 81 // last received policy.
79 void GetWebTrustedCertificates(net::CertificateList* certs) const; 82 void GetWebTrustedCertificates(net::CertificateList* certs) const;
80 83
81 // Helper method to expose |SetCertificateImporter| for usage in tests. 84 // Helper method to expose |SetCertificateImporter| for usage in tests.
82 void SetCertificateImporterForTest( 85 void SetCertificateImporterForTest(
83 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer); 86 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer);
84 87
85 private: 88 private:
86 class CrosTrustAnchorProvider; 89 class CrosTrustAnchorProvider;
87 90
88 UserNetworkConfigurationUpdater( 91 UserNetworkConfigurationUpdater(
89 Profile* profile, 92 Profile* profile,
90 bool allow_trusted_certs_from_policy, 93 bool allow_trusted_certs_from_policy,
91 const chromeos::User& user, 94 const user_manager::User& user,
92 PolicyService* policy_service, 95 PolicyService* policy_service,
93 chromeos::ManagedNetworkConfigurationHandler* network_config_handler); 96 chromeos::ManagedNetworkConfigurationHandler* network_config_handler);
94 97
95 // NetworkConfigurationUpdater: 98 // NetworkConfigurationUpdater:
96 virtual void ImportCertificates( 99 virtual void ImportCertificates(
97 const base::ListValue& certificates_onc) OVERRIDE; 100 const base::ListValue& certificates_onc) OVERRIDE;
98 virtual void ApplyNetworkPolicy( 101 virtual void ApplyNetworkPolicy(
99 base::ListValue* network_configs_onc, 102 base::ListValue* network_configs_onc,
100 base::DictionaryValue* global_network_config) OVERRIDE; 103 base::DictionaryValue* global_network_config) OVERRIDE;
101 104
(...skipping 11 matching lines...) Expand all
113 // policies. If there is |pending_certificates_onc_|, it gets imported. 116 // policies. If there is |pending_certificates_onc_|, it gets imported.
114 void SetCertificateImporter( 117 void SetCertificateImporter(
115 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer); 118 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer);
116 119
117 void NotifyTrustAnchorsChanged(); 120 void NotifyTrustAnchorsChanged();
118 121
119 // Whether Web trust is allowed or not. 122 // Whether Web trust is allowed or not.
120 bool allow_trusted_certificates_from_policy_; 123 bool allow_trusted_certificates_from_policy_;
121 124
122 // The user for whom the user policy will be applied. 125 // The user for whom the user policy will be applied.
123 const chromeos::User* user_; 126 const user_manager::User* user_;
124 127
125 ObserverList<WebTrustedCertsObserver, true> observer_list_; 128 ObserverList<WebTrustedCertsObserver, true> observer_list_;
126 129
127 // Contains the certificates of the last import that requested web trust. Must 130 // Contains the certificates of the last import that requested web trust. Must
128 // be empty if Web trust from policy is not allowed. 131 // be empty if Web trust from policy is not allowed.
129 net::CertificateList web_trust_certs_; 132 net::CertificateList web_trust_certs_;
130 133
131 // If |ImportCertificates| is called before |SetCertificateImporter|, gets set 134 // If |ImportCertificates| is called before |SetCertificateImporter|, gets set
132 // to a copy of the policy for which the import was requested. 135 // to a copy of the policy for which the import was requested.
133 // The policy will be processed when the certificate importer is set. 136 // The policy will be processed when the certificate importer is set.
134 scoped_ptr<base::ListValue> pending_certificates_onc_; 137 scoped_ptr<base::ListValue> pending_certificates_onc_;
135 138
136 // Certificate importer to be used for importing policy defined certificates. 139 // Certificate importer to be used for importing policy defined certificates.
137 // Set by |SetCertificateImporter|. 140 // Set by |SetCertificateImporter|.
138 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer_; 141 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer_;
139 142
140 content::NotificationRegistrar registrar_; 143 content::NotificationRegistrar registrar_;
141 144
142 base::WeakPtrFactory<UserNetworkConfigurationUpdater> weak_factory_; 145 base::WeakPtrFactory<UserNetworkConfigurationUpdater> weak_factory_;
143 146
144 DISALLOW_COPY_AND_ASSIGN(UserNetworkConfigurationUpdater); 147 DISALLOW_COPY_AND_ASSIGN(UserNetworkConfigurationUpdater);
145 }; 148 };
146 149
147 } // namespace policy 150 } // namespace policy
148 151
149 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_ 152 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_NETWORK_CONFIGURATION_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698