OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/policy/network_configuration_updater.h" | 5 #include "chrome/browser/policy/network_configuration_updater.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/network_library.h" | 7 #include "chrome/browser/chromeos/cros/network_library.h" |
8 #include "chrome/browser/policy/policy_map.h" | 8 #include "chrome/browser/policy/policy_map.h" |
9 #include "policy/policy_constants.h" | 9 #include "policy/policy_constants.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... | |
29 void NetworkConfigurationUpdater::Update() { | 29 void NetworkConfigurationUpdater::Update() { |
30 ConfigurationPolicyProvider* provider = provider_registrar_.provider(); | 30 ConfigurationPolicyProvider* provider = provider_registrar_.provider(); |
31 | 31 |
32 PolicyMap policy; | 32 PolicyMap policy; |
33 if (!provider->Provide(&policy)) { | 33 if (!provider->Provide(&policy)) { |
34 LOG(WARNING) << "Failed to read policy from policy provider."; | 34 LOG(WARNING) << "Failed to read policy from policy provider."; |
35 return; | 35 return; |
36 } | 36 } |
37 | 37 |
38 ApplyNetworkConfiguration(policy, kPolicyDeviceOpenNetworkConfiguration, | 38 ApplyNetworkConfiguration(policy, kPolicyDeviceOpenNetworkConfiguration, |
39 chromeos::NetworkUIData::ONC_SOURCE_DEVICE_POLICY, | |
kmixter1
2011/12/13 19:21:03
Could you add a TODO(crosbug.com/24152) to note th
Mattias Nissler (ping if slow)
2011/12/14 20:46:38
http://codereview.chromium.org/8804021/ does that.
| |
39 &device_network_config_); | 40 &device_network_config_); |
40 ApplyNetworkConfiguration(policy, kPolicyOpenNetworkConfiguration, | 41 ApplyNetworkConfiguration(policy, kPolicyOpenNetworkConfiguration, |
42 chromeos::NetworkUIData::ONC_SOURCE_USER_POLICY, | |
41 &user_network_config_); | 43 &user_network_config_); |
42 } | 44 } |
43 | 45 |
44 void NetworkConfigurationUpdater::ApplyNetworkConfiguration( | 46 void NetworkConfigurationUpdater::ApplyNetworkConfiguration( |
45 const PolicyMap& policy_map, | 47 const PolicyMap& policy_map, |
46 ConfigurationPolicyType policy_type, | 48 ConfigurationPolicyType policy_type, |
49 chromeos::NetworkUIData::ONCSource onc_source, | |
47 std::string* cached_value) { | 50 std::string* cached_value) { |
48 std::string new_network_config; | 51 std::string new_network_config; |
49 const base::Value* value = policy_map.Get(policy_type); | 52 const base::Value* value = policy_map.Get(policy_type); |
50 if (value != NULL) { | 53 if (value != NULL) { |
51 // If the policy is not a string, we issue a warning, but still clear the | 54 // If the policy is not a string, we issue a warning, but still clear the |
52 // network configuration. | 55 // network configuration. |
53 if (!value->GetAsString(&new_network_config)) | 56 if (!value->GetAsString(&new_network_config)) |
54 LOG(WARNING) << "Invalid network configuration."; | 57 LOG(WARNING) << "Invalid network configuration."; |
55 } | 58 } |
56 | 59 |
57 if (*cached_value != new_network_config) { | 60 if (*cached_value != new_network_config) { |
58 *cached_value = new_network_config; | 61 *cached_value = new_network_config; |
59 if (!network_library_->LoadOncNetworks(new_network_config, "")) | 62 if (!network_library_->LoadOncNetworks(new_network_config, "", onc_source)) |
60 LOG(WARNING) << "Network library failed to load ONC configuration."; | 63 LOG(WARNING) << "Network library failed to load ONC configuration."; |
61 } | 64 } |
62 } | 65 } |
63 | 66 |
64 } // namespace policy | 67 } // namespace policy |
OLD | NEW |