| 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_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ |
| 6 #define CHROME_BROWSER_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 6 #define CHROME_BROWSER_POLICY_NETWORK_CONFIGURATION_UPDATER_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/cros/network_ui_data.h" | 12 #include "chrome/browser/chromeos/cros/network_ui_data.h" |
| 13 #include "chrome/browser/policy/policy_service.h" | 13 #include "chrome/browser/policy/policy_service.h" |
| 14 #include "chromeos/network/onc/onc_constants.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class Value; | 17 class Value; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace policy { | 20 namespace policy { |
| 20 | 21 |
| 21 class PolicyMap; | 22 class PolicyMap; |
| 22 | 23 |
| 23 // Keeps track of the network configuration policy settings and Shill's | 24 // Keeps track of the network configuration policy settings and Shill's |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 // |allow_web_trust| to true allows giving Web trust to the certificates that | 48 // |allow_web_trust| to true allows giving Web trust to the certificates that |
| 48 // request it. | 49 // request it. |
| 49 void set_allow_web_trust(bool allow) { allow_web_trust_ = allow; } | 50 void set_allow_web_trust(bool allow) { allow_web_trust_ = allow; } |
| 50 | 51 |
| 51 // Empty network configuration blob. | 52 // Empty network configuration blob. |
| 52 static const char kEmptyConfiguration[]; | 53 static const char kEmptyConfiguration[]; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 // Callback that's called by |policy_service_| if the respective ONC policy | 56 // Callback that's called by |policy_service_| if the respective ONC policy |
| 56 // changed. | 57 // changed. |
| 57 void OnPolicyChanged(chromeos::NetworkUIData::ONCSource onc_source, | 58 void OnPolicyChanged(chromeos::onc::ONCSource onc_source, |
| 58 const base::Value* previous, | 59 const base::Value* previous, |
| 59 const base::Value* current); | 60 const base::Value* current); |
| 60 | 61 |
| 61 // Retrieves the ONC policies from |policy_service_| and pushes the | 62 // Retrieves the ONC policies from |policy_service_| and pushes the |
| 62 // configurations to |network_library_|. Ensures that a device policy is | 63 // configurations to |network_library_|. Ensures that a device policy is |
| 63 // always overwritten by a user policy. | 64 // always overwritten by a user policy. |
| 64 void ApplyNetworkConfigurations(); | 65 void ApplyNetworkConfigurations(); |
| 65 | 66 |
| 66 // Push the policy stored at |policy_key| for |onc_source| to | 67 // Push the policy stored at |policy_key| for |onc_source| to |
| 67 // |network_library_|. | 68 // |network_library_|. |
| 68 void ApplyNetworkConfiguration(const std::string& policy_key, | 69 void ApplyNetworkConfiguration(const std::string& policy_key, |
| 69 chromeos::NetworkUIData::ONCSource onc_source); | 70 chromeos::onc::ONCSource onc_source); |
| 70 | 71 |
| 71 // Wraps the policy service we read network configuration from. | 72 // Wraps the policy service we read network configuration from. |
| 72 PolicyChangeRegistrar policy_change_registrar_; | 73 PolicyChangeRegistrar policy_change_registrar_; |
| 73 | 74 |
| 74 // Network library to write network configuration to. | 75 // Network library to write network configuration to. |
| 75 chromeos::NetworkLibrary* network_library_; | 76 chromeos::NetworkLibrary* network_library_; |
| 76 | 77 |
| 77 // Whether the user policy is already available. | 78 // Whether the user policy is already available. |
| 78 bool user_policy_initialized_; | 79 bool user_policy_initialized_; |
| 79 | 80 |
| 80 // Whether Web trust is allowed or not. | 81 // Whether Web trust is allowed or not. |
| 81 bool allow_web_trust_; | 82 bool allow_web_trust_; |
| 82 | 83 |
| 83 // The policy service storing the ONC policies. | 84 // The policy service storing the ONC policies. |
| 84 PolicyService* policy_service_; | 85 PolicyService* policy_service_; |
| 85 | 86 |
| 86 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); | 87 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdater); |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace policy | 90 } // namespace policy |
| 90 | 91 |
| 91 #endif // CHROME_BROWSER_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ | 92 #endif // CHROME_BROWSER_POLICY_NETWORK_CONFIGURATION_UPDATER_H_ |
| OLD | NEW |