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

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

Issue 12676017: Adding policy support to the new network configuration stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. Created 7 years, 8 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_IMPL_CROS_H _
6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CROS_H _
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/chromeos/cros/network_constants.h" 10 #include "chrome/browser/chromeos/cros/network_constants.h"
11 #include "chrome/browser/chromeos/cros/network_library.h" 11 #include "chrome/browser/chromeos/cros/network_library.h"
12 #include "chrome/browser/chromeos/policy/network_configuration_updater.h"
12 #include "chrome/browser/policy/policy_service.h" 13 #include "chrome/browser/policy/policy_service.h"
13 #include "chromeos/network/network_ui_data.h" 14 #include "chromeos/network/network_ui_data.h"
14 #include "chromeos/network/onc/onc_constants.h" 15 #include "chromeos/network/onc/onc_constants.h"
15 16
16 namespace base { 17 namespace base {
17 class Value; 18 class Value;
18 } 19 }
19 20
20 namespace net {
21 class CertTrustAnchorProvider;
22 }
23
24 namespace policy { 21 namespace policy {
25 22
26 class PolicyMap; 23 class PolicyMap;
27 24
28 // Keeps track of the network configuration policy settings and Shill's 25 // DEPRECATED: will be replaced by NetworkConfigurationImpl.
29 // profiles. Requests the NetworkLibrary to apply the ONC of the network 26 // This implementation pushes policies through the NetworkLibrary. It applies
30 // policies every time one of the relevant policies or Shill's profiles changes 27 // network policies every time one of the relevant policies or Shill's profiles
31 // or OnUserPolicyInitialized() is called. If the user policy is available, 28 // changed or OnUserPolicyInitialized() is called. If the user policy is
32 // always both the device and the user policy are applied. Otherwise only the 29 // available, always both the device and the user policy are applied. Otherwise
33 // device policy is applied. 30 // only the device policy is applied.
34 class NetworkConfigurationUpdater 31 class NetworkConfigurationUpdaterImplCros
35 : public chromeos::NetworkLibrary::NetworkProfileObserver { 32 : public NetworkConfigurationUpdater,
33 public chromeos::NetworkLibrary::NetworkProfileObserver {
36 public: 34 public:
37 NetworkConfigurationUpdater(PolicyService* policy_service, 35 NetworkConfigurationUpdaterImplCros(
38 chromeos::NetworkLibrary* network_library); 36 PolicyService* policy_service,
39 virtual ~NetworkConfigurationUpdater(); 37 chromeos::NetworkLibrary* network_library);
38 virtual ~NetworkConfigurationUpdaterImplCros();
40 39
41 // NetworkProfileObserver overrides. 40 // NetworkProfileObserver overrides.
42 virtual void OnProfileListChanged() OVERRIDE; 41 virtual void OnProfileListChanged() OVERRIDE;
43 42
44 // Notifies this updater that the user policy is initialized. Before this 43 // NetworkConfigurationUpdater overrides.
45 // function is called, the user policy is not applied. Afterwards, always both
46 // device and user policy are applied as described in the class comment. This
47 // function also triggers an immediate policy application of both device and
48 // user policy.
49 void OnUserPolicyInitialized();
50 44
51 // Web trust isn't given to certificates imported from ONC by default. Setting 45 // In this implementation, this function applies both device and user policy.
52 // |allow| to true allows giving Web trust to the certificates that 46 virtual void OnUserPolicyInitialized() OVERRIDE;
53 // request it. 47 virtual void set_allow_trusted_certificates_from_policy(bool allow) OVERRIDE;
54 void set_allow_trusted_certificates_from_policy(bool allow) { 48 virtual net::CertTrustAnchorProvider* GetCertTrustAnchorProvider() OVERRIDE;
55 allow_trusted_certificates_from_policy_ = allow;
56 }
57
58 // Returns a CertTrustAnchorProvider that provides the list of server and
59 // CA certificates with the Web trust flag set that were retrieved from the
60 // last user ONC policy update.
61 // This getter must be used on the UI thread, and the provider must be used
62 // on the IO thread. It is only valid as long as the
63 // NetworkConfigurationUpdater is valid; the NetworkConfigurationUpdater
64 // outlives all the profiles, and deletes the provider on the IO thread.
65 net::CertTrustAnchorProvider* GetCertTrustAnchorProvider();
66 49
67 private: 50 private:
68 // Callback that's called by |policy_service_| if the respective ONC policy 51 // Callback that's called by |policy_service_| if the respective ONC policy
69 // changed. 52 // changed.
70 void OnPolicyChanged(chromeos::onc::ONCSource onc_source, 53 void OnPolicyChanged(chromeos::onc::ONCSource onc_source,
71 const base::Value* previous, 54 const base::Value* previous,
72 const base::Value* current); 55 const base::Value* current);
73 56
74 // Retrieves the ONC policies from |policy_service_| and pushes the 57 // Retrieves the ONC policies from |policy_service_| and pushes the
75 // configurations to |network_library_|. Ensures that a device policy is 58 // configurations to |network_library_|. Ensures that a device policy is
(...skipping 17 matching lines...) Expand all
93 // Whether Web trust is allowed or not. 76 // Whether Web trust is allowed or not.
94 bool allow_trusted_certificates_from_policy_; 77 bool allow_trusted_certificates_from_policy_;
95 78
96 // The policy service storing the ONC policies. 79 // The policy service storing the ONC policies.
97 PolicyService* policy_service_; 80 PolicyService* policy_service_;
98 81
99 // An implementation of CertTrustAnchorProvider. Owned by the updater, but 82 // An implementation of CertTrustAnchorProvider. Owned by the updater, but
100 // lives on the IO thread. 83 // lives on the IO thread.
101 net::CertTrustAnchorProvider* cert_trust_provider_; 84 net::CertTrustAnchorProvider* cert_trust_provider_;
102 85
103 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); 86 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdaterImplCros);
104 }; 87 };
105 88
106 } // namespace policy 89 } // namespace policy
107 90
108 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ 91 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CRO S_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698