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

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

Issue 148183013: Use per-user nssdb in onc certificate importer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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 (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 <string> 8 #include <string>
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/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "components/onc/onc_constants.h" 13 #include "components/onc/onc_constants.h"
14 #include "components/policy/core/common/policy_service.h" 14 #include "components/policy/core/common/policy_service.h"
15 15
16 namespace base { 16 namespace base {
17 class DictionaryValue; 17 class DictionaryValue;
18 class ListValue; 18 class ListValue;
19 class Value; 19 class Value;
20 } 20 }
21 21
22 namespace chromeos { 22 namespace chromeos {
23 class ManagedNetworkConfigurationHandler; 23 class ManagedNetworkConfigurationHandler;
24 24
25 namespace onc { 25 namespace onc {
26 class CertificateImporter; 26 class CertificateImporter;
27 } 27 }
28 } 28 }
29 29
30 namespace net {
31 class NSSCertDatabase;
32 }
33
30 namespace policy { 34 namespace policy {
31 35
32 class PolicyMap; 36 class PolicyMap;
33 37
34 // Implements the common part of tracking a OpenNetworkConfiguration device or 38 // Implements the common part of tracking a OpenNetworkConfiguration device or
35 // user policy. Pushes the network configs to the 39 // user policy. Pushes the network configs to the
36 // ManagedNetworkConfigurationHandler, which in turn writes configurations to 40 // ManagedNetworkConfigurationHandler, which in turn writes configurations to
37 // Shill. Certificates are imported with the chromeos::onc::CertificateImporter. 41 // Shill. Certificates are imported with the chromeos::onc::CertificateImporter.
38 // For user policies the subclass UserNetworkConfigurationUpdater must be used. 42 // For user policies the subclass UserNetworkConfigurationUpdater must be used.
39 // Does not handle proxy settings. 43 // Does not handle proxy settings.
40 class NetworkConfigurationUpdater : public PolicyService::Observer { 44 class NetworkConfigurationUpdater : public PolicyService::Observer {
41 public: 45 public:
42 virtual ~NetworkConfigurationUpdater(); 46 virtual ~NetworkConfigurationUpdater();
43 47
44 // PolicyService::Observer overrides 48 // PolicyService::Observer overrides
45 virtual void OnPolicyUpdated(const PolicyNamespace& ns, 49 virtual void OnPolicyUpdated(const PolicyNamespace& ns,
46 const PolicyMap& previous, 50 const PolicyMap& previous,
47 const PolicyMap& current) OVERRIDE; 51 const PolicyMap& current) OVERRIDE;
48 virtual void OnPolicyServiceInitialized(PolicyDomain domain) OVERRIDE; 52 virtual void OnPolicyServiceInitialized(PolicyDomain domain) OVERRIDE;
49 53
54 // Sets the database that should be used for importing certificates. It
55 // reapplies the policy if policy service is already initialized.
56 void SetCertDatabase(net::NSSCertDatabase* cert_database);
57
50 protected: 58 protected:
51 NetworkConfigurationUpdater( 59 NetworkConfigurationUpdater(
52 onc::ONCSource onc_source, 60 onc::ONCSource onc_source,
53 std::string policy_key, 61 std::string policy_key,
54 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer, 62 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
55 PolicyService* policy_service, 63 PolicyService* policy_service,
56 chromeos::ManagedNetworkConfigurationHandler* network_config_handler); 64 chromeos::ManagedNetworkConfigurationHandler* network_config_handler);
57 65
58 virtual void Init(); 66 virtual void Init();
59 67
60 // Imports the certificates part of the policy. 68 // Imports the certificates part of the policy.
61 virtual void ImportCertificates(const base::ListValue& certificates_onc) = 0; 69 virtual void ImportCertificates(const base::ListValue& certificates_onc,
70 net::NSSCertDatabase* target_nssdb) = 0;
62 71
63 // Pushes the network part of the policy to the 72 // Pushes the network part of the policy to the
64 // ManagedNetworkConfigurationHandler. This can be overridden by subclasses to 73 // ManagedNetworkConfigurationHandler. This can be overridden by subclasses to
65 // modify |network_configs_onc| before the actual application. 74 // modify |network_configs_onc| before the actual application.
66 virtual void ApplyNetworkPolicy( 75 virtual void ApplyNetworkPolicy(
67 base::ListValue* network_configs_onc, 76 base::ListValue* network_configs_onc,
68 base::DictionaryValue* global_network_config) = 0; 77 base::DictionaryValue* global_network_config) = 0;
69 78
70 onc::ONCSource onc_source_; 79 onc::ONCSource onc_source_;
71 80
(...skipping 12 matching lines...) Expand all
84 std::string LogHeader() const; 93 std::string LogHeader() const;
85 94
86 std::string policy_key_; 95 std::string policy_key_;
87 96
88 // Used to register for notifications from the |policy_service_|. 97 // Used to register for notifications from the |policy_service_|.
89 PolicyChangeRegistrar policy_change_registrar_; 98 PolicyChangeRegistrar policy_change_registrar_;
90 99
91 // Used to retrieve the policies. 100 // Used to retrieve the policies.
92 PolicyService* policy_service_; 101 PolicyService* policy_service_;
93 102
103 // Certificate database to which certificates specified in policy should be
104 // imported. If not set, |ImportCertificates| will not be called during
105 // |ApplyPolicy|.
106 net::NSSCertDatabase* cert_database_;
107
94 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); 108 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater);
95 }; 109 };
96 110
97 } // namespace policy 111 } // namespace policy
98 112
99 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ 113 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698