| OLD | NEW |
| 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( |
| 54 void set_allow_trusted_certificates_from_policy(bool allow) { | 48 bool allow) OVERRIDE { |
| 55 allow_trusted_certificates_from_policy_ = allow; | 49 allow_trusted_certificates_from_policy_ = allow; |
| 56 } | 50 } |
| 57 | 51 virtual net::CertTrustAnchorProvider* GetCertTrustAnchorProvider() OVERRIDE; |
| 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 | 52 |
| 67 private: | 53 private: |
| 68 // Callback that's called by |policy_service_| if the respective ONC policy | 54 // Callback that's called by |policy_service_| if the respective ONC policy |
| 69 // changed. | 55 // changed. |
| 70 void OnPolicyChanged(chromeos::onc::ONCSource onc_source, | 56 void OnPolicyChanged(chromeos::onc::ONCSource onc_source, |
| 71 const base::Value* previous, | 57 const base::Value* previous, |
| 72 const base::Value* current); | 58 const base::Value* current); |
| 73 | 59 |
| 74 // Retrieves the ONC policies from |policy_service_| and pushes the | 60 // Retrieves the ONC policies from |policy_service_| and pushes the |
| 75 // configurations to |network_library_|. Ensures that a device policy is | 61 // configurations to |network_library_|. Ensures that a device policy is |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 // Whether Web trust is allowed or not. | 79 // Whether Web trust is allowed or not. |
| 94 bool allow_trusted_certificates_from_policy_; | 80 bool allow_trusted_certificates_from_policy_; |
| 95 | 81 |
| 96 // The policy service storing the ONC policies. | 82 // The policy service storing the ONC policies. |
| 97 PolicyService* policy_service_; | 83 PolicyService* policy_service_; |
| 98 | 84 |
| 99 // An implementation of CertTrustAnchorProvider. Owned by the updater, but | 85 // An implementation of CertTrustAnchorProvider. Owned by the updater, but |
| 100 // lives on the IO thread. | 86 // lives on the IO thread. |
| 101 net::CertTrustAnchorProvider* cert_trust_provider_; | 87 net::CertTrustAnchorProvider* cert_trust_provider_; |
| 102 | 88 |
| 103 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); | 89 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdaterImplCros); |
| 104 }; | 90 }; |
| 105 | 91 |
| 106 } // namespace policy | 92 } // namespace policy |
| 107 | 93 |
| 108 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CRO
S_H_ |
| OLD | NEW |